Fixes : add gravity to acceleration on sloped track

I noticed that at
[movement.lua:303](cfd214df76/mods/ENTITIES/mcl_minecarts/movement.lua (L303))
in calculate_acceleration, the check for applying gravity overrides the
acceleration instead of taking power (`node_dev._rail_acceleration`)
into account.

I changed this to adding the gravity to the acceleration calculated so
far and confirmed that it fixes the bug.
This commit is contained in:
Robert de Forest 2025-02-15 02:02:23 -08:00 committed by the-real-herowl
parent 5d11ef0c31
commit 1b60c7fae0

View file

@ -303,9 +303,9 @@ local function calculate_acceleration(staticdata)
-- Factor in gravity after everything else
local gravity_strength = 2.45 --friction * 5
if staticdata.dir.y < 0 then
acceleration = gravity_strength - FRICTION
acceleration = acceleration + gravity_strength
elseif staticdata.dir.y > 0 then
acceleration = -gravity_strength + FRICTION
acceleration = acceleration - gravity_strength
end
return acceleration