From b7d8a37fef2ac3dca790cf721e11e8dd24e64965 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 6 Sep 2024 12:58:36 -0700 Subject: [PATCH] properly unassign old minecart --- assign-minecarts.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/assign-minecarts.lua b/assign-minecarts.lua index 5f6550c26..53e498d2b 100644 --- a/assign-minecarts.lua +++ b/assign-minecarts.lua @@ -55,6 +55,12 @@ local function assign_minecart_to_route(route, quiet, minecart) return false end end + for _,vehicle_id in ipairs(route.vehicle_ids) do + local vehicle = utils.binsearch(df.global.world.vehicles.all, vehicle_id, 'id') + if vehicle then vehicle.route_id = -1 end + end + route.vehicle_ids:resize(0) + route.vehicle_stops:resize(0) route.vehicle_ids:insert('#', minecart.id) route.vehicle_stops:insert('#', 0) minecart.route_id = route.id