plasmid icon indicating copy to clipboard operation
plasmid copied to clipboard

Handle composite GameRuleTypes conflicting with composed types

Open Gegy opened this issue 4 years ago • 0 comments

Currently, GameRuleType.allOf generates a rule that enforces all of the given rule types. This works fine until you want to set up a case where you override the general rule type with a more specific one.

For example, with the INTERACTION and USE_BLOCKS rules. INTERACTION implies USE_BLOCKS, but setting USE_BLOCKS should override INTERACTION. Currently, this does not work: all rules that are set to allow return ActionResultType.PASS from their events. This is such that returning ActionResultType.SUCCESS does not end up cancelling vanilla logic, because we want that to run. The problem here, however, is that returning PASS continues processing for other events. This means a set-up with USE_BLOCKS allowed will return PASS, causing the INTERACTION rule to still apply and not be overridden.

The solution for this would ideally involve having a result type that can represent "pass to vanilla logic, but don't continue processing events", but this may be a significant breaking change to Stimuli. Potentially the best we can do is manage colliding rule results internally in the rule handler to avoid issues such as this.

Gegy avatar Nov 17 '21 19:11 Gegy