Skip to content

Fix prototypes losing inherited data when a partial changes their parent - #7084

Open
Mackamuir wants to merge 2 commits into
space-wizards:masterfrom
Mackamuir:fix-reparent-stale-inheritance-edges
Open

Mackamuir wants to merge 2 commits into
space-wizards:masterfrom
Mackamuir:fix-reparent-stale-inheritance-edges

Conversation

@Mackamuir

Copy link
Copy Markdown

This has been beating my ass for the last 2 weeks.

Issue

If a partial changes a protos parent:, it loses everything it should have inherited from further up the chain. It only keeps
what its new parent declares directly.

Example

# base.yml
- type: entity
  id: BaseItem
  abstract: true
  components:
  - type: Sprite
    sprite: Objects/Tools/tools.rsi

- type: entity
  parent: BaseItem
  id: BaseTool
  abstract: true
  components:
  - type: Item

- type: entity
  parent: BaseItem
  id: Wrench
  components:
  - type: Sprite
    layers:
    - state: wrench

# partial.yml
- type: !PartialOnly entity
  id: Wrench
  parent: !Clear BaseTool

What should happen:
Wrench gets Item from Basetool, and keeps the sprite path from BaseItem.

What currently happens:
Wrench gets Item but Sprite only gets layers and no sprite path, since BaseItem get's skipped, leading to the error:
Layer has no RSI to load states from. Cannot use 'state' property.

tldr: MultiRootInheritanceGraph.Add set the protos new parent list, but never told the old parents their child was gone, causing a stale edge that resolves the child too early, against a parent that hasn't been built yet.

Fix

Add now detaches the node from its old parents before wiring up the new ones, and assigns _parents[id] once rather than inside the loop.

@Mackamuir Mackamuir closed this Sep 18, 2026
@Mackamuir Mackamuir reopened this Sep 18, 2026
@Mackamuir
Mackamuir marked this pull request as draft September 18, 2026 04:59
@Mackamuir
Mackamuir marked this pull request as ready for review September 18, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant