Replace flag abm with node timer
This commit is contained in:
parent
aa12c0d2f7
commit
7f4ad1d213
@ -152,6 +152,11 @@ function ctf_flag.update(pos)
|
|||||||
end
|
end
|
||||||
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
|
-- get a flag from a team
|
||||||
function ctf_flag.get(pos)
|
function ctf_flag.get(pos)
|
||||||
if not pos then
|
if not pos then
|
||||||
|
@ -179,6 +179,7 @@ ctf_flag = {
|
|||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Unowned flag")
|
meta:set_string("infotext", "Unowned flag")
|
||||||
|
minetest.get_node_timer(pos):start(5)
|
||||||
end,
|
end,
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local name = placer:get_player_name()
|
local name = placer:get_player_name()
|
||||||
|
@ -23,7 +23,8 @@ minetest.register_node("ctf_flag:flag", {
|
|||||||
on_punch = ctf_flag.on_punch,
|
on_punch = ctf_flag.on_punch,
|
||||||
on_rightclick = ctf_flag.on_rightclick,
|
on_rightclick = ctf_flag.on_rightclick,
|
||||||
on_construct = ctf_flag.on_construct,
|
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
|
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
|
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
|
if ctf.setting("flag.crafting") then
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "ctf_flag:flag",
|
output = "ctf_flag:flag",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user