Skip to content

Add InteractableManager for custom object interactions - #22

Open
Segually wants to merge 1 commit into
eris-webserv:mainfrom
Segually:feature/interactable-manager
Open

Segually wants to merge 1 commit into
eris-webserv:mainfrom
Segually:feature/interactable-manager

Conversation

@Segually

@Segually Segually commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds InteractableManager, which lets mod items act as chairs, beds, crafting stations, containers, or run custom behaviour when interacted with.

The game has no generic interaction system. Behaviour is hardcoded in two layers, both keyed on the object's item_name: the GameController.player_interact dispatch switch, and the InventoryUtils.IsChairObject / IsBedObject / etc. classification predicates. A modded object is inert because neither layer recognises its id. This manager patches both:

  • a prefix on player_interact runs the registered behaviour for known ids and falls through to vanilla otherwise
  • one shared postfix over the InventoryUtils.IsXObject predicates forces true for ids registered under that type (it never flips true to false)
InteractableManager.Instance.RegisterChair("MyMod:MyChair");
InteractableManager.Instance.RegisterBed("MyMod:MyBed");
InteractableManager.Instance.RegisterCraftingStation("MyMod:MyOven", "Crafting - Oven", "Oven");
InteractableManager.Instance.RegisterContainer("MyMod:MyChest", "Chest", pages: 2);
InteractableManager.Instance.RegisterCustom("MyMod:MyThing", ctx => { /* ctx.Controller / Target / Interactable */ });

Containers come with UI support.

Changes

  • New Items/Items.Interactables.cs (InteractableManager, InteractableRegistration, InteractableType, patches).
  • New Items/INTERACTION_SYSTEM.md documenting how the game's interaction dispatch works and how the API hooks into it.
  • Base.GamePlugin.cs: initialize InteractableManager.

Notes

  • Split out of a larger set of changes; the other PRs (assets, creatures, .gitignore) are independent of this one. The only overlap is a small init registration in Base.GamePlugin.cs, which may need a trivial conflict resolution depending on merge order.
  • Builds cleanly on its own against current main.

🤖 Generated with Claude Code

Hooks the game's hardcoded item_name-based interaction dispatch so mod items can act as chairs, beds, crafting stations and containers (with UI). Includes INTERACTION_SYSTEM.md documenting the reverse-engineered mechanism.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Segually
Segually marked this pull request as ready for review October 1, 2026 13:47
@Segually Segually mentioned this pull request Oct 1, 2026
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