Fix multiple crashes

This commit is contained in:
ElCeejo 2022-03-02 22:21:46 -08:00
parent 413cb773e2
commit 288d15225b
10 changed files with 10 additions and 1668 deletions

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 771 B

After

Width:  |  Height:  |  Size: 5.2 KiB