Mindustry

Mindustry

Not enough ratings
Control_Mining
   
Award
Favorite
Favorited
Unfavorite
Tags: schematic
File Size
Posted
993.000 B
26 Dec, 2020 @ 1:52am
1 Change Note ( view )

Subscribe to download
Control_Mining

Description
Supporting mining using @mega. Each processor binds to a single unit. Add sorters for the processor to identify the type of resource to mine. Add message to debug.

op floor x @thisx 0 op floor y @thisy 0 op mul id x 10000 op add id id y set radius 7 print id print ": Initialize" printflush message1 set unit @mega ubind unit sensor health @unit @health op equal ifCond health 0 jump 14 equal ifCond 0 end sensor enabled switch1 @enabled sensor flag @unit @flag op equal ifCond enabled 1 jump 21 equal ifCond 0 op equal ifCond flag 0 jump 21 equal ifCond 0 ucontrol flag id 0 0 0 0 op equal ifCond enabled 0 jump 27 equal ifCond 0 op equal ifCond flag id jump 27 equal ifCond 0 ucontrol flag 0 0 0 0 0 end sensor carryCap @unit @itemCapacity ulocate building core false @copper coreX coreY found core op equal ifCond found 0 jump 32 equal ifCond 0 end sensor health @unit @health op equal ifCond health 0 jump 36 equal ifCond 0 end sensor flag @unit @flag op notEqual ifCond flag id jump 40 equal ifCond 0 end set minCount -1 set limit 1000 set i 0 getlink block i sensor blockType block @type op equal ifCond blockType @sorter jump 55 equal ifCond 0 sensor item block @config sensor coreCount core item op equal ifCond minCount -1 jump 52 equal ifCond 0 set minCount coreCount op greaterThan ifCond minCount coreCount jump 55 equal ifCond 0 set minCount coreCount op add i i 1 jump 43 lessThan i @links op notEqual ifCond minCount -1 jump 62 equal ifCond 0 op idiv limit minCount 1000 op add limit limit 1 op mul limit limit 1000 set work 0 set i 0 getlink block i sensor blockType block @type op equal ifCond blockType @sorter jump 79 equal ifCond 0 sensor item block @config sensor coreCount core item sensor coreCap core @itemCapacity op sub diff limit coreCount op greaterThan ifCond diff 0 jump 79 equal ifCond 0 ulocate ore core true item oreX oreY found building op equal ifCond found 1 jump 79 equal ifCond 0 set work 1 jump 81 always x false op add i i 1 jump 64 lessThan i @links sensor carryItem @unit @firstItem sensor carryCount @unit @totalItems print id print ": " sensor mining @unit @mining op equal ifCond work 0 jump 102 equal ifCond 0 ucontrol stop 0 0 0 0 0 op equal ifCond carryCount 0 jump 93 equal ifCond 0 print "Stop" printflush message1 op greaterThan ifCond carryCount 0 jump 101 equal ifCond 0 ucontrol approach coreX coreY radius 0 0 ucontrol itemDrop core carryCount 0 0 0 print "Drop " print carryItem print " to core" printflush message1 op add limit limit 1000 op equal ifCond work 1 jump 127 equal ifCond 0 op equal cond1 carryCount 0 op equal cond2 carryItem item op lessThan cond3 carryCount carryCap op land cond4 cond2 cond3 op or cond cond1 cond4 op equal ifCond cond 1 jump 116 equal ifCond 0 ucontrol approach oreX oreY radius 0 0 ucontrol mine oreX oreY 0 0 0 print "Mine " print item printflush message1 op equal ifCond cond 0 jump 127 equal ifCond 0 op equal ifCond mining 1 jump 121 equal ifCond 0 ucontrol stop 0 0 0 0 0 ucontrol approach coreX coreY radius 0 0 ucontrol itemDrop core carryCount 0 0 0 print "Drop " print carryItem print " to core" printflush message1 set nop 0 jump 14 always x false end
3 Comments
eksgaf 25 Aug, 2023 @ 6:35am 
Most useful scheme I found in a while
bojianh  [author] 4 Jan, 2021 @ 11:49pm 
Well, I had to basically experiment each function one by one to understand what the commands does. There is a good link here: https://www.reddit.com/r/Mindustry/comments/ic9wrm/logic_in_60/
Gheti 31 Dec, 2020 @ 11:28am 
I'm starting to mess around with the logic in game, but having no prior experience with programming(unless ya count BASIC on a Commodore 64 back in the late 80s lol) I'm having difficulty understanding the language, functions, and their uses. Do you know of any guides online that help explain what each function is capable of? I've watched some youtube videos, read the mindustry guides in the subreddit, but I still have a long way to go.. I'm slowly getting better, but there are some fundamental concepts to it that I just can't quite grasp..