Replace flag abm with node timer

master
Coder12a 2018-11-11 14:23:40 -06:00 committed by rubenwardy
parent aa12c0d2f7
commit 7f4ad1d213
3 changed files with 8 additions and 8 deletions

View File

@ -152,6 +152,11 @@ function ctf_flag.update(pos)
end
end
function ctf_flag.flag_tick(pos)
ctf_flag.update(pos)
minetest.get_node_timer(pos):start(5)
end
-- get a flag from a team
function ctf_flag.get(pos)
if not pos then

View File

@ -179,6 +179,7 @@ ctf_flag = {
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Unowned flag")
minetest.get_node_timer(pos):start(5)
end,
after_place_node = function(pos, placer)
local name = placer:get_player_name()

View File

@ -23,7 +23,8 @@ minetest.register_node("ctf_flag:flag", {
on_punch = ctf_flag.on_punch,
on_rightclick = ctf_flag.on_rightclick,
on_construct = ctf_flag.on_construct,
after_place_node = ctf_flag.after_place_node
after_place_node = ctf_flag.after_place_node,
on_timer = ctf_flag.flag_tick
})
for color, _ in pairs(ctf.flag_colors) do
@ -77,13 +78,6 @@ minetest.register_node("ctf_flag:flag_captured_top",{
on_rightclick = ctf_flag.on_rightclick_top
})
minetest.register_abm({
nodenames = {"group:flag_bottom"},
inteval = 5,
chance = 1,
action = ctf_flag.update
})
if ctf.setting("flag.crafting") then
minetest.register_craft({
output = "ctf_flag:flag",