Add bandages
This commit is contained in:
parent
82fb96c168
commit
3e57880520
7 changed files with 45 additions and 1 deletions
2
mods/ctf/ctf_bandages/depends.txt
Normal file
2
mods/ctf/ctf_bandages/depends.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
default
|
||||
ctf
|
1
mods/ctf/ctf_bandages/description.txt
Normal file
1
mods/ctf/ctf_bandages/description.txt
Normal file
|
@ -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.
|
35
mods/ctf/ctf_bandages/init.lua
Normal file
35
mods/ctf/ctf_bandages/init.lua
Normal file
|
@ -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,
|
||||
})
|
3
mods/ctf/ctf_bandages/mod.conf
Normal file
3
mods/ctf/ctf_bandages/mod.conf
Normal file
|
@ -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
|
BIN
mods/ctf/ctf_bandages/textures/ctf_bandages_bandage.png
Normal file
BIN
mods/ctf/ctf_bandages/textures/ctf_bandages_bandage.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue