0
0
Fork 0

Workaround for mobs glitching through walls

Thanks, MysticTempest!
This commit is contained in:
Wuzzy 2020-01-06 14:46:10 +01:00
parent 7a870d0ead
commit 1210d8c9a7
2 changed files with 17 additions and 6 deletions

View File

@ -1448,12 +1448,15 @@ local smart_mobs = function(self, s, p, dist, dtime)
end end
end end
-- will try again in 2 second -- will try again in 2 seconds
self.path.stuck_timer = stuck_timeout - 2 self.path.stuck_timer = stuck_timeout - 2
else elseif s.y < p1.y and (not self.fly) then
-- yay i found path do_jump(self) --add jump to pathfinding
self.path.following = true
-- Yay, I found path!
-- TODO: Implement war_cry sound without being annoying -- TODO: Implement war_cry sound without being annoying
--mob_sound(self, "war_cry", true) --mob_sound(self, "war_cry", true)
else
set_velocity(self, self.walk_velocity) set_velocity(self, self.walk_velocity)
-- follow path now that it has it -- follow path now that it has it
@ -3132,9 +3135,17 @@ local function scale_difficulty(value, default, min, special)
end end
end end
local collisionbox = def.collisionbox or {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}
-- Workaround for <https://github.com/minetest/minetest/issues/5966>:
-- Increase upper Y limit to avoid mobs glitching through solid nodes.
-- FIXME: Remove workaround if it's no longer needed.
if collisionbox[5] < 0.79 then
collisionbox[5] = 0.79
end
minetest.register_entity(name, { minetest.register_entity(name, {
stepheight = def.stepheight or 1.1, -- was 0.6 stepheight = def.stepheight or 0.6,
name = name, name = name,
type = def.type, type = def.type,
attack_type = def.attack_type, attack_type = def.attack_type,
@ -3154,7 +3165,7 @@ minetest.register_entity(name, {
breath_max = def.breath_max or 15, breath_max = def.breath_max or 15,
breathes_in_water = def.breathes_in_water or false, breathes_in_water = def.breathes_in_water or false,
physical = true, physical = true,
collisionbox = def.collisionbox or {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}, collisionbox = collisionbox,
selectionbox = def.selectionbox or def.collisionbox, selectionbox = def.selectionbox or def.collisionbox,
visual = def.visual, visual = def.visual,
visual_size = def.visual_size or {x = 1, y = 1}, visual_size = def.visual_size or {x = 1, y = 1},

View File

@ -38,7 +38,7 @@ local spider = {
}, },
walk_velocity = 3.9, walk_velocity = 3.9,
jump = true, jump = true,
jump_height = 2, jump_height = 4,
view_range = 16, view_range = 16,
floats = 1, floats = 1,
drops = { drops = {