1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-02-02 21:30:20 +01:00

Carts mod patch. Fix #366

Hack that makes sure cart doesn't leave rails and hangs in the air.
This patch now seems to fix that.
(thx for testing with me @fabienwang)
This commit is contained in:
YouniS Bensalah 2016-01-06 06:13:08 +01:00
parent 1d1a075a36
commit 392af4281f

View File

@ -242,6 +242,23 @@ function cart:calc_rail_direction(pos, vel)
p = cart_func.v3:add(p, {x=0, y=-1, z=0})
return self:calc_rail_direction(p, vel)
end
-- NOW the hack gets even dirtier
if cart_func:is_rail(cart_func.v3:add(p, {x=0, y=3, z=0})) and vel.y >= 0 then
p = cart_func.v3:add(p, {x=0, y=1, z=0})
return self:calc_rail_direction(p, vel)
end
if cart_func:is_rail(cart_func.v3:add(p, {x=0, y=-3, z=0})) and vel.y <= 0 then
p = cart_func.v3:add(p, {x=0, y=-1, z=0})
return self:calc_rail_direction(p, vel)
end
if cart_func:is_rail(cart_func.v3:add(p, {x=0, y=4, z=0})) and vel.y >= 0 then
p = cart_func.v3:add(p, {x=0, y=1, z=0})
return self:calc_rail_direction(p, vel)
end
if cart_func:is_rail(cart_func.v3:add(p, {x=0, y=-4, z=0})) and vel.y <= 0 then
p = cart_func.v3:add(p, {x=0, y=-1, z=0})
return self:calc_rail_direction(p, vel)
end
return {x=0, y=0, z=0}, p
end