ロジックメモ

ロジックサンプル

MindustryWikiのサンプル

スイッチを使用した工場の稼働/停止ロジック

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、ユニットタイプ、アイテムを設定すること

+  単体稼働・要フラグ手動設定
+  複数バインド・フラグ自動設定

トリウムリアクターの冷却水/温度表示

 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の実数値は百分率

発電機用の冷却水切れ防止コード

 getlink reactors bango
 sensor cryofluid reactors @cryofluid
 op greaterThanEq working cryofluid 5
 control enabled reactors working 0 0 0
 op add bango bango 1
 jump 7 lessThanEq bango 5
 set bango 0
 end

コピペ用

スイッチの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

液体タンク残量グラフ

+  液体タンク残量グラフ

PowerDisplayロジックコード解析

+  PowerDisplay

組み込み変数

##include(Steam/Mindustry/ロジック/組み込み変数,notitle)