forked from VoxeLibre/VoxeLibre
Use ABM to propagate / remove the beam
This commit is contained in:
parent
2f868afedb
commit
bcfd664e9b
|
@ -46,6 +46,9 @@ minetest.register_node("mcl_beacons:beacon_beam",{
|
||||||
light_source = 15,
|
light_source = 15,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
pointable = false,
|
pointable = false,
|
||||||
|
-- diggable = false,
|
||||||
|
floodable = false,
|
||||||
|
buildable_to = true,
|
||||||
groups = {not_in_creative_inventory=1},
|
groups = {not_in_creative_inventory=1},
|
||||||
_mcl_blast_resistance = 1200,
|
_mcl_blast_resistance = 1200,
|
||||||
})
|
})
|
||||||
|
@ -289,8 +292,28 @@ function register_beaconfuel(itemstring)
|
||||||
table.insert(beacon_fuellist, itemstring)
|
table.insert(beacon_fuellist, itemstring)
|
||||||
end
|
end
|
||||||
|
|
||||||
local timer = 0
|
minetest.register_abm({
|
||||||
|
label = "Beacon beams propagation",
|
||||||
|
nodenames ={ "mcl_beacons:beacon_beam" },
|
||||||
|
neighbors = { "air" },
|
||||||
|
interval = 3,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos,node)
|
||||||
|
local p1 = vector.offset(pos,0,-1,0)
|
||||||
|
local p2 = vector.offset(pos,0,1,0)
|
||||||
|
local n1 = minetest.get_node(p1)
|
||||||
|
local n2 = minetest.get_node(p2)
|
||||||
|
if n1.name == "air" then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
return
|
||||||
|
elseif n2.name == "air" then
|
||||||
|
minetest.set_node(p2,node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local timer = 0
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
timer = timer + dtime
|
timer = timer + dtime
|
||||||
if timer >= 3 then
|
if timer >= 3 then
|
||||||
|
|
Loading…
Reference in New Issue