*ロジックメモ
-printコマンドはコメント代わりに使える。jump先にも指定できるのでぜひ使おう。
-Controlコマンドの工場の稼働/非稼働はconfigureじゃなくてenabled?~
set (enabled) of (buildings) to (@dagger)~
→control enabled building @dagger 0 0 0
-コピペ時jumpコマンドの数字がずれるのでゲーム内貼り付け後、もしくはメモ帳編集時に要修正。
-GetLinkを使う際はプロセッサを建築後にリンク指定する順番にも注意すること。~
GetLinkを使うと細かい指定はできない(たぶん)ので、面倒でも直接指定した方が動作は確実。
~
*ロジックサンプル
[[MindustryWikiのサンプル>https://wikiwiki.jp/mindustry/%E3%83%AD%E3%82%B8%E3%83%83%E3%82%AF/%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%A0#jbb4473b]]
***スイッチを使用した工場の稼働/停止ロジック
Wikiはconfigureになってるけど、サンドボックスだとなぜかenabledに(@dagger)を突っ込むと動いた~
上記にもあるけどGetLinkを使うので、プロセッサー建築後のリンク指定の順番に注意する~
(具体的にはスイッチ→工場x8までの順番で指定する)~
Reconstructor(上位加工)は指定しない(大元を止めればよいため)~
工場自体を止めなくても、素材供給ラインの根元にソーターを仕込んでそこでオンオフでもいい気がする~
 set seisan @dagger
 sensor flg switch1 @enabled
 jump 11 equal flg 1
 print "工場停止"
 printflush message1
 set i 1
 getlink Link i
 control enabled Link 0 0 0 0
 op add i i 1
 jump 6 lessThanEq i 8
 end
 print "工場稼働"
 printflush message1
 set y 1
 getlink Link y
 control enabled Link @dagger 0 0 0
 op add y y 1
 jump 14 lessThanEq y 8
 end
***コアからコンテナに物資を運ぶ
冒頭3行のflag、ユニットタイプ、アイテムを設定すること
#region(単体稼働・要フラグ手動設定)
 set flag 0000
 set UType @flare
 set Item @graphite
 jump 8 notEqual @unit null
 ubind UType
 sensor f @unit @flag
 jump 8 equal f flag
 jump 4 notEqual f 0
 ucontrol flag flag dy 0 0 0
 sensor hold @unit @totalItems
 sensor capa @unit @itemCapacity
 jump 17 equal hold 0
 sensor dx container1 @x
 sensor dy container1 @y
 ucontrol move dx dy 0 0 0
 ucontrol itemDrop container1 999 capa 0 0
 end
 ulocate building core false @copper cx cy c core
 ucontrol move cx cy 0 0 0
 ucontrol itemTake core Item capa 0 0
 end
#endregion
#region(複数バインド・フラグ自動設定)
 set item @graphite
 set UType @poly
 set UNum 2
 getlink from 0
 jump 0 equal from null
 sensor thisX @this @x
 op floor thisX thisX 0
 sensor thisY @this @y
 op floor thisY thisY 0
 op mul thisX2 thisX 1e4
 op add flagBase thisX2 thisY
 op rand r 999 0
 op floor r r 0
 op mul r r 1e8
 op add flag r flagBase
 set cnt -1
 op add cnt cnt 1
 jump 26 greaterThanEq cnt UNum
 ubind UType
 sensor f @unit @flag
 op mod fBase f 1e8
 jump 24 equal f null
 jump 18 notEqual fBase flagBase
 jump 33 equal f flag
 ucontrol flag flag 0 0 0 0
 jump 16 always 0 0
 ubind UType
 sensor f @unit @flag
 op mod fBase f 1e8
 jump 26 notEqual fBase flagBase
 jump 33 equal f flag
 ucontrol flag 0 0 0 0 0
 jump 26 always 0 0
 ubind UType
 sensor f @unit @flag
 jump 33 notEqual f flag
 sensor hold @unit item
 jump 42 notEqual hold 0
 ulocate building core false 0 coreX coreY found core
 ucontrol move coreX coreY 0 0 0
 ucontrol itemTake core item 999 0 0
 jump 33 always 0 0
 sensor x from @x
 sensor y from @y
 ucontrol move x y 0 0 0
 ucontrol itemDrop from 999 999 0 0
 jump 33 always 0 0
#endregion

***トリウムリアクターの冷却水/温度表示
 draw clear 0 0 0 0 0 0
 sensor cf reactor1 @cryofluid
 op mul res cf 2.66
 draw color 0 255 255 255 0 0
 draw rect 0 0 40 res 0 0
 sensor he reactor1 @heat
 op mul heat 80 he
 draw color 255 00 00 255 0 0
 draw rect 40 0 80 heat 0 0
 drawflush display1
メモ:
draw rectのx.yは0~80/179、sensorの結果をそのまま投げるとまずいので補正してやる~
heatの実数値は百分率
*コピペ用
***スイッチのON/OFFで工場の稼働停止
 set seisan @dagger
 sensor flg switch1 @enabled
 jump 11 equal flg 1
 print "工場停止"
 printflush message1
 control enabled factory1 0 0 0 0
 control enabled factory2 0 0 0 0
 control enabled factory3 0 0 0 0
 control enabled factory4 0 0 0 0
 end
 print "工場稼働"
 printflush message1
 control enabled factory1 seisan 0 0 0
 control enabled factory2 seisan 0 0 0
 control enabled factory3 seisan 0 0 0
 control enabled factory4 seisan 0 0 0
 end
上記のスイッチ状態をfoundation1の在庫で決める
 set value 1000
 sensor silicon foundation1 @silicon
 jump 6 lessThan silicon value
 sensor graphite foundation1 @graphite
 jump 6 lessThan graphite value
 end
 control enabled switch1 0 0 0 0
***液体タンク残量グラフ
#region(液体タンク残量グラフ)
 drawflush display2
 set tank tank2
 jump 5 notEqual loaded 1
 drawflush display1
 printflush message4
 jump 6 notEqual loaded 1
 set loaded 1
 draw clear 35 35 35 0 0 0
 draw color 70 70 70 255 0 0
 draw lineRect 2 2 76 76 0 0
 set tmp 0
 sensor tmp tank @water
 set type @water
 jump 21 greaterThan tmp 1
 jump 22 greaterThan tmp 1
 sensor tmp tank @slag
 set type @slag
 jump 21 greaterThan tmp 1
 jump 22 greaterThan tmp 1
 sensor tmp tank @oil
 set type @oil
 jump 21 greaterThan tmp 1
 jump 22 greaterThan tmp 1
 sensor tmp tank @cryofluid
 set type @cryofluid
 jump 21 greaterThan tmp 1
 jump 22 greaterThan tmp 1
 set type "none"
 print type
 printflush message2
 draw color 255 255 255 255 0 0
 draw rect 0 0 24 24 0 0
 draw image 12 12 type 24 0 0
 sensor now tank type
 sensor capa tank @liquidCapacity
 op floor now now 74
 op div par now 1500
 op mul par par 100
 op floor par par 100
 print "\nNow : "
 print now
 print "\nPar : "
 print par
 print "%\nPrev. : ("
 print par_tmp
 print "%)"
 op mul height now 74
 op div height height capa
 op add x1 i 1
 op add x2 x1 1
 draw line x1 h_tmp x2 height 0 0
 set h_tmp height
 jump 37 lessThan i 80
 jump 49 lessThan i 80
 set i 0
 set par_tmp par
 draw clear 35 35 35 0 0 0
 op add i i 1
#endregion
***PowerDisplayロジックコード解析
#region(PowerDisplay)
 sensor p node1 @powerNetIn
 sensor c node1 @powerNetOut
 sensor s node1 @powerNetStored
 sensor cap node1 @powerNetCapacity
 drawflush display1
 jump 11 greaterThan i 0		//枠作成後まで飛ぶ
 jump 9 greaterThan k 0		//枠作る
 set k 8			//k=8、8回ループしたら初期化(グラフ棒がなくなるだけ)
 draw clear 35 35 35 0 0 0
 draw color 70 70 70 255 0 0
 draw lineRect 2 2 76 76 0 0	//ここまで枠
 op max max p c		//ここからLine28まで
 op mul barP p 64	//左の縦バー更新部分
 op div barP barP max
 op mul barC c 64
 op div barC barC max
 op mul barS s 74
 op div barS barS cap
 draw color 35 35 35 255 0 0
 draw rect 4 13 5 64 0 0
 draw rect 15 13 5 64 0 0
 draw rect 25 3 5 74 0 0
 draw color 40 240 40 255 0 0
 draw rect 4 13 5 barP 0 0
 draw color 240 40 40 255 0 0
 draw rect 15 13 5 barC 0 0
 draw color 230 230 30 255 0 0
 draw rect 25 3 5 barS 0 0	//左の縦バー更新部分
 op add x1 i 35			//更新位置(i)に35px足す(グラフ分)
 op add x2 x1 1			//更新位置(x1)に1px分足す(x2)
 op mod color k 2		//color=背景色フラグ、奇数か偶数で背景色いじってる
 draw color 42 42 42 255 0 0	//薄灰に変更
 jump 34 greaterThan color 0	//↑のフラグチェック
 draw color 35 35 35 255 0 0	//フラグによっては濃灰に戻す
 draw rect x1 3 1 74 0 0		//横1px分書き換え(灰)←グラフ部分じゃなくて1px分の背景
 set tmp s			//tmp=蓄電量
 set tmpLast sLast		/
 set l cap
 draw color 240 240 20 255 0 0	//黄色変更
 op add back @counter 1		//戻り位置
 jump 53 always x false		//関数へ飛ぶ
 set sLast dot
 set tmp p
 set tmpLast pLast
 set l max
 draw color 40 250 40 255 0 0
 op add back @counter 1
 jump 53 always x false
 set pLast dot
 set tmp c
 set tmpLast cLast
 draw color 250 30 30 255 0 0
 op add back @counter 6		//↓の関数飛ばす
 op mul dot tmp 73		//<-----------関数
 op div dot dot l		//
 op add dot dot 4		//
 jump 58 equal i 0
 draw line x1 tmpLast x2 dot 0 0
 set @counter back
 set cLast dot
 op add i i 1
 jump 63 greaterThan i 41	//40?回描写更新したらリセット(iは横幅準拠)
 end
 set i 0
 op sub k k 1		//ループ回数フラグの減少
#endregion
*組み込み変数
#include(Steam/Mindustry/ロジック/組み込み変数,notitle)