fixed spreading.
parent
b581a76b18
commit
245d052bc5
|
@ -32,10 +32,19 @@ function desert_life.spread(nodename, pos, undernode, replacing)
|
|||
local under_location = ({x=location.x, y=location.y-1, z=location.z})
|
||||
local under_name = minetest.get_node_or_nil(under_location)
|
||||
local location_name = minetest.get_node_or_nil(location)
|
||||
if under_name == nil then
|
||||
return -- Should under_name somehow not be a node this will keep the script from crashing.
|
||||
end
|
||||
if under_name.name == undernode then
|
||||
if location_name.name == replacing then
|
||||
if location_name.name == replacing then
|
||||
local pos1 = {x=location.x+2, y=location.y, z=location.z+2}
|
||||
local pos0 = {x=location.x-2, y=location.y, z=location.z-2}
|
||||
local can_replace = minetest.find_nodes_in_area(pos0, pos1, replacing)
|
||||
local replace_num = #can_replace
|
||||
if replace_num > 22 then --increase to decrease number of plants.
|
||||
local face_ran = math.random(0,3)
|
||||
minetest.set_node(location, {name = nodename, param2 = face_ran})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -150,8 +150,8 @@ minetest.register_decoration({
|
|||
|
||||
minetest.register_abm{
|
||||
nodenames = {"group:dl_pp"},
|
||||
interval = 30,
|
||||
chance = 20,
|
||||
interval = 40,
|
||||
chance = 30,
|
||||
action = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == 'desert_life:prickly_pear_1' then
|
||||
|
@ -181,8 +181,8 @@ minetest.register_abm{
|
|||
if desert_life_bloom == true then
|
||||
minetest.register_abm{
|
||||
nodenames = {"group:dl_pp"},
|
||||
interval = 30,
|
||||
chance = 20,
|
||||
interval = 1,
|
||||
chance = 2,
|
||||
action = function(pos)
|
||||
if mymonths.month_counter == 4
|
||||
or mymonths.month_counter == 5
|
||||
|
|
Loading…
Reference in New Issue