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()
|
||||
end
|
||||
|
||||
function SingleBlock:new(partialAdress)
|
||||
function SingleBlock:new(partialAdress, name)
|
||||
local machine = {}
|
||||
setmetatable(machine, self)
|
||||
|
||||
@ -95,9 +95,12 @@ function SingleBlock:new(partialAdress)
|
||||
end
|
||||
)
|
||||
if (not successfull) then
|
||||
print("Couldn't find the machine " .. partialAdress)
|
||||
machine.block = self.mock:new()
|
||||
end
|
||||
|
||||
machine.name = name
|
||||
|
||||
return machine
|
||||
end
|
||||
|
||||
|
@ -3,7 +3,15 @@ New = require("utils.new")
|
||||
--
|
||||
|
||||
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)
|
||||
@ -43,11 +51,11 @@ function MockSingleBlock.getSensorInformation()
|
||||
end
|
||||
|
||||
function MockSingleBlock.getEUOutputAverage()
|
||||
return 128
|
||||
return MockSingleBlock.EUOutputAverage
|
||||
end
|
||||
|
||||
function MockSingleBlock.getEUInputAverage()
|
||||
return 128
|
||||
return MockSingleBlock.EUInputAverage
|
||||
end
|
||||
|
||||
function MockSingleBlock.getStoredEU()
|
||||
@ -71,7 +79,7 @@ function MockSingleBlock.hasWork()
|
||||
end
|
||||
|
||||
function MockSingleBlock.getOutputAmperage()
|
||||
return 2
|
||||
return MockSingleBlock.outputAmperage
|
||||
end
|
||||
|
||||
function MockSingleBlock.getEUCapacity()
|
||||
|
Loading…
x
Reference in New Issue
Block a user