Reorganise game into modpacks

This commit is contained in:
rubenwardy 2019-01-11 15:45:27 +00:00
parent 86a5266bb5
commit b38a89c2fe
762 changed files with 9 additions and 8 deletions

23
mods/pvp/hpregen/init.lua Normal file
View file

@ -0,0 +1,23 @@
local regen_interval = tonumber(minetest.settings:get("regen_interval"))
if regen_interval <= 0 then
regen_interval = 6
end
local regen_amount = tonumber(minetest.settings:get("regen_amount"))
if regen_amount <= 0 then
regen_amount = 1
end
local function regen_all()
for _, player in pairs(minetest.get_connected_players()) do
local oldhp = player:get_hp()
if oldhp > 0 then
local newhp = oldhp + regen_amount
if newhp > 20 then
newhp = 20
end
player:set_hp(newhp)
end
end
minetest.after(regen_interval, regen_all)
end
minetest.after(regen_interval, regen_all)