Remove update loop for ctf_events

This commit is contained in:
rubenwardy 2017-10-06 03:02:16 +01:00
parent 45d2148d86
commit 9df0bd99ce

View file

@ -115,19 +115,22 @@ function ctf_events.update(player)
end end
function ctf_events.update_all() function ctf_events.update_all()
print("Updating events log") print("Updating ctf_event logs for all players")
for _, player in pairs(minetest.get_connected_players()) do for _, player in pairs(minetest.get_connected_players()) do
ctf_events.update(player) ctf_events.update(player)
end end
minetest.after(10, ctf_events.update_all)
end end
minetest.after(10, ctf_events.update_all)
ctf.register_on_killedplayer(function(victim, killer, type) ctf.register_on_killedplayer(function(victim, killer, type)
print("Player killed, posting ctf_event")
ctf_events.post("kill_" .. type, killer, victim) ctf_events.post("kill_" .. type, killer, victim)
ctf_events.update_all() ctf_events.update_all()
end) end)
minetest.register_on_joinplayer(function(player)
ctf_events.update(player)
end)
ctf.register_on_new_game(function() ctf.register_on_new_game(function()
ctf_events.events = {} ctf_events.events = {}
ctf_events.update_all() ctf_events.update_all()