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