1
0
Fork 0

Fix mobs collision system only running during movement - major overhaul with ai disabled

This commit is contained in:
jordan4ibanez 2021-04-11 14:21:19 -04:00
parent 2456e3cd1e
commit 67c40885ef
1 changed files with 11 additions and 13 deletions

View File

@ -374,14 +374,8 @@ end
-- move mob in facing direction -- move mob in facing direction
local set_velocity = function(self, v) local set_velocity = function(self, v)
local c_x, c_y = 0, 0 local c_x, c_y = 0, 0
-- can mob be pushed, if so calculate direction
--if self.pushable then
--c_x, c_y = unpack(collision(self))
--end
-- halt mob if it has been ordered to stay -- halt mob if it has been ordered to stay
if self.order == "stand" then if self.order == "stand" then
self.object:set_velocity({x = 0, y = 0, z = 0}) self.object:set_velocity({x = 0, y = 0, z = 0})
@ -395,12 +389,6 @@ local set_velocity = function(self, v)
y = self.object:get_velocity().y, y = self.object:get_velocity().y,
z = (math_cos(yaw) * v) + c_y, z = (math_cos(yaw) * v) + c_y,
}) })
if self.pushable then
--c_x, c_y = unpack(collision(self))
collision(self)
end
end end
@ -3587,6 +3575,7 @@ end
-- main mob function -- main mob function
local mob_step = function(self, dtime) local mob_step = function(self, dtime)
--[[
if not self.fire_resistant then if not self.fire_resistant then
mcl_burning.tick(self.object, dtime) mcl_burning.tick(self.object, dtime)
end end
@ -3745,6 +3734,7 @@ local mob_step = function(self, dtime)
end end
end end
-- Add water flowing for mobs from mcl_item_entity -- Add water flowing for mobs from mcl_item_entity
local p, node, nn, def local p, node, nn, def
p = self.object:get_pos() p = self.object:get_pos()
@ -3756,10 +3746,11 @@ local mob_step = function(self, dtime)
-- Move item around on flowing liquids -- Move item around on flowing liquids
if def and def.liquidtype == "flowing" then if def and def.liquidtype == "flowing" then
]]--
--[[ Get flowing direction (function call from flowlib), if there's a liquid. --[[ Get flowing direction (function call from flowlib), if there's a liquid.
NOTE: According to Qwertymine, flowlib.quickflow is only reliable for liquids with a flowing distance of 7. NOTE: According to Qwertymine, flowlib.quickflow is only reliable for liquids with a flowing distance of 7.
Luckily, this is exactly what we need if we only care about water, which has this flowing distance. ]] Luckily, this is exactly what we need if we only care about water, which has this flowing distance. ]]
--[[
local vec = flowlib.quick_flow(p, node) local vec = flowlib.quick_flow(p, node)
-- Just to make sure we don't manipulate the speed for no reason -- Just to make sure we don't manipulate the speed for no reason
if vec.x ~= 0 or vec.y ~= 0 or vec.z ~= 0 then if vec.x ~= 0 or vec.y ~= 0 or vec.z ~= 0 then
@ -3815,6 +3806,13 @@ local mob_step = function(self, dtime)
end end
end end
end end
]]--
-- can mob be pushed, if so calculate direction
if self.pushable then
--c_x, c_y = unpack(collision(self))
collision(self)
end
end end