Compare commits

...

2 Commits

Author SHA1 Message Date
teknomunk 4a44a80576 Fix crash with minecart on activator rail 2024-10-28 21:30:44 -05:00
teknomunk bbd6ec7ff7 Fix cart pitch when detached 2024-10-28 21:26:44 -05:00
3 changed files with 12 additions and 3 deletions

View File

@ -67,6 +67,8 @@ local function detach_driver(self)
--print("No player object found for "..driver_name)
end
end
mod.detach_driver = detach_driver
function mod.kill_cart(staticdata, killer)
local pos
mcl_log("cart #"..staticdata.uuid.." was killed")
@ -341,11 +343,12 @@ function DEFAULT_CART_DEF:on_step(dtime)
end
end
if not staticdata.connected_at then
do_detached_movement(self, dtime)
end
else
mod.update_cart_orientation(self)
end
end
function DEFAULT_CART_DEF:on_death(killer)
kill_cart(self._staticdata, killer)

View File

@ -7,7 +7,7 @@ local mod = mcl_minecarts
local PASSENGER_ATTACH_POSITION = mod.PASSENGER_ATTACH_POSITION
local function activate_normal_minecart(self)
detach_driver(self)
mod.detach_driver(self)
-- Detach passenger
if self._passenger then

View File

@ -572,6 +572,12 @@ local function do_detached_movement(self, dtime)
return
end
end
-- Reset pitch if still not attached
local rot = self.object:get_rotation()
minetest.log(vector.to_string(rot))
rot.x = 0
self.object:set_rotation(rot)
end
--return do_movement, do_detatched_movement