Skip to content

CustomInteractions: update for SPT 4.1.2 - #1

Open
svanovsky wants to merge 1 commit into
IgorEisberg:mainfrom
svanovsky:spt-4.1.2
Open

CustomInteractions: update for SPT 4.1.2#1
svanovsky wants to merge 1 commit into
IgorEisberg:mainfrom
svanovsky:spt-4.1.2

Conversation

@svanovsky

Copy link
Copy Markdown

Updates CustomInteractions for SPT 4.1.2 (EFT 0.16.9.5.40743). Nothing else in the repo is touched.

Disclosure: this was written largely with AI assistance (Claude). I've tested it in-game rather than
just compiling it — details below — but I'm not going to claim I derived every line myself.

What changed

SPT 4.1 deobfuscated the client assembly, so the obfuscated names the mod reached for no longer exist.

  • ContextInteractionsClass<EItemInfoButton>ContextInteractions<EItemInfoButton>, implementing
    the three abstract members the base class now requires.
  • Replaced the reflection lookup of the dynamic-interactions dictionary with direct field access.
    This one is worth a look: in 4.1 the underscore-prefixed backing fields are public, so
    GetField(name, NonPublic | Instance) returns null rather than throwing. The mod loaded fine and
    then silently did nothing.
  • Retargeted the patches at ItemUiContext.GetItemContextInteractions and
    InteractionButtonsContainer.CreateDynamicContextButton.

Testing

Tested in-game on SPT 4.1.2 / EFT 0.16.9.5.40743. Custom interactions appear on the item context menu
and invoke correctly. Also exercised indirectly via Transmog, which depends on this mod.

Not included

The .csproj is unchanged. I did convert it locally to SDK-style with absolute reference paths,
because my machine has no .NET Framework 4.7.2 dev pack — but that's my environment, not a 4.1
requirement, and it doesn't belong in a compatibility PR. Happy to send it separately if it'd be
useful to you.

SPT 4.1 deobfuscated the client assembly, so the obfuscated names this mod
reached for no longer exist.

- ContextInteractionsClass<EItemInfoButton> -> ContextInteractions<EItemInfoButton>,
  implementing the three abstract members the base class now requires.
- Replace the reflection lookup of the dynamic-interactions dictionary with
  direct field access. In 4.1 the underscore-prefixed backing fields are public,
  so GetField(name, NonPublic | Instance) silently returns null rather than
  throwing - the mod appeared to load and then did nothing.
- Retarget the patches at ItemUiContext.GetItemContextInteractions and
  InteractionButtonsContainer.CreateDynamicContextButton.

Tested in-game on SPT 4.1.2 / EFT 0.16.9.5.40743: custom interactions appear on
the item context menu and invoke correctly.

Build files are intentionally not included - the csproj here still points at the
upstream relative paths.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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