Skip to content

fix: initialize dependent state if necessary#147

Merged
wlsnmrk merged 1 commit intochickensoft-games:mainfrom
wlsnmrk:fix/uninitialized-dependent-state-error
Feb 17, 2026
Merged

fix: initialize dependent state if necessary#147
wlsnmrk merged 1 commit intochickensoft-games:mainfrom
wlsnmrk:fix/uninitialized-dependent-state-error

Conversation

@wlsnmrk
Copy link
Contributor

@wlsnmrk wlsnmrk commented Feb 17, 2026

Fixes #146.

Updated DependencyResolver to use IDependent's DependentState property instead of attempting to access the dependent-state data directly from the MixinState. The DependentState property initializes the blackboard value if it doesn't already exist, preventing exceptions when the dependent state hasn't yet been added to the blackboard before resolution (e.g., in tool-script scenarios).

This change resolves #146, so the cold-reload on building the C# project doesn't output errors, even with the dependent tool scene open.

Notes on modified methods:

  • Resolve() is only called from Handler().
  • Handler() is called via IIntrospectiveRef.InvokeMixins() in NotifyExtensions.Notify(), which shouldn't throw exceptions anyway.
  • DependencyResolver.DependOn() is invoked from DependentExtensions.DependOn(), and preventing the exception in that scenario is the objective of this change.

Updated DependencyResolver to use IDependent's DependentState property
instead of attempting to access the dependent-state data directly from
the MixinState. The DependentState property initializes the blackboard
value if it doesn't already exist, preventing exceptions when the
dependent state hasn't yet been added to the blackboard before
resolution (e.g., in tool-script scenarios).
@wlsnmrk wlsnmrk added the bug Something isn't working label Feb 17, 2026
@wlsnmrk wlsnmrk merged commit 8fbf283 into chickensoft-games:main Feb 17, 2026
2 checks passed
@wlsnmrk wlsnmrk deleted the fix/uninitialized-dependent-state-error branch February 17, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: "Data of type DependentState not found in the blackboard" error on tool reload

1 participant

Comments