Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notify player when combat mode timer increases while inside blocks #1246

Merged
merged 3 commits into from
Nov 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions mods/ctf/ctf_combat/ctf_combat_mode/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand All @@ -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)
Expand All @@ -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)
Expand Down
Loading