From 84194b71e65207493a3773ce742aec05c81d5d1e Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 21 Sep 2021 21:34:24 +0200 Subject: [PATCH] burning: prevent adding multiple entities+huds --- mods/ENTITIES/mcl_burning/api.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_burning/api.lua b/mods/ENTITIES/mcl_burning/api.lua index 402835d7..0d8e3d15 100644 --- a/mods/ENTITIES/mcl_burning/api.lua +++ b/mods/ENTITIES/mcl_burning/api.lua @@ -155,6 +155,16 @@ function mcl_burning.set_on_fire(obj, burn_time, reason) }) + 1 end + local already_burning = mcl_burning.is_burning(obj) + + + mcl_burning.set(obj, "float", "burn_time", burn_time) + mcl_burning.set(obj, "string", "reason", reason) + + if already_burning then + return + end + local hud_id if obj:is_player() then hud_id = mcl_burning.get(obj, "int", "hud_id") @@ -168,8 +178,7 @@ function mcl_burning.set_on_fire(obj, burn_time, reason) }) + 1 end end - mcl_burning.set(obj, "float", "burn_time", burn_time) - mcl_burning.set(obj, "string", "reason", reason) + mcl_burning.set(obj, "int", "hud_id", hud_id) mcl_burning.set(obj, "int", "sound_id", sound_id)