[Bugfix] Animation system bypasses spatial hash updates for entity position #256
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
john/McRogueFace#256
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
When entity position is changed via the animation system (e.g.
entity.animate("draw_x", ...)), the spatial hash is not updated. This causesgrid.entities_in_radius()to return stale results based on where entities were last positioned via Python property assignment, not their current animated position.Root Cause
UIEntity::setProperty()(used by the animation system) writes directly toposition.x/position.yand callsgrid->markCompositeDirty()for rendering, but does not callgrid->spatial_hash.update().In contrast, all Python property setters (
set_position,set_float_member,set_grid_int_member) correctly save the old position and callspatial_hash.update()after modifying position.Affected Code
src/UIEntity.cpplines 1126-1137 —setPropertyfordraw_x/draw_y/x/ysrc/Animation.cppline 472 —applyValuecallsentity->setProperty()Fix
Add spatial hash update logic to
UIEntity::setPropertyfor position properties:Note:
setPropertyoperates on a rawUIEntity*, not ashared_ptr, so obtaining the shared_ptr for the spatial hash update will need some care (e.g. storing aweak_ptrto self, or having the grid look up the entity).Workaround
After an animation completes (or periodically), re-set the entity position via Python properties to force a spatial hash update:
Priority
Low — discovered during 7DRL 2026. Workaround available.