TeamDman / SuperFactoryManager

Mozilla Public License 2.0
57 stars 20 forks source link

Output to free inventories? #187

Open nmgix opened 2 weeks ago

nmgix commented 2 weeks ago

As mod uses pseudocode and im not familiar with all the rules, i cannot come to conclusion how to output to machines that have free inventories (all examples(git&ingame) are about conditioning based on input inventories and even w/ "some dest1"(i.e.) i cant choose those "some" destination inventories that triggered "if" code block to put items to).

Idea example:

for exact_machine in machines
   if exact_machine has le 0 item:: then
       output item:: to exact_machine 
   end
end

Example 2: one input chest, cables and 10 machines, machines are fast to input and process, but very slow to output so they clog up processing new items and keep collecting items to process while other machines (whose output was already taken) are stalling (for sure i can do something w/ outputting faster, but that's not the issue). Would be very thankful to get a code example as i dont really want to roll to computercraft.

Maybe aliases could help?

nmgix commented 2 weeks ago

those whos output is been taken rn image those clogged and keep getting items image

my shtcode (mekanism dissolution)

name "Dissolution"

every 20 ticks do
    input sfm:forge_energy:forge:energy from dissolution_energy bottom side
    output sfm:forge_energy:forge:energy to each dissolution bottom side
end

every 20 ticks do
    input item:: from dissolution_box
    output 1 item:: to each dissolution east side 
    forget
    input gas:mekanism:sulfuric_acid from dissolution_gas east side
    output 300 gas:mekanism:sulfuric_acid to each dissolution north side
end

every 20 ticks do
    input slurry:: from each dissolution south side
    output slurry:: to dissolution_provider
end
TeamDman commented 1 week ago

Maybe you could do an if statement to check if any machine has slurry in the output and only if not do you move the ores?

nmgix commented 1 week ago

Although it will work in this scenario, i cant come to a solution where i will need to push bunch of different resources only in those machines that already have water (for example) in them. Mekanism solves this issue by forbidding input of (for example) gases and items if water is not present, but what should i do if another mod's machine is not that clever? It will allow to push. So what im saying is, (add suggestion label if you want) add more control about exact machine im working at in cycle (keep in mind that i usually connect 64+ machines of same type)

input item:: from chest as ironSource

-- just an example of idea
for m in each machine do
   output 1 item:: from ironSource
end

yeah, it not accurately aligns with current i/o flow and i didnt dig in in implementing of sorting in mod, but i dont want to get my iron stuck in machine that is not ready (and i dont get they idea of ANY word except the case you provided about checking if any is not empty)

nmgix commented 1 week ago

example of current problem:

 if storage has gt 0 item:mekanism:bio_fuel then
        input fluid:: from tank top side
        output 10 fluid:: to each machine top side
        forget
        input gas:: from gas west side
        output 100 gas:: to each machine top side
        forget
        input item:: from storage
        output 2 item:: to each machine top side
    end

i will end up with 2 bio fuels in random machines with 300 gas or even without because i cant control distribution properly or didnt get idea from examples as they are targeted to from 1 chest to 1 machine

if any machine has item:: do output to each machine? no control whatsoever if machine has item? will it work? not sure at all as in examples u say sfm will check only first inventory

same issue is with infusing factory when resources end up in random machines (i.e iron and redstone) because all i have is output to each and no output if gt...

TeamDman commented 1 week ago

Adding a looping structure is on the todo list until then it's only possible by adding a unique label to the machines and using a separate if statement

nmgix commented 1 week ago

Unique labels can be a solution, but i cant copypaste 8 lines of code for each machine, it would be a solution if FUNCTION mekanism was present to reuse code. Im a bit agressive because im not going to automate everything with CC with its global yielding and your mod is the only good solution, but limited currently. Will wait for updates, sorry if I went too far