Repository navigation
fix: smiths hold the hammer, the blade glows after the forge, drummers hold both sticks - model script items in the hand and the inventory - #577
Open
BoroBongo wants to merge 8 commits into
Conversation
…EF_CREATE_ITEM puts its item into the hand T_BSANVIL_S0_2_S1 (HUMANS.MDS) inserts the hot blade (ItemInsert, the mob's item) into the left hand and creates the hammer ITMW_1H_MACE_L_04 in the right one (ItemCreate). ItemCreate fell through to "not yet supported", so Harad (G2) and the G1 smiths forged without a hammer. The created item's mesh goes into its slot and leaves together with the used item (T_BSANVIL_S1_2_S0's ItemDestroy, or the item put away when the NPC is interrupted). The inventory doesn't change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e put-away - only the item meshes we created go NpcProperties remembered the used and the created item by slot name, and putting them away destroyed every child of that slot. T_PAUKE_STAND_2_S0 creates a drumstick in each hand, so the second ItemCreate deleted the first one, and a weapon drawn into ZS_RIGHTHAND would have gone together with the hammer. The NPC now keeps the item GameObjects themselves (UsedItemGo, CreatedItemGos) and destroys exactly those. A slot holds one item like the engine's slots: a new ItemCreate replaces only the used/created mesh in the same slot. InsertItem still replaces the used item, ItemDestroy/ItemRemove and RemoveUsedItemFromHand still remove the used and the created items. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… with a warning instead of an error CreateItem looked the DEF_CREATE_ITEM item up as a raw VM symbol, so a symbol that isn't an item instance reached TryGetItemData and the mesh builder with null (NullReferenceException), and an item whose mesh wasn't built was remembered anyway. It now goes through VobService.CreateItemMesh(string), which resolves the item via VmCacheService, warns for a non-item and returns the built GameObject (both overloads guard a null item). Only a built mesh is remembered. The slot lookup is one FindSlot helper; InsertItem warns about a missing slot instead of putting the mesh at the scene root. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fried meat - the model script's DEF_EXCHANGE_ITEM swaps the item in the hand ItemExchange fell through to "not yet supported": T_BSFIRE_S0_2_S1 (ZS_LEFTHAND ITMISWORDRAWHOT) left the cold blade in the smith's hand, T_PAN_S1_2_S0 and T_STOVE_S0_2_STAND (ZS_LEFTHAND ITFOMUTTON) never showed the fried meat. Like OpenGothic's tickTimedEvt, the item meshes in that slot go; if the slot is empty (its cooking fallback) the used item goes instead. Then the new item's mesh goes into the slot and is remembered as created, so ItemDestroy or putting the item away removes it. CreateItem and ExchangeItem share PutItemIntoSlot. The inventory doesn't change (OpenGothic adds the item to it). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…warning Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…y too, like the engine - Harad's hot blade can be bought or stolen Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s and inventory Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ted state - logged as info, not warning Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
Author
Review (architecture-reviewer + gothic-reviewer), three roundsRound 1 (17d8e26). Both reviewers: OK / fits, with concerns. Fixed:
Round 2 (6afffb0). Both reviewers: OK to merge. Fixed:
Round 3 (abee13f). Both reviewers: fits. The author decided to put the items into the inventory like the engine. Fixed:
Follow-up: #568 ( Editor check (G2 Khorinis):
|
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.
What
The animation item events
DEF_CREATE_ITEM(ItemCreate) andDEF_EXCHANGE_ITEM(ItemExchange) now put their item into the hand.T_BSANVIL_S0_2_S1gives the smith his hammer.T_BSFIRE_S0_2_S1swaps the blade for the glowingITMISWORDRAWHOT.T_PAUKEgives a drumstick to each hand.While held, the items are also in the NPC's inventory, like in the engine (OpenGothic: ITEM_CREATE/EXCHANGE add, ITEM_DESTROY removes, ITEM_REMOVE keeps). They can be bought or pickpocketed. The original's "infinite steel" trick at Harad is kept on purpose: an item sold or stolen from the hand is not taken from the NPC a second time. The items leave the hand (and the inventory) at the animation's
ItemDestroy, or when the NPC is interrupted or culled.The NPC now owns the item objects themselves (
UsedItemGo,CreatedItemGos) instead of slot names, so a drawn weapon in the same hand is never deleted. Item lookup goes throughVobService.CreateItemMesh(name)(warns on non-items), and slots are found through oneFindSlot.Why
In a playtest, Harad forged without a hammer: ItemCreate was "not yet supported".
How to test manually
Save/load
Nothing extra is saved. An item saved while held stays in the NPC's inventory (like the original); after a load the hand is empty and the next animation brings a new one.
Known gaps / follow-ups
Docs/adr/2026-11-25-model-script-items-in-inventory.md(author's decision: like the engine, the exploit is kept).NpcHeldItemDomain/NpcHeldItems.🤖 Generated with Claude Code