Repository navigation
Pick an offspring's square first and reuse the attack's square on death - #163
Merged
Merged
Conversation
reproduce created the offspring before placing it, so a world without a grid left an unplaced actor in persistent data, with an entity record and an entry in both parents' children and relations, on every attempt. The square is now picked first, and no offspring is created when there is none. checkForDeath looked the victim's square up again, which is null if a console delete or wipe unplaces the victim during the attack, and the resulting NullPointerException would end the time thread. It now uses the square attack already resolved. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
|
Self-review rubric (an inline self-review, not an independent review):
Observations:
This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Actor#reproducenow picks the offspring's square before the offspring is created. When the world has no grid, an error is logged and nothing is created, so no unplaced actor, entity record, child UUID or parent relation is left behind. Placement goes through a newPersistentData#placeIntoEnvironment(World, Square, Actor)overload, which the existing two-argument version now delegates to.Actor#checkForDeathnow receives the squareattackalready resolved, instead of looking upvictim.getSquare()again, which is null if the victim is unplaced during the attack and would have thrown out ofLocalTimeService#run.Test plan
mvn -B test: 202 tests run, 0 failuresActorTest.testReproduceLeavesNoOffspringWhenItsWorldHasNoGridfails with the fix stashed (expected:<2> but was:<101>) and passes with it restoredActorTest.testDeathLeavesFoodOnTheSquareOfTheAttackWhenTheVictimWasUnplacedMeanwhilefails with the fix stashed (NullPointerExceptionincreateFoodItemAt) and passes with it restoredDeferred issues
Interakt#main); left for its own cycle so this PR stays on one class.Closes #162
This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson