forked from gigabit101/StevesFactoryManager
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
src/main/resources/assets/sfm/template_programs/where_statement.sfml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
NAME "WHERE Statements" | ||
|
||
-- WHERE statements allow you to filter blocks in | ||
-- a label by the contents of the block | ||
-- They support most of the same functionality as | ||
-- IF statements though they can't compare 2 | ||
-- inventories (or slots) against each other | ||
|
||
EVERY 20 TICKS DO | ||
INPUT FROM source WHERE > 5 dirt AND < 5 stone | ||
OUTPUT TO EACH dest WHERE (= 0 dirt) | ||
END | ||
|
||
-- An issue with resource types | ||
EVERY 20 TICKS DO | ||
-- If you are moving resource type X | ||
-- but WHERE is checking resource type Y | ||
-- you need to specify that you want to move | ||
-- 0 of resource type Y on the input or output | ||
-- statement with the WHERE condition | ||
-- This is only necessary if you are not planning | ||
-- on moving resource type Y in this statement | ||
|
||
INPUT fluid:: FROM source | ||
-- The following statement will not work | ||
OUTPUT fluid:: TO dest WHERE > 0 dirt | ||
|
||
-- To fix this, do | ||
OUTPUT 0 item::, fluid:: TO dest WHERE > 0 dirt | ||
END | ||
|
||
-- Slots | ||
EVERY 20 TICKS DO | ||
-- WHERE statements will use the same slots as | ||
-- the SLOTS statement. This can be useful for | ||
-- machines with distinct groups of slots, such as | ||
-- extended inscribers | ||
INPUT FROM source | ||
OUTPUT gold_ingot, silicon | ||
TO EACH exinscriber SLOTS 0-3 WHERE > 0 universal_press | ||
OUTPUT gold_ingot, silicon | ||
TO EACH exinscriber SLOTS 4-7 WHERE > 0 universal_press | ||
END |