Fix multiple crashes
|
@ -745,8 +745,8 @@ creatura.register_utility("animalia:boid_wander", function(self, group)
|
|||
group_tick = 0
|
||||
end
|
||||
if (move
|
||||
and goal)
|
||||
or far_from_group then
|
||||
or far_from_group)
|
||||
and goal then
|
||||
animalia.action_boid_walk(self, goal, 6, "creatura:neighbors", 0.35)
|
||||
else
|
||||
creatura.action_idle(self, idle_time)
|
||||
|
@ -979,7 +979,9 @@ creatura.register_utility("animalia:boid_flee_from_player", function(self, playe
|
|||
and vec_dist(pos, self.lasso_pos) > 10 then
|
||||
escape_pos = self.lasso_pos
|
||||
end
|
||||
animalia.action_boid_walk(self, escape_pos, 6, "creatura:obstacle_avoidance", 1, "run")
|
||||
if escape_pos then
|
||||
animalia.action_boid_walk(self, escape_pos, 6, "creatura:obstacle_avoidance", 1, "run")
|
||||
end
|
||||
end
|
||||
if vec_dist(pos, tpos) > self.tracking_range + (#mobs_in_group or 0) then
|
||||
return true
|
||||
|
|
|
@ -257,7 +257,8 @@ minetest.register_on_generated(function(minp, maxp)
|
|||
z = zcen,
|
||||
}
|
||||
local spawnable_mobs = get_spawnable_mobs(center)
|
||||
if spawnable_mobs then
|
||||
if spawnable_mobs
|
||||
and #spawnable_mobs > 0 then
|
||||
local mob = spawnable_mobs[random(#spawnable_mobs)]
|
||||
table.insert(animalia.spawn_queue, {pos = center, mob = mob, group = random(3, 4)})
|
||||
table.insert(animalia.spawn_points, center)
|
||||
|
@ -280,7 +281,8 @@ minetest.register_globalstep(function(dtime)
|
|||
if dist_to_nearest_player(point) < 48
|
||||
and minetest.get_node_or_nil(point) then
|
||||
local spawnable_mobs = get_spawnable_mobs(point)
|
||||
if spawnable_mobs then
|
||||
if spawnable_mobs
|
||||
and #spawnable_mobs > 0 then
|
||||
local mob = spawnable_mobs[random(#spawnable_mobs)]
|
||||
local objects = minetest.get_objects_inside_radius(point, 32)
|
||||
local spawn = true
|
||||
|
|
1663
behaviors.lua
|
@ -101,6 +101,7 @@ creatura.register_mob("animalia:wolf", {
|
|||
end
|
||||
if target then
|
||||
if is_attacking
|
||||
and self._utility_data.args[2]
|
||||
and self._utility_data.args[2] == target then
|
||||
return 0
|
||||
end
|
||||
|
|
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 6 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 771 B After Width: | Height: | Size: 5.2 KiB |