49f4e6fd47
* Update teams.lua * Update teams.lua and init.lua * Update teams.lua and init.lua * Update teams.lua and init.lua * Update teams.lua and init.lua Kill assist implemented * Update init.lua Remove unused variables * Added ctf.clearAssists function Only awards those who did more that 50% of damage Clears attackers stats after suicide * Remove unused variable * Minor modifications renamed ctf.clearAssists to ctf.clear_assists changed playerName to player * Cap assist points * Reaching full health while in combat clears assist data * split points between assisting players by damage done * Reworked assist data storage to work with a table rather than player metadata * Fix lua check * Removed duplicate scoring * Change kill assist color * Health regen subtracts from assist. Suicide gives assist points * Fixed accessing nil value for max_hp * Corrected max_hp * hardcode hp list for max hp
39 lines
921 B
Lua
39 lines
921 B
Lua
hpregen = {}
|
|
|
|
hpregen.interval = tonumber(minetest.settings:get("hpregen.interval"))
|
|
if hpregen.interval <= 0 then
|
|
hpregen.interval = 6
|
|
end
|
|
hpregen.amount = tonumber(minetest.settings:get("hpregen.amount"))
|
|
if hpregen.amount <= 0 then
|
|
hpregen.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 + hpregen.amount
|
|
if newhp > player:get_properties().hp_max then
|
|
newhp = player:get_properties().hp_max
|
|
ctf.clear_assists(player:get_player_name())
|
|
end
|
|
if oldhp ~= newhp then
|
|
ctf.add_heal_assist(player:get_player_name(), hpregen.amount)
|
|
player:set_hp(newhp)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
local update = 0
|
|
minetest.register_globalstep(function(delta)
|
|
update = update + delta
|
|
if update < hpregen.interval then
|
|
return
|
|
end
|
|
update = update - hpregen.interval
|
|
|
|
regen_all()
|
|
end)
|