Fix ABM action error in hades_plantslib
This commit is contained in:
parent
eff42bb0cb
commit
294113ac1b
@ -70,7 +70,29 @@ end
|
|||||||
|
|
||||||
-- The spawning ABM
|
-- The spawning ABM
|
||||||
|
|
||||||
local function spawn_on_surfaces_abm_action(pos, node, active_object_count, active_object_count_wider)
|
function hades_plantslib.spawn_on_surfaces(biome)
|
||||||
|
|
||||||
|
if biome.spawn_delay*time_scale >= 1 then
|
||||||
|
biome.interval = biome.spawn_delay*time_scale
|
||||||
|
else
|
||||||
|
biome.interval = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
set_defaults(biome)
|
||||||
|
biome.spawn_plants_count = table.getn(biome.spawn_plants)
|
||||||
|
|
||||||
|
dbg("Registered spawning ABM:")
|
||||||
|
dbg(dump(biome))
|
||||||
|
dbg("Number of trigger nodes in this ABM: "..biome.spawn_plants_count )
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
label = biome.label,
|
||||||
|
nodenames = biome.spawn_surfaces,
|
||||||
|
interval = biome.interval,
|
||||||
|
chance = biome.spawn_chance,
|
||||||
|
neighbors = biome.neighbors,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local p_top = { x = pos.x, y = pos.y + 1, z = pos.z }
|
local p_top = { x = pos.x, y = pos.y + 1, z = pos.z }
|
||||||
local n_top = minetest.get_node(p_top)
|
local n_top = minetest.get_node(p_top)
|
||||||
if is_node_loaded(p_top) then
|
if is_node_loaded(p_top) then
|
||||||
@ -121,32 +143,6 @@ local function spawn_on_surfaces_abm_action(pos, node, active_object_count, acti
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end,
|
||||||
|
|
||||||
function hades_plantslib.spawn_on_surfaces(biome)
|
|
||||||
|
|
||||||
if biome.spawn_delay*time_scale >= 1 then
|
|
||||||
biome.interval = biome.spawn_delay*time_scale
|
|
||||||
else
|
|
||||||
biome.interval = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
set_defaults(biome)
|
|
||||||
biome.spawn_plants_count = table.getn(biome.spawn_plants)
|
|
||||||
|
|
||||||
dbg("Registered spawning ABM:")
|
|
||||||
dbg(dump(biome))
|
|
||||||
dbg("Number of trigger nodes in this ABM: "..biome.spawn_plants_count )
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
label = biome.label,
|
|
||||||
nodenames = biome.spawn_surfaces,
|
|
||||||
interval = biome.interval,
|
|
||||||
chance = biome.spawn_chance,
|
|
||||||
neighbors = biome.neighbors,
|
|
||||||
action = spawn_on_surfaces_abm_action,
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user