spawning of rodents and wolves enabled and adjusted
parent
a7838485dc
commit
257a737f92
|
@ -47,7 +47,7 @@ local function animal_step(self, dtime)
|
|||
btdata.yaw = yaw
|
||||
btdata.mob = self
|
||||
|
||||
print("\n<<< start >>> ("..math.floor(pos.x)..","..math.floor(pos.z)..")")
|
||||
-- print("\n<<< start >>> ("..math.floor(pos.x)..","..math.floor(pos.z)..")")
|
||||
|
||||
-- inventories cannot be serialized and cause the game to crash if
|
||||
-- placed in the entity's table
|
||||
|
@ -55,7 +55,7 @@ local function animal_step(self, dtime)
|
|||
btdata.inv = inv
|
||||
|
||||
bt.tick(self.bt, btdata)
|
||||
print("<<< end >>>\n")
|
||||
-- print("<<< end >>>\n")
|
||||
|
||||
-- so clear it out after running the behavior trees
|
||||
btdata.inv = nil
|
||||
|
@ -71,7 +71,7 @@ local function animal_step(self, dtime)
|
|||
local below = minetest.get_node({x=rpos.x, y=rpos.y-2, z=rpos.z})
|
||||
|
||||
self.node_below = below.name
|
||||
print("below: ".. self.node_below)
|
||||
-- print("below: ".. self.node_below)
|
||||
|
||||
self.last_rpos = rpos
|
||||
end
|
||||
|
|
23
spawning.lua
23
spawning.lua
|
@ -16,14 +16,17 @@ minetest.register_abm({
|
|||
"default:dirt_with_coniferous_litter",
|
||||
"default:desert_sand",
|
||||
"default:silver_sand",
|
||||
"default:gravel",
|
||||
|
||||
},
|
||||
neighbors = {"air"},
|
||||
interval = 30,
|
||||
chance = 400,
|
||||
chance = 1000,
|
||||
catch_up = false,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
if active_object_count > 10 then
|
||||
-- print("spawn rat")
|
||||
if active_object_count > 3 then
|
||||
--print("too many local objs " .. active_object_count)
|
||||
return
|
||||
end
|
||||
|
@ -37,7 +40,7 @@ minetest.register_abm({
|
|||
--print("----------spawning rat")
|
||||
local p = minetest.find_node_near(pos, 3, "air")
|
||||
if p then
|
||||
-- local mob = minetest.add_entity(p, "mobehavior:rat")
|
||||
local mob = minetest.add_entity(p, "mobehavior:rat")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -52,8 +55,8 @@ minetest.register_abm({
|
|||
"default:dirt_with_coniferous_litter",
|
||||
},
|
||||
neighbors = {"air"},
|
||||
interval = 20,
|
||||
chance = 200,
|
||||
interval = 60,
|
||||
chance = 400,
|
||||
catch_up = false,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
@ -62,7 +65,7 @@ minetest.register_abm({
|
|||
return
|
||||
end
|
||||
|
||||
local nearobjs = minetest.get_objects_inside_radius(pos, 20)
|
||||
local nearobjs = minetest.get_objects_inside_radius(pos, 50)
|
||||
if #nearobjs > 3 then
|
||||
-- print("too many near objs")
|
||||
return
|
||||
|
@ -89,12 +92,12 @@ minetest.register_abm({
|
|||
"default:silver_sand",
|
||||
},
|
||||
neighbors = {"air"},
|
||||
interval = 30,
|
||||
chance = 600,
|
||||
interval = 45,
|
||||
chance = 800,
|
||||
catch_up = false,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
if active_object_count > 8 then
|
||||
if active_object_count > 2 then
|
||||
--print("too many local objs " .. active_object_count)
|
||||
return
|
||||
end
|
||||
|
@ -108,7 +111,7 @@ minetest.register_abm({
|
|||
--print("----------spawning rat")
|
||||
local p = minetest.find_node_near(pos, 3, "air")
|
||||
if p then
|
||||
-- local mob = minetest.add_entity(p, "mobehavior:bunny")
|
||||
local mob = minetest.add_entity(p, "mobehavior:bunny")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue