Improving multiblock mock

Making it dynamic
This commit is contained in:
Gabriel Moreira Minossi 2021-01-17 13:33:58 -03:00
parent 590255c161
commit c830dc58ff

View File

@ -7,20 +7,35 @@ local MockMultiBlock =
Inherits( Inherits(
MockSingleBlock, MockSingleBlock,
{ {
name = "MockMultiBlock" name = "MockMultiBlock",
progress = 0,
maxProgress = 0,
} }
) )
function MockMultiBlock.getSensorInformation() function MockMultiBlock:getSensorInformation()
self.progress = self.progress + 1
if self.progress > self.maxProgress then
self.maxProgress = math.random(500)
self.progress = 0
end
self.isBroken = self.isBroken or math.random(100000) > 99999
return { return {
"Progress: §a2§r s / §e5§r s", "Progress: §a" .. self.progress .. "§r s / §e" .. self.maxProgress .. "§r s",
"Stored Energy: §a1000§r EU / §e1000§r EU", "Stored Energy: §a1000§r EU / §e1000§r EU",
"Probably uses: §c4§r EU/t", "Probably uses: §c4§r EU/t",
"Max Energy Income: §e128§r EU/t(x2A) Tier: §eMV§r", "Max Energy Income: §e128§r EU/t(x2A) Tier: §eMV§r",
"Problems: §c0§r Efficiency: §e100.0§r %", "Problems: §c" .. self.isBroken and 1 or 0 .. "§r Efficiency: §e100.0§r %",
"Pollution reduced to: §a0§r %", "Pollution reduced to: §a0§r %",
n = 6 n = 6
} }
end end
function MockMultiBlock:setWorkAllowed(allow)
if self.isBroken then
self.isBroken = false
end
self.workAllowed = allow
end
return MockMultiBlock return MockMultiBlock