Fixed containment fields dying even when one side still had power #41006
+49
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
About the PR
Currently, a containment field will die if either side loses power. This PR changes this behavior to keep a containment field alive as long as at least one side has enough power.
Why / Balance
This is unexpected behavior, because if you only power one side, the field will be created and be perfectly happy. You can safely create a tesla or singularity containment field with only two emitters, one for each corner. As long as those corners stay powered the containment field will last the whole shift.
However, if you try to power all four of the corners and then remove the emitter for just one of the corners, the field for that corner will die. Indeed, you can actually loose by adding an emitter to an unpowered corner, and then removing that added emitter. Two powered corners is safe. Going from three to two will loose.
This behavior has caused an unintentional loose at least in round 94809 (Lizard), which is what caused me to look into this. It's not unlikely that at least a few other looses occurred due to this behavior, since an engi might reasonably assume that some emitters are safe to turn off due to the two-emitter setups that exist.
Technical details
RemoveConnections now accepts an optional predicate that determines if a connection should be removed or not.
LosePower now passes in a predicate to RemoveConnections in order to only remove connections if both sides don't have power.
Media
Old behavior:
ContainmentFieldBroken.mp4
New behavior:
ContainmentFieldFixed.mp4
Requirements
Breaking changes
Changelog
🆑