mirror of
https://github.com/S4mpsa/InfOS.git
synced 2025-08-03 09:56:01 -04:00
Adding machine states to machine.lua
This commit is contained in:
parent
711d96108c
commit
fc6b6db776
@ -1,27 +1,40 @@
|
||||
-- Import section
|
||||
local mock = require("data.mock.mock-energy-provider")
|
||||
EnergyProvider = require("data.datasource.energy-provider")
|
||||
MultiBlock = require("data.datasource.multi-block")
|
||||
Inherits = require("utils.inherits")
|
||||
--
|
||||
|
||||
local machine = Inherits(EnergyProvider)
|
||||
local machines = {}
|
||||
|
||||
machine.types = {
|
||||
energy = "energy",
|
||||
multiblock = "multiblock",
|
||||
singleblock = "singleblock"
|
||||
}
|
||||
|
||||
machine.states = {
|
||||
ON = {name = "ON", color = Colors.workingColor},
|
||||
FULL = {name = "FULL", color = Colors.workingColor},
|
||||
IDLE = {name = "IDLE", color = Colors.idleColor},
|
||||
FILLING = {name = "FILLING", color = Colors.idleColor},
|
||||
OFF = {name = "OFF", color = Colors.offColor},
|
||||
DRAINING = {name = "DRAINING", color = Colors.offColor},
|
||||
BROKEN = {name = "BROKEN", color = Colors.errorColor},
|
||||
EMPTY = {name = "EMPTY", color = Colors.errorColor}
|
||||
}
|
||||
|
||||
function machine.getMachine(address, name, type)
|
||||
if machines[address] then
|
||||
return machines[address]
|
||||
else
|
||||
local mach = {}
|
||||
if type == machine.types.energy then
|
||||
print(machine.name)
|
||||
mach = EnergyProvider:new(address, name)
|
||||
elseif type == machine.types.multiblock then
|
||||
mach = MultiBlock:new(address, name)
|
||||
end
|
||||
mach = machine:new(address, name)
|
||||
machines[address] = mach
|
||||
return mach
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user