Imported from trollstream "ContentDB"

master
OldCoder 2022-09-04 22:01:09 -07:00
commit 5169f482dd
4 changed files with 47 additions and 0 deletions

3
LICENSE.md Normal file
View File

@ -0,0 +1,3 @@
Code License is CC-BY-SA-3.0
Media License is MIT.

41
init.lua Normal file
View File

@ -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)

3
mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = vitality
description = Provides a Lifegiving mod to Minetest.
depends = hudbars

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB