Use huds with more player notifications (#853)

This commit is contained in:
Lars Müller 2021-04-01 19:17:17 +02:00 committed by GitHub
parent bc519e605a
commit c5560f7a2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View file

@ -480,7 +480,11 @@ minetest.register_on_punchplayer(function(player, hitter,
if to.team == from.team and to.team ~= "" and if to.team == from.team and to.team ~= "" and
to.team ~= nil and to.name ~= from.name then to.team ~= nil and to.name ~= from.name then
minetest.chat_send_player(hname, pname .. " is on your team!") hud_event.new(hname, {
name = "ctf:friendly_fire",
color = "warning",
value = pname .. " is on your team!",
})
if not ctf.setting("friendly_fire") then if not ctf.setting("friendly_fire") then
return true return true
end end

View file

@ -99,7 +99,11 @@ minetest.override_item("ctf_bandages:bandage", {
if ctf.player(pname).team == ctf.player(name).team then if ctf.player(pname).team == ctf.player(name).team then
local nodename = minetest.get_node(object:get_pos()).name local nodename = minetest.get_node(object:get_pos()).name
if ctf_classes.dont_heal[pname] or nodename:find("lava") or nodename:find("water") or nodename:find("trap") then if ctf_classes.dont_heal[pname] or nodename:find("lava") or nodename:find("water") or nodename:find("trap") then
minetest.chat_send_player(name, "You can't heal player in lava, water or spikes!") hud_event.new(name, {
name = "ctf_classes:environment",
color = "warning",
value = "Can't heal " .. pname .. " in lava, water or spikes!",
})
return -- Can't heal players in lava/water/spikes return -- Can't heal players in lava/water/spikes
end end
@ -149,10 +153,15 @@ local function isdiggable(name)
end end
local function paxel_stop(pname, reason) local function paxel_stop(pname, reason)
local message = "Pillar digging stopped "
if reason then
message = message .. reason .. " "
end
message = message .. "- wait " .. DIG_COOLDOWN .. "s"
hud_event.new(pname, { hud_event.new(pname, {
name = "ctf_classes:paxel_stop", name = "ctf_classes:paxel_stop",
color = "success", color = "success",
value = table.concat({"Pillar digging stopped", reason or "unknown", "- wait " .. DIG_COOLDOWN .. "s"}, " "), value = message,
}) })
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end) diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
end end