Resource: notify subscribers when a resource is placed or moved - #1230
Merged
Conversation
`location` was a plain attribute, so a resource could be assigned to a deck, moved to another carrier, or handed between machines without anything reaching the state channel. Position is set by assignment, including inside `assign_child_resource`, so there is no method to hang the notification on and it is caught at the attribute. The setter notifies only when the value actually changed and the resource has a parent, so building a resource and holding one outside a tree stay silent. `serialize_state` carries "location" alongside "rotation", and `load_state` reads it back. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
BioCam
force-pushed
the
resource-location-state
branch
from
September 1, 2026 13:54
a38aaa9 to
7e29dc3
Compare
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.
A resource's position changes without anything being told.
locationis a plain attribute, so a resource can be assigned to a deck, moved to another carrier, or handed between machines and nothing reaches the state channel. A subscriber following it has to be notified some other way.There is no method to hang the notification on, the way
rotateexists for rotation - position is set by assignment, including insideassign_child_resource- so it has to be caught at the attribute itself.This PR
locationbecomes a property over_location. The setter records the new position and calls_state_updatedwhen the value actually changed and the resource has a parent, so a resource being built or sitting outside a tree stays silent.serialize_statecarries"location"alongside"rotation", andload_statereads it back.Behaviour: reads and writes of
.locationare unchanged and no caller has to move. Placing a resource or moving a placed one now emits a state update. Unassigning does not, because the parent is cleared first.serialize_all_stategains a"location"key per placed resource, so state written now differs from state written before, though older files still load.rotatestill notifies as it always has and is not touched here. Rebindingrotationoutright, or mutating either value in place, still notifies nothing - that gap is unchanged and common to both.