From 5dfebc6df0cb8c308efa08fab2e08d37f13f66ca Mon Sep 17 00:00:00 2001 From: GreenBlob <88883098+a-blob@users.noreply.github.com> Date: Sun, 26 Nov 2023 00:36:30 +0800 Subject: [PATCH] Notify player when combat mode timer increases while inside blocks (#1246) * Add suffocation message * Dealing with luacheck * Only a 3-year-old would make this kind of mistake --- mods/ctf/ctf_combat/ctf_combat_mode/init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mods/ctf/ctf_combat/ctf_combat_mode/init.lua b/mods/ctf/ctf_combat/ctf_combat_mode/init.lua index fb5a58b785..9c9839cb6d 100644 --- a/mods/ctf/ctf_combat/ctf_combat_mode/init.lua +++ b/mods/ctf/ctf_combat/ctf_combat_mode/init.lua @@ -13,8 +13,8 @@ local function update(player) return end - local hud_message = "You are in combat [%ds left]" - hud_message = hud_message:format(combat.time) + local hud_message = "You are in combat [%ds left] \n%s" + hud_message = hud_message:format(combat.time, combat.suffocation_message) if hud:exists(player, "combat_indicator") then hud:change(player, "combat_indicator", { @@ -36,8 +36,10 @@ local function update(player) if node.groups.real_suffocation then -- From real_suffocation mod combat.time = combat.time + 0.5 + combat.suffocation_message = "You are inside blocks. Move out to stop your combat timer from increasing." else combat.time = combat.time - 1 + combat.suffocation_message = "" end combat.timer = minetest.after(1, update, player) @@ -56,6 +58,7 @@ function ctf_combat_mode.add_hitter(player, hitter, weapon_image, time) combat.time = time combat.last_hitter = hitter combat.weapon_image = weapon_image + combat.suffocation_message = "" if not combat.timer then update(player)