From 3e57880520b05467e0982a21b78d42ea8f081e4b Mon Sep 17 00:00:00 2001 From: MinetestSam Date: Sat, 26 Jan 2019 13:09:30 +0530 Subject: [PATCH] Add bandages --- mods/ctf/ctf_bandages/depends.txt | 2 + mods/ctf/ctf_bandages/description.txt | 1 + mods/ctf/ctf_bandages/init.lua | 35 ++++++++++++++++++ mods/ctf/ctf_bandages/mod.conf | 3 ++ .../textures/ctf_bandages_bandage.png | Bin 0 -> 2931 bytes mods/ctf/ctf_treasure/init.lua | 2 + mods/other/random_messages/init.lua | 3 +- 7 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 mods/ctf/ctf_bandages/depends.txt create mode 100644 mods/ctf/ctf_bandages/description.txt create mode 100644 mods/ctf/ctf_bandages/init.lua create mode 100644 mods/ctf/ctf_bandages/mod.conf create mode 100644 mods/ctf/ctf_bandages/textures/ctf_bandages_bandage.png 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 0000000000000000000000000000000000000000..c34e8247adda3b9cbf8d592eb8fa7418746b8e6e GIT binary patch literal 2931 zcmV-(3yk!MP)N2bZe?^J zG%hhNHDpIvQUCx7@kvBMRCr$PSXoe8*BRDB^U%C?GSf79O`N0;o!DI0(>`^k&A2md z(rL_=urFd0Hnw51*am}HBrpj$OGkt9DH~QwBd(P24=ikmb|JA5ap+bcU6)IGyP@zJF3Kc3;s8FFog$fn_ z=NM>Cf52Ul^5ke^j^r|CNsg+tFqct_`j2InNGI2_O0vrPcX)Y5vxnbZcftn(_Oj(MxYjzEcLtQ+)+FDMyW~5cOv($lXXW*UujIhWitL>1 zm!ED(lQns}1h=E^ob<_o;Io5AO<-tTr*rnx<) zOrHnu-(=BS|>YA8TH-OsSgLm+(dJ_^nhI-_jt&H zj^o-Sr!iyZ+Ut2V(zu_X2*IJo9EA;d28U5+js(kLv<+e0SW6yFoH<6HT2ImP%m~rS z9U}S$R50?{HQIS9hcriiEBI^F$I!NcwH3N|=Qe$Db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