(Feat) Tools Creation

This commit is contained in:
2026-06-22 23:32:46 +02:00
parent 2234ed14ce
commit 6527f559e1
36 changed files with 2917 additions and 369 deletions
@@ -0,0 +1,4 @@
# Memory Index
- [Ashwild Database tool](ashwild-database-tool.md) — Tools ▸ Ashwild ▸ Database: UI Toolkit window to manage items/recipes & generate prefabs.
- [Pickable vestigial NetworkObject](pickable-vestigial-networkobject.md) — old Pickable prefabs carry an unused FishNet NetworkObject; generated ones omit it.
@@ -0,0 +1,24 @@
---
name: ashwild-database-tool
description: Custom UI Toolkit editor window (Tools ▸ Ashwild ▸ Database) to browse/create ItemData & CraftingRecipe and generate prefabs.
metadata:
type: project
---
A custom editor window lives at `Assets/GAME/Script/Editor/Database/` (namespace
`Ashwild.EditorTools`), opened via **Tools ▸ Ashwild ▸ Database**. Built with UI Toolkit
(first UI Toolkit usage in the project) + a `.uss` stylesheet (`AshwildDatabase.uss`).
Pieces:
- `AshwildDatabaseWindow.cs` — shell: Items/Recipes tabs, search, list, action bar.
- `ItemEditorView.cs` — custom context-aware ItemData form (cards reveal by type).
- `RecipeEditorView.cs` — visual ingredient list builder ("A + B = Result" equation strip).
- `ItemAssetFactory.cs` / `RecipeAssetFactory.cs` — asset + prefab creation.
- `AshwildUI.cs` — shared styled builders (cards, type badges, type colours).
**Prefab generation** wraps a chosen source GameObject (model/prefab) as a child of a
generated root: world prefab = Pickable layer + auto-fit BoxCollider + `Pickable` (no
NetworkObject, see [[pickable-vestigial-networkobject]]); hand prefab = Tools layer +
`ToolBehaviour` (mask = Harvestable) + `HeldItemOffset`. Item creation rebuilds the
ItemDatabase automatically. Asset folders: items → `ScriptableObjects/Items/`, recipes →
`ScriptableObjects/Recipes/`, world prefabs → `Prefabs/Pickable/`, hand prefabs → `Prefabs/Tools/`.
@@ -0,0 +1,24 @@
---
name: pickable-vestigial-networkobject
description: Existing Pickable prefabs carry an unused FishNet NetworkObject; the canonical generated prefab omits it.
metadata:
type: project
---
The hand-authored Pickable prefabs (e.g. `Prefabs/Food/Pickable/Raw Steak.prefab`,
`Prefabs/Pickable/Tools/axe01.prefab`) still carry a FishNet `NetworkObject` component, left
over from a pre-refactor design.
**Why it's dead:** `Pickable` now derives from `WorldObject` (not `NetworkBehaviour`), and
`PickableRegistry.SpawnDropVisual` creates drops with a plain `Instantiate(item.WorldPrefab,…)`
— a local visual, never a network spawn. The registry syncs only ids/drop records. So the
`NetworkObject` on those prefabs does nothing. This matches CLAUDE.md §3 ("World objects
(pickables, harvestables) are not NetworkObjects").
**How to apply:** When generating or authoring world pickup prefabs, do NOT add a
`NetworkObject`. Required pieces are: the Pickable layer (11), a non-trigger collider on the
SAME GameObject as the `Pickable` (the interactor reads `IInteractable` via
`hit.collider.TryGetComponent`), the `Pickable` script wired to its `ItemData`, and id = -1
(scene instances get a baked id via Tools ▸ Ashwild ▸ Assign World Object IDs). The Ashwild
Database tool ([[ashwild-database-tool]]) generates them this clean way. The vestigial
NetworkObjects on old prefabs could be stripped in a cleanup pass.