Skip to content

Commit 50df694

Browse files
authored
Merge pull request #4 from Navatusein/dev
Dev
2 parents e9c204c + 3a26bbe commit 50df694

File tree

4 files changed

+47
-12
lines changed

4 files changed

+47
-12
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ For the program to work, you need to make a simple setup. On the Heliofusion Exo
9393
it is necessary to connect the subnetwork that will receive dusts and liquids further it will
9494
be called the output subnetwork (On the pictures it is purple). It consists of “ME Dual Interface”,
9595
“Output Hatch (ME)”, “Output Bus (ME)”, “ME Fluid Storage Bus” and “ME Drive” where there are two
96-
disks for liquids of 5 types and one disk for dust. The “ME Fluid Storage Bus” is configured to send
97-
“Degenerate Quark Gluon Plasma” and “Molten Magmatter” to the input subnet (more about it later).
98-
We also have another subnet (In this guide we will consider a setup where the input subnet is our
99-
main subnet, but it is possible to separate them) it consists of “ME IO Port”, “ME Dual Interface”
100-
and “ME Fluid Level Emitter”. From now on in the guide I will refer to it as the input subnet
101-
(It is green in the pictures).
96+
disks for liquids of 5 types and one disk for dust. The “ME Fluid Storage Bus” is configured in input
97+
only mode to send “Degenerate Quark Gluon Plasma” and “Molten Magmatter” to the input subnet
98+
(more about it later). We also have another subnet (In this guide we will consider a setup where
99+
the input subnet is our main subnet, but it is possible to separate them) it consists of “ME IO Port”,
100+
“ME Dual Interface” and “ME Fluid Level Emitter”. From now on in the guide I will refer to it as the
101+
input subnet (It is green in the pictures).
102102

103103
In the schematic we have 2 adapters connected to volume subnets, we also have a transposer
104104
to flip items from the output subnet to the input subnet. Also in one of the adapters we have

docs/front-setup.png

-1.67 KB
Loading

src/heliofusion-exoticizer-controller.lua

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,22 @@ function heliofusionExoticizerController:new(
237237
event.push("log_warning", "Successfully went to Encode Fake Pattern state after a long Idle state")
238238
end
239239

240-
self:encodePattern(self.stateMachine.data.outputs)
240+
local success, outputsCount = self:encodePattern(self.stateMachine.data.outputs)
241+
242+
if success == false then
243+
self.stateMachine.data.errorMessage = "Found an unidentified object in the output subnet"
244+
self.stateMachine:setState(self.stateMachine.states.error)
245+
return
246+
end
247+
248+
local expectedCount = self.magmatterMode == true and 3 or 7
249+
250+
if outputsCount ~= expectedCount then
251+
self.stateMachine.data.errorMessage = "Number of objects ("..outputsCount..") doesn't match the expected ("..expectedCount..")"
252+
self.stateMachine:setState(self.stateMachine.states.error)
253+
return
254+
end
255+
241256
self.stateMachine:setState(self.stateMachine.states.clearOutputAe)
242257
end
243258

@@ -354,6 +369,8 @@ function heliofusionExoticizerController:new(
354369

355370
---Encode fake pattern with the right plasmas
356371
---@param outputs table<string, OutputItem>
372+
---@return boolean
373+
---@return integer
357374
---@private
358375
function obj:encodePattern(outputs)
359376
local index = 1
@@ -370,10 +387,16 @@ function heliofusionExoticizerController:new(
370387
count = value.count * (value.isLiquid == true and 1000 or 144)
371388
end
372389

373-
self.inputMeInterfaceProxy.setInterfacePatternInput(1, self.database.address, self.plasmaList[value.label].databaseIndex, count, index)
390+
if self.plasmaList[value.label] ~= nil then
391+
self.inputMeInterfaceProxy.setInterfacePatternInput(1, self.database.address, self.plasmaList[value.label].databaseIndex, count, index)
392+
else
393+
return false, index - 1
394+
end
374395

375396
index = index + 1
376-
end
397+
end
398+
399+
return true, index - 1
377400
end
378401

379402
---Get items from output ae
@@ -390,13 +413,25 @@ function heliofusionExoticizerController:new(
390413

391414
for _, value in pairs(items) do
392415
local label = value.label:match("Pile of%s(.+)%sDust")
393-
outputs[label] = {label = label, count = value.size, isLiquid = false}
416+
417+
if label == nil then
418+
outputs[value.label] = {label = value.label, count = value.size, isLiquid = false}
419+
else
420+
outputs[label] = {label = label, count = value.size, isLiquid = false}
421+
end
422+
394423
count = count + 1
395424
end
396425

397426
for _, value in pairs(liquids) do
398427
local label = value.label:match("^(.-)%s?[Gg]?[Aa]?[Ss]?$")
399-
outputs[label] = {label = label, count = value.amount, isLiquid = true}
428+
429+
if label == nil then
430+
outputs[value.label] = {label = value.label, count = value.amount, isLiquid = true}
431+
else
432+
outputs[label] = {label = label, count = value.amount, isLiquid = true}
433+
end
434+
400435
count = count + 1
401436
end
402437

version.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
local versions = {
2-
programVersion = "1.0.0",
2+
programVersion = "1.0.2",
33
configVersion = 1
44
}
55

0 commit comments

Comments
 (0)