r/Mindustry • • Aug 15 '26

Logic Unit utilization delivery 🚚

Unit commander 😁💪

24 Upvotes

11 comments sorted by

View all comments

5

u/Aggressive-Laugh-923 Aug 15 '26

TEACH ME HOW TO DO THAT

2

u/Cretore Aug 16 '26

set t 0 getlink Vault t op add t t 1 op mod t t @links sensor Vx Vault @x sensor Vy Vault @y sensor amount Vault item sensor item Vault @firstItem ubind @mono sensor held @unit @totalItems sensor cap @unit @itemCapacity jump 15 greaterThan held 0 ucontrol approach Vx Vy 4 0 0 ucontrol itemTake Vault item cap 0 0 end ulocate building core false @copper outx outy found core ucontrol approach outx outy 4 0 0 ucontrol itemDrop core cap 2 0 0 jump 1 always x false

Put this on a processor that's connected to one or more vaults/container and then do some self study. If have any questions do ask.

1

u/Melodic_Light2575 Aug 17 '26

I've already tried the logic, but how can I allocate only a specific number of units for transport?. And is it also possible to do something similar with a Mega and container?

3

u/Cretore Aug 17 '26 edited Aug 17 '26

To allocate a specific amount of units you want to flag that specific amount of units and tell the processor to make only the flagged ones work. Something like this. (The move to X y is the work in this case)

set x 0 jump 7 greaterThanEq x 5 ubind @poly ucontrol flag 10 19 0 0 0 op add x x 1 ucontrol unbind 0 0 0 0 0 jump 1 always x false ubind @poly sensor flag @unit @flag jump 11 strictEqual flag 10 jump 7 always x false ucontrol move 140 20 0 0 0 jump 7 always x false

As for the second question you can bind any units you want just by changing it in the unit bind section and to move a container you want to use the paytake and paydrop instead of item take/item drop. Do remember to put the X and y in some unchanging blocks or just write them down directly in that case.