Merge branch 'master' of https://github.com/Billy-S/kingdoms_game
This commit is contained in:
commit
0668c80e9f
2
mods/ctf_bandages/depends.txt
Normal file
2
mods/ctf_bandages/depends.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
default
|
||||||
|
ctf
|
1
mods/ctf_bandages/description.txt
Normal file
1
mods/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.
|
45
mods/ctf_bandages/init.lua
Normal file
45
mods/ctf_bandages/init.lua
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
minetest.register_alias("bandage", "ctf_bandages:bandage")
|
||||||
|
|
||||||
|
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,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shaped",
|
||||||
|
output = "ctf_bandages:bandage",
|
||||||
|
recipe = {
|
||||||
|
{"farming:cotton", "farming:cotton", "farming:cotton"},
|
||||||
|
{"farming:cotton", "group:wool", "farming:cotton"},
|
||||||
|
{"farming:cotton", "farming:cotton", "farming:cotton"}
|
||||||
|
}
|
||||||
|
})
|
BIN
mods/ctf_bandages/textures/ctf_bandages_bandage.png
Normal file
BIN
mods/ctf_bandages/textures/ctf_bandages_bandage.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
Loading…
x
Reference in New Issue
Block a user