Imported from trollstream "ContentDB"
commit
5169f482dd
|
@ -0,0 +1,3 @@
|
|||
Code License is CC-BY-SA-3.0
|
||||
|
||||
Media License is MIT.
|
|
@ -0,0 +1,41 @@
|
|||
minetest.register_on_joinplayer(function(player)
|
||||
local meta = player:get_meta()
|
||||
local health = meta:get_int("health")
|
||||
if health == 0 and meta:get_int("dead") ~= 1 then
|
||||
meta:set_int("health", 0)
|
||||
elseif meta:get_int("dead") == 1 then
|
||||
local name = player:get_player_name()
|
||||
minetest.kick_player(name, "You died on a lifegiving server.")
|
||||
end
|
||||
player:set_hp(meta:get_int("health") + 2)
|
||||
player:set_properties({
|
||||
hp_max = health
|
||||
})
|
||||
end)
|
||||
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
local meta = player:get_meta()
|
||||
local health = meta:get_int("health")
|
||||
local health = health + 2
|
||||
meta:set_int("health", health)
|
||||
if meta:get_int("health") == 22 and player:get_hp() == 0 then
|
||||
meta:set_int("dead", 1)
|
||||
local name = player:get_player_name()
|
||||
minetest.kick_player(name, "You died on a lifegiving server.")
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
local meta = player:get_meta()
|
||||
local health = meta:get_int("health")
|
||||
if meta:get_int("health") == 0 and player:get_hp() == 0 then
|
||||
meta:set_int("dead", 1)
|
||||
local name = player:get_player_name()
|
||||
minetest.kick_player(name, "You died on a lifegiving server.")
|
||||
else
|
||||
player:set_hp(meta:get_int("health") + 2)
|
||||
player:set_properties({
|
||||
hp_max = health
|
||||
})
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,3 @@
|
|||
name = vitality
|
||||
description = Provides a Lifegiving mod to Minetest.
|
||||
depends = hudbars
|
Binary file not shown.
After Width: | Height: | Size: 67 KiB |
Loading…
Reference in New Issue