Add interactable manager and patches#7
Closed
Segually wants to merge 49 commits into
Closed
Conversation
Autobuildtest, neat.
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.
Contributor
Author
|
i have also added the new containers to this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Containerinteractable type viaRegisterContainer(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 withGameController.NoteInteractingElementand callinginventory_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 onOpenInventoryAndContainer) — shows the registeredDisplayName(falling back to the item's display name, then its id) instead of the raw mod id.ContainerPageCountPatch(prefix onLayOutInvSlots) — overridesn_pageswith the registered page count (clamped to the engine's 1–3 range), gated to the container tab via the sameWindowControlcheck the game's own page switching uses.ContainerPermittedSlotsPatch(postfix onGetPermittedContainerSlots) — returns the correct per-page slot indices so drag/drop works across all pages, readingn_slots_per_page_/p2_begin_at runtime rather than hardcoding offsets.