Searchlights: don't drop items used for settings #63429
Merged
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.
Summary
None
Purpose of change
Fixes #63333
Describe the solution
Searchlights store their settings on a processor board item, so their "beams" can have persistent behavior between turns. They do this using item vars, but these item vars linger after their death, causing the items not to stack.
Simple solution: Just don't drop these settings items. Also, erase these item vars on any existing items, so that they can now stack.
Describe alternatives you've considered
Removing these vars on death would be an alternate option, but placing it with where the item vars are set shows future contributors who might use this code as inspiration that this is a problem. It also avoids being a problem when (if) the searchlights are made to drop a disassembleable robot corpse in the future like other robots do.
Testing
No settings item fix:
Stacking fix:
Additional Context
This does mean that searchlights are no longer guaranteed to drop multiple processor items. I think that this is acceptable.