commit 5169f482dd09aa4e774e2d782b82fbfbed8a5373 Author: OldCoder Date: Sun Sep 4 22:01:09 2022 -0700 Imported from trollstream "ContentDB" diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..31230a1 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,3 @@ +Code License is CC-BY-SA-3.0 + +Media License is MIT. \ No newline at end of file diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..94669a2 --- /dev/null +++ b/init.lua @@ -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) \ No newline at end of file diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..568ae83 --- /dev/null +++ b/mod.conf @@ -0,0 +1,3 @@ +name = vitality +description = Provides a Lifegiving mod to Minetest. +depends = hudbars \ No newline at end of file diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..d223840 Binary files /dev/null and b/screenshot.png differ