Added ability to remove an Attribute Set from an entity. - #62
Open
lextatic wants to merge 12 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds runtime removal and re-addition of entity attribute sets while preserving active-effect behavior and listener subscriptions.
Changes:
- Adds attribute-set removal, lookup, and membership events.
- Rebuilds effects and rebinds attribute listeners/components after membership changes.
- Adds tests and documentation for the new lifecycle.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
Forge/Core/EntityAttributes.cs |
Implements set membership management. |
Forge/Effects/ActiveEffect.cs |
Rebuilds active effects. |
Forge/Effects/EffectEvaluatedData.cs |
Refreshes captured attributes. |
Forge/Effects/EffectsManager.cs |
Coordinates effect rebuilding. |
Forge/Effects/Components/IEffectComponent.cs |
Adds membership-change callback. |
Forge/Effects/Components/AttributeRequirementsEffectComponent.cs |
Rebinds target requirements. |
Forge/Effects/Components/SourceAttributeRequirementsEffectComponent.cs |
Rebinds source requirements. |
Forge/Effects/Components/AttributeAccumulatorEffectComponent.cs |
Rebinds accumulator tracking. |
Forge/Statescript/Nodes/State/AttributeListenerNode.cs |
Follows replaced attributes. |
Forge/Statescript/Nodes/State/AttributeListenerNodeContext.cs |
Stores membership subscriptions. |
Forge.Tests/Attributes/AttributeSetRemovalTests.cs |
Tests removal behavior. |
Forge.Tests/Statescript/Nodes/State/ListenerNodesTests.cs |
Tests listener rebinding. |
Forge.Tests/Effects/CustomCalculatorsEffectsTests.cs |
Updates construction API usage. |
Forge.Tests/Helpers/TestEntity.cs |
Supplies the attribute owner. |
Forge.Tests/Helpers/VitalTestEntity.cs |
Supplies the attribute owner. |
Forge.Tests/Samples/QuickStartTests.cs |
Updates sample construction. |
docs/attributes.md |
Documents runtime membership changes. |
docs/effects/modifiers.md |
Documents missing-attribute modifiers. |
docs/effects/components/attribute-requirements-effect-component.md |
Documents requirement rebinding. |
docs/statescript/nodes/state/attribute-listener-node.md |
Documents listener rebinding. |
docs/quick-start.md |
Updates initialization example. |
Suppressed comments (1)
Forge/Core/EntityAttributes.cs:151
- This flush runs while active effects and requirement components are still subscribed to the departing attributes. A notification can therefore call
ReapplyEffector remove an effect in the middle ofRebuildAroundAttributeChange; the later rebuild then applies that effect again without undoing the callback's application, leaving duplicate or orphaned modifiers. Suspend the framework's capture/requirement subscriptions before unwinding and flushing, while preserving external listeners for this final notification, then rebind after detachment.
foreach (EntityAttribute attribute in attributeSet.AttributesMap.Values)
{
attribute.ApplyPendingValueChanges();
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Added