Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /c
- local trains = {}
- local surface = game.surfaces["nauvis"]
- for c in surface.get_chunks() do
- for _, loco in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, type="locomotive"})) do
- local main_loco
- local train = loco.train
- local locos = train.locomotives
- if train.valid and train.locomotives and (#locos.front_movers > 0 or #locos.back_movers > 0) then
- main_loco = locos.front_movers and locos.front_movers[1] or locos.back_movers[1]
- end
- local id = main_loco and main_loco.unit_number
- if id then
- trains[id] = main_loco
- end
- end
- end
- for _, loco in pairs(trains) do
- loco.train.speed = 1.2
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement