Mindustry

Mindustry

Not enough ratings
Requester Scatter
   
Award
Favorite
Favorited
Unfavorite
Tags: schematic
File Size
Posted
Updated
1.162 KB
15 Apr, 2023 @ 1:21pm
25 Apr, 2023 @ 9:30am
5 Change Notes ( view )

Subscribe to download
Requester Scatter

Description
Request a free unit flare to refill ammo when half.

Set ammotype via sorter.

Let me know of any bugs.

Change:
Improved Logic
Ammo tracking logic changed to half.
Sorter now unconfigured to allow selecting ammotype first.
Fix:
Improved ammo tracking to prevent hanging flares.
Now Properly Unbinds.

Schematic:
bXNjaAF4nG1Ua0wUVxS+y/KwC4KQ0moLeI0QbEFwqTwtyPKsvLqwpZaXOMze3R2ZxzIzyyOmaVNiBEubBakISoHQII9qsIEUYkOoRRSFPjDFtIhQSyAFq6aQQjFC7+ySpjb9Mbkz53znO985380AWyC3BbYswSDgmoGKTEgQEQ81JCHiEzjgL4KhtEARFB4SFBakDAsNA45aJJA8ZRQpjpXlbhZBAup4hKCJpUSoowkeQZGDPNJRNA0JhuFgiQGx0EDQugCFQoNES1AsMyJYTBFQ4HjcD2dScIZBsJDlSiCngwRbBgtMegFnYg0Eq0cRikOMkeeKkRamcHqKVKgkbpEnyEKK1UNaikHSAtVKCqwNNRZ6KJGaWJJjdZTexFsBBE3jqIBoRIoSwz+ydBQviAGKBKr0Xz2JZ7rhciOPihErQqmjFLKMjuWmYVI1zxkRT5fBTLaAYrXSEBrSgBhCpMgIRQ7JaVFeTqDlwINLyv8TBfY0UYBoATjnaCQj/FWiiFvn2QEHBgkCoUfAXiihRNKAndq0zIWhSJ7bi/WSGMLxGGEZHgBghx8gs5WBPo2lCGoRTjAUiwTslNVGHcdbjbR6KNlp8Utaz7OWWXeqxNkEC7REcppHoolnsW1aiBijWGa9D4LI8VistC+Sw1ADhy223AeMxiWQEqDORNOYa3NVkGP/hyDARgZkACiAjQ2wvMmBDQDOANjklZ4fyxxhJ/dt++SHWMW7dtUuW2Z9VKxpZrshba9aznzcE5dFv5Kxq+Pn9TWx71j5aQ9HuX34km51bszc4DPyY900M9Xscz+Gy88eNQ99tVrZkZD16ktXFuvZt1cMTV5jEds18X1ubh0ehamzIf5zho8Ws2ljudD5XUfk/KUDvvfLbr2TVCqr3D9+sTbuYOSwf8BDL6J4SH8irX0opdrYXr6xcHXiQsti/3yES97g5/MeRs+Z4hj51K7xyw2Bgd9nJHYuLZwcblgNbleF3XstI67KrJ6Wey8lvz/7Qd3yY5mt2Nb8XvqJLOppXrxjInM5pmpPb9e+6QEnxXNKr9DEod7WxPAPB8q9j5ofXej39JPF9T7v9Fdnq1P9k/7uyUNn68uTW5bS28dr5oiGiIsPXu89riif5DvnVWlNZ1wrJ4aJa8svHDiuzvHrV37pUbOjuii9akz1S6b6UtPhw2+Fr/DBjVt/39L/K3nGdVSZX+eUHNRyJKX9xfU+5Y7ouewvHjk1tdSGKl9Ov2Osj2yhTy1kk8cqYsIIm+unuq86Nfu+EdxxfWUk+u5yqTnknG90Z9TsOW+ZOqOjR7ba5sDLJnojmfobY48f5txU3HRRA+Bviu2nKnraTj892OrWuSfEnvwzP37r+MmRb1J3233bpRps9ByoUNpFJZ2t3ublfqNt0HP9duPtnRNHqtxLk4jVocj8z1ybpkINYTOut9Z2R5ODtW+2sG73GGrDeZ2bKspvjefO57q3BvTcnTBf03ddGbqTu382IrVmVvNHeMXGWsNojd/G0a/to7rXf7N/8mDnT0WfFuBfpFy6cH8DV4gSGQ==

Logic:
#Remote Scatter V2 jump desync notEqual randWait 0 #Prevent processor fighting by desyncing #Some one Time Values op rand randWait 0.48 wait randWait desync: sensor scatterE scatter1 @ammoCapacity jump scatterExists notEqual scatterE null end scatterExists: set turretID scatter1 jump turretInfo always turretInfo: sensor turretX turretID @x sensor turretY turretID @y sensor turretCap turretID @ammoCapacity sensor turretTotal turretID @ammo jump ammoTime always ammoTime: sensor switchState switch1 @enabled sensor sorterAmmo sorter1 @config sensor sorterAmmo sorter1 @config op div halfAmmo turretCap 2 jump enableSwitch lessThanEq turretTotal halfAmmo jump switchOff equal switchState 0 jump switchOff greaterThanEq turretTotal halfAmmo jump firstBind always switchOff: control enabled switch1 0 jump unBound always end enableSwitch: control enabled switch1 1 #Order bind firstBind: jump unBound strictEqual sorterAmmo null ubind unit1 sensor controller @unit @controller set return @counter op add return @counter 2 jump command equal controller @this jump startBind always set unit1 @unit jump command always startBind: #Starts when controller is not @this processor ubind @flare sensor controlled @unit @controlled #Check if bound unit is controlled jump desync equal controlled @ctrlPlayer jump desync equal controlled @ctrlCommand jump notControlled equal controlled false end notControlled: set @counter return command: #Start of code commands sensor heldCap @unit @itemCapacity sensor heldTotal @unit @totalItems sensor heldOre @unit @firstItem jump deliverAmmo equal heldOre sorterAmmo ulocate building core false @copper corex corey foundCore coreHome ucontrol approach corex corey 6 ucontrol itemDrop coreHome heldCap ucontrol itemTake coreHome sorterAmmo heldCap end deliverAmmo: ucontrol approach turretX turretY 6 ucontrol itemDrop scatter1 heldCap ucontrol itemDrop swarmer1 heldCap ucontrol itemDrop container1 heldCap end unBound: sensor heldTotal @unit @totalItems ubind unit1 ulocate building core false @copper corex corey foundCore coreHome ucontrol approach corex corey 6 ucontrol itemDrop coreHome heldCap jump wC equal heldTotal 0 end wC: ucontrol unbind set unit1 "nope"