RailLogicSystem


Want to control railway by circuit network? Here we go!

Content
9 years ago
0.13 - 0.14
16
Trains

b Reloading causes everything to break

10 years ago
(updated 10 years ago)

So, Maybe it's just me but, When reloading a save, the Shift + G stops opening on broken signals and the inventory reader stops reading and the station signal stops sending trains anywhere cause all the signals stop working too.

10 years ago

Here is a fix for anyone not interested in waiting for a new version. If you go into the control.lua change the following parts of the code:

CHANGE THESE FUNCTIONS:

local function entityBuilt(event)
if classes[event.created_entity.name] ~= nil then
local tab = data[event.created_entity.name]
table.insert(tab, classes[event.created_entity.name].onPlace(event.created_entity))
data[event.created_entity.name] = tab
end
save_data()
end

local function entityRemoved(event)
if classes[event.entity.name] ~= nil then
for k, v in ipairs(data[event.entity.name]) do
if v.entity == event.entity then
local tab = data[event.entity.name]
table.remove(tab, k)
classes[event.entity.name].onDestroy(v)
data[event.entity.name] = tab
break
end
end
end
save_data()
end

local function CloseSCGUI(playerIndex)
if gui[playerIndex] == nil then
return
end
data["rail-station-controller"][gui[playerIndex].entityIndex].station = gui[playerIndex].gui.station.text
gui[playerIndex].gui.destroy()
gui[playerIndex] = nil
save_data()
end

ADD THIS FUNCTION:

local function save_data()
global.railLogicSystem = data
end

10 years ago

Thanks for report, i upload fixed version.

New response