Skip to content

Commit

Permalink
properly unassign old minecart
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Sep 6, 2024
1 parent 8ece866 commit b7d8a37
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions assign-minecarts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b7d8a37

Please sign in to comment.