Skip to content

Add tests for a manager that disables itself by removing its own program disk #597

Description

@TeamDman

https://discord.com/channels/967118679370264627/1539347023311011870/1539347023311011870

Titop54 [CATS],
OP
— 2026-08-18 2:55 PM
As the name says, it stops the every X do after this keyword is executed

Examples of uses: You have setup that expects 20 items in return, but your setup produces less than 20. Then, you send a block to a chest to activate an alarm with redstone.

On the next loop, you can check if there a block inside the chest for it not to run again, similar to if(a == nullptr) continue; or any other example

Another use it's to stop the loop to run after certain time, for example, processors with Mega and AE2, one uses redstone dusts and the other fluix dusts. You can set that if a chest has redstone do the redstone first and stop until next loop.
Once done with redstone, it would do just do normal mega accumulation recipes

Currently, SFM has no "disabled" state aside from removing the disk from the manager or commenting out the code. Currently, there is no meta-programming/self-modifying code, so the best way to do this would be to have SFM remove the disk from the manager. You can have a manager label itself, but I do not recall there being gametests that verify that a manager is indeed able to pull out its own disk.

The manager won't/shouldn't notice the disk has been removed until the next tick; if you have two every 20 ticks do triggers in your program and the first one removes the disk, the second one will also execute is my understanding. If you want to disable a second trigger from an earlier trigger, that should be reshapeable into code that uses an if-statement to do something similar.

SFM does not yet have a "continue" function to end the execution of the current trigger, which as I read the OP again that seems more in line with what is being asked for.

Short-circuit-style statements like

if (something) then break end
-- do logic here

are currently not possible, you must currently instead just guard the logic with the if statement like

if not something then
-- do logic here
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs testAdd a test to ensure correctness

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions