From 0119814c0dc74e4b2b96cc65a512cf36cb1e0cff Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 1 Sep 2024 16:47:57 -0500 Subject: [PATCH] Prevent trains from slowing on 45 degree track --- mods/ENTITIES/mcl_minecarts/train.lua | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/mods/ENTITIES/mcl_minecarts/train.lua b/mods/ENTITIES/mcl_minecarts/train.lua index 279c21f0e..aab26fcc9 100644 --- a/mods/ENTITIES/mcl_minecarts/train.lua +++ b/mods/ENTITIES/mcl_minecarts/train.lua @@ -89,24 +89,14 @@ end mod.break_train_at = break_train_at function mod.update_train(staticdata) - --local staticdata = cart._staticdata - -- Only update from the back if staticdata.behind or not staticdata.ahead then return end - --print("\nUpdating train") -- Do no special processing if the cart is not part of a train if not staticdata.ahead and not staticdata.behind then return end -- Calculate the maximum velocity of all train cars - local velocity = 0 - local count = 0 - for cart in train_cars(staticdata) do - velocity = velocity + (cart.velocity or 0) - count = count + 1 - end - velocity = velocity / count - --print("Using velocity "..tostring(velocity)) + local velocity = staticdata.velocity -- Set the entire train to the average velocity local behind = nil @@ -132,7 +122,7 @@ function mod.update_train(staticdata) --[[ print(tostring(c.behind).."->"..c.uuid.."->"..tostring(c.ahead).."("..tostring(separation)..") setting cart #".. c.uuid.." velocity from "..tostring(c.velocity).." to "..tostring(cart_velocity)) - ]] + --]] c.velocity = cart_velocity behind = c