mirror of
https://github.com/S4mpsa/InfOS.git
synced 2025-08-04 02:16:05 -04:00
Improving singlebocks
Improving mock interface Adding error messages and name to the `new()` method
This commit is contained in:
parent
1431a0866c
commit
3f887c295a
@ -80,7 +80,7 @@ function SingleBlock:getEUMaxStored()
|
|||||||
return self.block.getEUMaxStored()
|
return self.block.getEUMaxStored()
|
||||||
end
|
end
|
||||||
|
|
||||||
function SingleBlock:new(partialAdress)
|
function SingleBlock:new(partialAdress, name)
|
||||||
local machine = {}
|
local machine = {}
|
||||||
setmetatable(machine, self)
|
setmetatable(machine, self)
|
||||||
|
|
||||||
@ -95,9 +95,12 @@ function SingleBlock:new(partialAdress)
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
if (not successfull) then
|
if (not successfull) then
|
||||||
|
print("Couldn't find the machine " .. partialAdress)
|
||||||
machine.block = self.mock:new()
|
machine.block = self.mock:new()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
machine.name = name
|
||||||
|
|
||||||
return machine
|
return machine
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3,7 +3,15 @@ New = require("utils.new")
|
|||||||
--
|
--
|
||||||
|
|
||||||
local MockSingleBlock = {
|
local MockSingleBlock = {
|
||||||
name = "MockSingleBlock"
|
name = "MockSingleBlock",
|
||||||
|
workAllowed = true,
|
||||||
|
workProgress = 3,
|
||||||
|
workMaxProgress = 4,
|
||||||
|
storedEU = 1234,
|
||||||
|
active = true,
|
||||||
|
outputVoltage = 0,
|
||||||
|
outputAmperage = 1,
|
||||||
|
EUCapacity = 2048
|
||||||
}
|
}
|
||||||
|
|
||||||
function MockSingleBlock.setWorkAllowed(allow)
|
function MockSingleBlock.setWorkAllowed(allow)
|
||||||
@ -43,11 +51,11 @@ function MockSingleBlock.getSensorInformation()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MockSingleBlock.getEUOutputAverage()
|
function MockSingleBlock.getEUOutputAverage()
|
||||||
return 128
|
return MockSingleBlock.EUOutputAverage
|
||||||
end
|
end
|
||||||
|
|
||||||
function MockSingleBlock.getEUInputAverage()
|
function MockSingleBlock.getEUInputAverage()
|
||||||
return 128
|
return MockSingleBlock.EUInputAverage
|
||||||
end
|
end
|
||||||
|
|
||||||
function MockSingleBlock.getStoredEU()
|
function MockSingleBlock.getStoredEU()
|
||||||
@ -71,7 +79,7 @@ function MockSingleBlock.hasWork()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function MockSingleBlock.getOutputAmperage()
|
function MockSingleBlock.getOutputAmperage()
|
||||||
return 2
|
return MockSingleBlock.outputAmperage
|
||||||
end
|
end
|
||||||
|
|
||||||
function MockSingleBlock.getEUCapacity()
|
function MockSingleBlock.getEUCapacity()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user