Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----/ TrainSignalSystem class /---------------------------------------------
- local instances = {}
- --/ constructors /--
- function new(id1, id2, id3)
- local self = {}
- self.onSensorId = id1
- self.offSensorId = id2
- self.signalId = id3
- self.isOn = false
- return self
- end
- --/ functions /--
- function findFromComputerId(id)
- for _, tss in pairs(instances) do
- if tss.onSensorId == id or tss.offSensorId == id or tss.signalId == id then
- return tss
- end
- end
- end
- ----/ linked computer ids /---------------------------------------------
- --[[
- In each array,
- the first id is the computer linked to the activating sensor,
- the second id is the computer linked to the deactivating sensor,
- and the third id is the computer linked to the signal light
- ]]
- local linkedIds = {
- {120, 114, 113},
- }
- ----/ make systems from linked ids /---------------------------------------------
- for _, list in pairs(linkedIds) do
- local trainSignalSystem = new(unpack(list))
- table.insert(instances, trainSignalSystem)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement