Compare commits
No commits in common. "cd355bc9cd846371282e01d495d2c98e6886ff93" and "16c31aa27361b7a862b403666fe904c41d983f48" have entirely different histories.
cd355bc9cd
...
16c31aa273
9 changed files with 34 additions and 106 deletions
|
@ -22,19 +22,7 @@ minetest.register_craftitem("ctf_bandages:bandage", {
|
|||
local hp = object:get_hp()
|
||||
local limit = ctf_bandages.heal_percent * object:get_properties().hp_max
|
||||
|
||||
if hp <= 0 then
|
||||
hud_event.new(name, {
|
||||
name = "ctf_bandages:dead",
|
||||
color = "warning",
|
||||
value = pname .. " is dead!",
|
||||
})
|
||||
elseif hp >= limit then
|
||||
hud_event.new(name, {
|
||||
name = "ctf_bandages:limit",
|
||||
color = "warning",
|
||||
value = pname .. " already has " .. limit .. " HP!",
|
||||
})
|
||||
else
|
||||
if hp > 0 and hp < limit then
|
||||
local hp_add = math.random(3,4)
|
||||
|
||||
kill_assist.add_heal_assist(pname, hp_add)
|
||||
|
@ -45,18 +33,14 @@ minetest.register_craftitem("ctf_bandages:bandage", {
|
|||
end
|
||||
|
||||
object:set_hp(hp)
|
||||
hud_event.new(pname, {
|
||||
name = "ctf_bandages:heal",
|
||||
color = 0xC1FF44,
|
||||
value = name .. " healed you!",
|
||||
})
|
||||
minetest.chat_send_player(pname, minetest.colorize("#C1FF44", name .. " has healed you!"))
|
||||
|
||||
return itemstack
|
||||
else
|
||||
minetest.chat_send_player(name, pname .. " has " .. hp .. " HP. You can't heal them.")
|
||||
end
|
||||
else
|
||||
hud_event.new(name, {
|
||||
name = "ctf_bandages:team",
|
||||
color = "warning",
|
||||
value = pname .. " isn't in your team!",
|
||||
})
|
||||
minetest.chat_send_player(name, pname.." isn't in your team!")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -148,15 +148,6 @@ local function isdiggable(name)
|
|||
)
|
||||
end
|
||||
|
||||
local function paxel_stop(pname, reason)
|
||||
hud_event.new(pname, {
|
||||
name = "ctf_classes:paxel_stop",
|
||||
color = "success",
|
||||
value = table.concat({"Pillar digging stopped", reason, "- wait " .. DIG_COOLDOWN .. "s"}, " "),
|
||||
})
|
||||
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
|
||||
end
|
||||
|
||||
local function remove_pillar(pos, pname)
|
||||
local name = minetest.get_node(pos).name
|
||||
|
||||
|
@ -170,11 +161,13 @@ local function remove_pillar(pos, pname)
|
|||
pos.y = pos.y + 1
|
||||
minetest.after(DIG_SPEED, remove_pillar, pos, pname)
|
||||
else
|
||||
paxel_stop(pname, "at too far away node")
|
||||
minetest.chat_send_player(pname, "Pillar digging stopped, too far away from digging pos. Can activate again in "..DIG_COOLDOWN.." seconds")
|
||||
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
|
||||
end
|
||||
end
|
||||
else
|
||||
paxel_stop(pname, "at undiggable node")
|
||||
minetest.chat_send_player(pname, "Pillar digging stopped at undiggable node. Can activate again in "..DIG_COOLDOWN.." seconds")
|
||||
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -198,39 +191,20 @@ minetest.register_tool("ctf_classes:paxel_bronze", {
|
|||
if pointed_thing.type == "node" then
|
||||
local pname = placer:get_player_name()
|
||||
|
||||
if not isdiggable(minetest.get_node(pointed_thing.under).name) then
|
||||
hud_event.new(pname, {
|
||||
name = "ctf_classes:paxel_undiggable",
|
||||
color = "warning",
|
||||
value = "Can't paxel node!",
|
||||
})
|
||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
||||
end
|
||||
if ctf_match.is_in_build_time() then
|
||||
hud_event.new(pname, {
|
||||
name = "ctf_classes:paxel_build_time",
|
||||
color = "warning",
|
||||
value = "Build time active!",
|
||||
})
|
||||
if not isdiggable(minetest.get_node(pointed_thing.under).name) or ctf_match.is_in_build_time() then
|
||||
minetest.chat_send_player(pname, "Can't dig node or build time active")
|
||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
||||
end
|
||||
|
||||
if not diggers[pname] then
|
||||
hud_event.new(pname, {
|
||||
name = "ctf_classes:paxel_start",
|
||||
color = "primary",
|
||||
value = "Pillar digging started",
|
||||
})
|
||||
minetest.chat_send_player(pname, "Pillar digging started")
|
||||
diggers[pname] = true
|
||||
remove_pillar(pointed_thing.under, pname)
|
||||
elseif type(diggers[pname]) ~= "table" then
|
||||
paxel_stop(pname)
|
||||
minetest.chat_send_player(pname, "Pillar digging stopped. Can activate again in "..DIG_COOLDOWN.." seconds")
|
||||
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
|
||||
else
|
||||
hud_event.new(pname, {
|
||||
name = "ctf_classes:paxel_timer",
|
||||
color = "warning",
|
||||
value = "You can't activate yet!",
|
||||
})
|
||||
minetest.chat_send_player(pname, "You can't activate yet")
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
@ -242,7 +216,8 @@ minetest.register_tool("ctf_classes:paxel_bronze", {
|
|||
minetest.after(2, function()
|
||||
if user and user:get_player_control().RMB then
|
||||
if diggers[pname] and type(diggers[pname]) ~= "table" then
|
||||
paxel_stop(pname)
|
||||
minetest.chat_send_player(pname, "Pillar digging stopped. Can activate again in "..DIG_COOLDOWN.." seconds")
|
||||
diggers[pname] = minetest.after(DIG_COOLDOWN, function() diggers[pname] = nil end)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
|
|
@ -84,11 +84,8 @@ function minetest.is_protected(pos, name, ...)
|
|||
|
||||
local flag, distSQ = ctf_flag.get_nearest(pos)
|
||||
if flag and pos.y >= flag.y - 1 and distSQ < rs then
|
||||
hud_event.new(name, {
|
||||
name = "ctf_bandages:team",
|
||||
color = "warning",
|
||||
value = "Too close to the flag to build (< " .. r .. " nodes) !",
|
||||
})
|
||||
minetest.chat_send_player(name,
|
||||
"Too close to the flag to build! Leave at least " .. r .. " blocks around the flag.")
|
||||
return true
|
||||
else
|
||||
return old_is_protected(pos, name, ...)
|
||||
|
|
|
@ -66,11 +66,7 @@ local old_can_attack = ctf.can_attack
|
|||
function ctf.can_attack(player, hitter, ...)
|
||||
if ctf_match.is_in_build_time() then
|
||||
if hitter:is_player() then
|
||||
hud_event.new(hitter:get_player_name(), {
|
||||
name = "ctf_match:buildtime_hit",
|
||||
color = "warning",
|
||||
value = "Match hasn't started yet!",
|
||||
})
|
||||
minetest.chat_send_player(hitter:get_player_name(), "Match hasn't started yet!")
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -44,20 +44,14 @@ function ctf.can_attack(player, hitter, ...)
|
|||
local hname = hitter:get_player_name()
|
||||
|
||||
if ctf_respawn_immunity.is_immune(player) then
|
||||
hud_event.new(hname, {
|
||||
name = "ctf_respawn_immunity:hit",
|
||||
color = 0xEE8822,
|
||||
value = pname .. " has respawn immunity!",
|
||||
})
|
||||
minetest.chat_send_player(hname, minetest.colorize("#EE8822", pname ..
|
||||
" just respawned or joined," .. " and is immune to attacks!"))
|
||||
return false
|
||||
end
|
||||
|
||||
if ctf_respawn_immunity.is_immune(hitter) then
|
||||
hud_event.new(hname, {
|
||||
name = "ctf_respawn_immunity:end",
|
||||
color = 0xFF8C00,
|
||||
value = "Your immunity has ended!",
|
||||
})
|
||||
minetest.chat_send_player(hname, minetest.colorize("#FF8C00",
|
||||
"Your immunity has ended because you attacked a player"))
|
||||
immune_players[hname] = nil
|
||||
ctf_respawn_immunity.update_effects(hitter)
|
||||
end
|
||||
|
|
|
@ -5,18 +5,6 @@ local players = {}
|
|||
local duration = 7
|
||||
local max = 3
|
||||
local next_check = 10000000
|
||||
-- Bootstrap 5 palette
|
||||
local colors = {
|
||||
primary = 0x0D6EFD,
|
||||
secondary = 0x6C757D,
|
||||
success = 0x198754,
|
||||
info = 0x0DCAF0,
|
||||
warning = 0xFFC107,
|
||||
danger = 0xDC3545,
|
||||
light = 0xF8F9FA,
|
||||
dark = 0x212529,
|
||||
}
|
||||
hud_event.colors = colors
|
||||
|
||||
local function update(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
|
@ -64,8 +52,6 @@ function hud_event.new(name, def)
|
|||
error("hud_event: Invalid HUD event element definition", 2)
|
||||
end
|
||||
|
||||
def.color = colors[def.color] or def.color
|
||||
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then
|
||||
return
|
||||
|
|
|
@ -71,11 +71,8 @@ local function stop_healing(player, interrupted)
|
|||
|
||||
players[name] = nil
|
||||
if interrupted then
|
||||
hud_event.new(name, {
|
||||
name = "medkits:interrupt",
|
||||
color = 0xFF4444,
|
||||
value = "Your healing was interrupted" .. reason_handler(interrupted),
|
||||
})
|
||||
minetest.chat_send_player(name, minetest.colorize("#FF4444",
|
||||
"Your healing was interrupted"..reason_handler(interrupted)))
|
||||
player:set_hp(info.hp)
|
||||
player:get_inventory():add_item("main", ItemStack("medkits:medkit 1"))
|
||||
end
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
local players = {}
|
||||
local blocks_per_second = 5
|
||||
local resend_notification_seconds = 10
|
||||
-- Bootstrap 4 "warning" color
|
||||
local warning_color = 0xFFC107
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
-- player has to wait after join before they can place a node
|
||||
|
@ -20,7 +22,7 @@ minetest.register_on_placenode(function(pos, _newnode, placer, oldnode, _itemsta
|
|||
-- This should happen rarely
|
||||
hud_event.new(name, {
|
||||
name = "place_limit:unpointable",
|
||||
color = "warning",
|
||||
color = warning_color,
|
||||
value = "Block not pointable (dug/replaced)!",
|
||||
})
|
||||
minetest.set_node(pos, oldnode)
|
||||
|
@ -37,7 +39,7 @@ minetest.register_on_placenode(function(pos, _newnode, placer, oldnode, _itemsta
|
|||
if (time - placements.last_notification_sent) / 1e6 >= resend_notification_seconds then
|
||||
hud_event.new(name, {
|
||||
name = "place_limit:speed",
|
||||
color = "warning",
|
||||
color = warning_color,
|
||||
value = "Placing too fast!",
|
||||
})
|
||||
placements.last_notification_sent = time
|
||||
|
|
|
@ -163,11 +163,8 @@ function minetest.is_protected(pos, name, info, ...)
|
|||
|
||||
local flag, distSQ = ctf_flag.get_nearest(pos)
|
||||
if flag and pos.y >= flag.y - 1 and distSQ < rs then
|
||||
hud_event.new(name, {
|
||||
name = "sniper_rifles:hit_base",
|
||||
color = "warning",
|
||||
value = "You can't shoot blocks within " .. r .. " nodes of a flag!",
|
||||
})
|
||||
minetest.chat_send_player(name,
|
||||
"You can't shoot blocks within "..r.." nodes of a flag!")
|
||||
return true
|
||||
else
|
||||
return old_is_protected(pos, name, info, ...)
|
||||
|
|
Loading…
Reference in a new issue