diff --git a/mods/ctf/ctf_bandages/depends.txt b/mods/ctf/ctf_bandages/depends.txt new file mode 100644 index 0000000..f063414 --- /dev/null +++ b/mods/ctf/ctf_bandages/depends.txt @@ -0,0 +1,2 @@ +default +ctf \ No newline at end of file diff --git a/mods/ctf/ctf_bandages/description.txt b/mods/ctf/ctf_bandages/description.txt new file mode 100644 index 0000000..e5d7950 --- /dev/null +++ b/mods/ctf/ctf_bandages/description.txt @@ -0,0 +1 @@ +Adds a bandage which heals team-mates if they are below 15 HP. The bandages heal 3-4 HP until the player reaches 15 HP. \ No newline at end of file diff --git a/mods/ctf/ctf_bandages/init.lua b/mods/ctf/ctf_bandages/init.lua new file mode 100644 index 0000000..0240051 --- /dev/null +++ b/mods/ctf/ctf_bandages/init.lua @@ -0,0 +1,35 @@ +--Inspired from Andrey's bandages mod + +local healing_limit = 15 + +minetest.register_craftitem("ctf_bandages:bandage", { + description = "Bandage, heals teammates for 3-4 HP until HP is equal to "..healing_limit, + inventory_image = "ctf_bandages_bandage.png", + on_use = function(itemstack, player, pointed_thing) + if pointed_thing.type ~= "object" then + return + end + local object = pointed_thing.ref + if not object:is_player() then + return + end + local pname = object:get_player_name() + local name = player:get_player_name() + if ctf.player(pname).team == ctf.player(name).team then + local hp = object:get_hp() + if hp > 0 and hp < healing_limit then + hp = hp + math.random(3,4) + if hp > healing_limit then + hp = healing_limit + end + object:set_hp(hp) + itemstack:take_item() + return itemstack + else + minetest.chat_send_player(name, pname .. " has " .. hp .. " HP. You can't heal them.") + end + else + minetest.chat_send_player(name, pname.." isn't in your team!") + end + end, +}) diff --git a/mods/ctf/ctf_bandages/mod.conf b/mods/ctf/ctf_bandages/mod.conf new file mode 100644 index 0000000..8f22e73 --- /dev/null +++ b/mods/ctf/ctf_bandages/mod.conf @@ -0,0 +1,3 @@ +name = ctf_bandages +description = Adds a bandage which heals team-mates if they are below 15 HP. The bandages heal 3-4 HP until the player reaches 15 HP. +depends = default,ctf diff --git a/mods/ctf/ctf_bandages/textures/ctf_bandages_bandage.png b/mods/ctf/ctf_bandages/textures/ctf_bandages_bandage.png new file mode 100644 index 0000000..c34e824 Binary files /dev/null and b/mods/ctf/ctf_bandages/textures/ctf_bandages_bandage.png differ diff --git a/mods/ctf/ctf_treasure/init.lua b/mods/ctf/ctf_treasure/init.lua index 31ec1be..7a5c1c5 100644 --- a/mods/ctf/ctf_treasure/init.lua +++ b/mods/ctf/ctf_treasure/init.lua @@ -22,4 +22,6 @@ function ctf_treasure.register_default_treasures() treasurer.register_treasure("shooter:machine_gun",0.02,2,1) treasurer.register_treasure("shooter:ammo",0.3,2,{1,10}) treasurer.register_treasure("shooter:arrow_white",0.5,2,{2,18}) + + treasurer.register_treasure("ctf_bandages:bandage",0.3,5,{1,6}) end diff --git a/mods/other/random_messages/init.lua b/mods/other/random_messages/init.lua index 6df6ad2..8d88b4c 100644 --- a/mods/other/random_messages/init.lua +++ b/mods/other/random_messages/init.lua @@ -66,7 +66,8 @@ function random_messages.read_messages() "Trapping team mates on purpose is strictly against the rules and you will be kicked immediately.", "Help your team claim victory by storing extra weapons in the team chest, and never taking more than you need.", "Excessive spawn-killing is a direct violation of the rules - appropriate punishments will be given.", - "Use /r to check your score and rank, and /rankings to see the league tables." + "Use /r to check your score and rank, and /rankings to see the league tables.", + "Use bandages on team-mates to heal them by 3-4 HP if their health is below 15 HP." } end