Skip to content

Add interactable manager and patches#7

Closed
Segually wants to merge 49 commits into
eris-webserv:mainfrom
Segually:interactables
Closed

Add interactable manager and patches#7
Segually wants to merge 49 commits into
eris-webserv:mainfrom
Segually:interactables

Conversation

@Segually

@Segually Segually commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Introduce a runtime InteractableManager system to let mods register placed objects as chairs, beds, crafting stations, storage containers, or custom interactables. Adds Items.Interactables.cs implementing InteractableRegistration, InteractContext, InteractableManager, and Harmony patches: a player_interact prefix to dispatch registered behaviours and a shared postfix on InventoryUtils.IsXObject predicates to classify registered ids. Base.GamePlugin.cs was updated to initialize the manager during startup.

Adds a first-class Container interactable type via RegisterContainer(itemName, displayName, pages), making a modded object open like a vanilla chest on interact. This drives the full world-container flow (online server request and offline load) by recording the interacted object with GameController.NoteInteractingElement and calling inventory_ctr.TryOpenWorldContainer. Two pieces of that flow are hardcoded against the game's own chest ids, so three additional Harmony patches override them for registered containers only:

  • ContainerTabTitlePatch (prefix on OpenInventoryAndContainer) — shows the registered DisplayName (falling back to the item's display name, then its id) instead of the raw mod id.
  • ContainerPageCountPatch (prefix on LayOutInvSlots) — overrides n_pages with the registered page count (clamped to the engine's 1–3 range), gated to the container tab via the same WindowControl check the game's own page switching uses.
  • ContainerPermittedSlotsPatch (postfix on GetPermittedContainerSlots) — returns the correct per-page slot indices so drag/drop works across all pages, reading n_slots_per_page_/p2_begin_ at runtime rather than hardcoding offsets.

eris-webserv and others added 18 commits March 11, 2026 01:59
Initialize and wire up two new item systems. Base.GamePlugin now initializes WorldPrefabManager and CraftingInjectionManager (with startup timing logs). Added CraftingInjectionManager which lets mods inject items into vanilla crafting lists via a Harmony postfix on inventory_ctr.GetCraftList; insertions are idempotent and support inserting after a specific item. Added WorldPrefabManager which allows registering AssetBundle prefabs for world-placeable items (keyed by item id or World_obj_path) and patches both overloads of ResourceControl.AsyncInstantiateWorldObjectPrefab to supply mod prefabs, instantiating cached assets safely. Includes simple reset/initialize helpers and Harmony patches to integrate with the game.
Add world prefab and crafting injection managers
Introduce a runtime InteractableManager system to let mods register placed objects as chairs, beds, crafting stations, or custom interactables. Adds Items.Interactables.cs implementing InteractableRegistration, InteractContext, InteractableManager, and Harmony patches: a player_interact prefix to dispatch registered behaviours and a shared postfix on InventoryUtils.IsXObject predicates to classify registered ids. Base.GamePlugin.cs was updated to initialize the manager during startup. Note: the Base.GamePlugin.cs edit currently contains unresolved merge conflict markers (<<<<<<< / >>>>>>>) that need to be fixed.
Added support for interactable containers, including display name and page count.
@Segually

Copy link
Copy Markdown
Contributor Author

i have also added the new containers to this.

fix chests (so sorry)
@Segually Segually closed this by deleting the head repository Jul 11, 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.

2 participants