t1k:unity:editor:dots-inventory-grid
| Field | Value |
|---|---|
| Module | editor |
| Version | 2.1.7 |
| Effort | high |
| Tools | — |
Keywords: DOTS, grid, inventory, UI
How to invoke
Section titled “How to invoke”/t1k:unity:editor:dots-inventory-gridDOTS Inventory Grid, Passives & Set Bonuses
Section titled “DOTS Inventory Grid, Passives & Set Bonuses”Extensions to com.the1studio.dots-inventory Inventory module. Base module (slots, equipment, loot, currency, crafting) → See dots-rpg skill references/inventory-guide.md.
Related skills:
dots-rpg·dots-ecs·dots-jobs-burst
When This Skill Triggers
Section titled “When This Skill Triggers”- Adding
InventoryGridDimension,InventoryGridCell,ItemGridShape,ItemGridPosition,ItemRotation - Calling
InventoryGridUtility.CanPlace,.PlaceItem,.FindFirstFit,.GetEffectiveDimensions - Using expansion APIs:
CanPlaceExpansion,ActivateCells,IsAdjacentToActive,CountActiveCells - Adding
ItemPassiveEffectbuffer to items; usingPassiveCondition.InInventoryor.EquippedOnly - Adding
ItemSetMembership,SetBonusDefinition; implementing set threshold rewards - Using
ModifierSource.ItemPassiveorModifierSource.ItemSetin stat modifier logic
Component Quick Reference
Section titled “Component Quick Reference”Grid Layer
Section titled “Grid Layer”| Component | Type | Fields | Owner |
|---|---|---|---|
InventoryGridDimension | IComponentData | int GridWidth, GridHeight | Character — opt-in gate |
InventoryGridCell | IBufferElementData | Entity ItemEntity, byte IsActive | Character — W×H flat array |
ItemGridShape | IComponentData | int DefaultWidth, DefaultHeight | Item entity |
ItemGridPosition | IComponentData | int GridX, GridY | Item entity — (-1,-1) = unplaced |
ItemRotation | IComponentData | byte RotationIndex | Item entity — 0..3 |
ItemNoRotationTag | IComponentData (zero-size) | — | Item — prevents rotation |
ItemLockedTag | IComponentData (zero-size) | — | Item — prevents movement |
ItemShapeMask | IBufferElementData | int2 Offset | Item — polyomino shape (opt-in) |
Passive Layer
Section titled “Passive Layer”| Component | Type | Fields | Owner |
|---|---|---|---|
ItemPassiveEffect | IBufferElementData | StatType, ModifierType, float Value, PassiveCondition | Item entity |
PassiveCondition enum: InInventory (always active) · EquippedOnly (only when in EquippedItem buffer)
Set Bonus Layer
Section titled “Set Bonus Layer”| Component | Type | Fields | Owner |
|---|---|---|---|
ItemSetMembership | IComponentData | int SetId | Item entity |
SetBonusDefinition | IBufferElementData | int SetId, int RequiredCount, StatType, ModifierType, float Value | World singleton |
System Ordering (InventorySystemGroup)
Section titled “System Ordering (InventorySystemGroup)”RespawnReset (OrderFirst) → PickupSystem → GridPlacementSystem [UpdateAfter(Pickup), UpdateBefore(Equipment)] → ItemSetBonusSystem [UpdateAfter(Pickup), UpdateBefore(Equipment)] → PassiveEffectSystem [UpdateAfter(Pickup), UpdateBefore(Equipment)] → EquipmentSystem → Crafting / Currency → LootDrop (OrderLast)All three new systems share the EquipmentDirtyTag gate. GridPlacementSystem does not disable the tag — downstream systems still need it. ItemSetBonusSystem additionally uses RequireForUpdate<SetBonusDefinition>.
→ See references/grid-placement-guide.md for InventoryGridUtility API.
→ See references/passive-effects-guide.md for clear-and-rebuild pattern.
→ See references/set-bonuses-guide.md for threshold stacking.
→ See references/gotchas.md for all critical gotchas.
Quick Examples
Section titled “Quick Examples”Auto-place item on pickup (done by GridPlacementSystem; manual trigger):
var cells = SystemAPI.GetBuffer<InventoryGridCell>(owner);var dim = SystemAPI.GetComponent<InventoryGridDimension>(owner);var effDim = InventoryGridUtility.GetEffectiveDimensions(shape, rotation);if (InventoryGridUtility.FindFirstFit(cells, dim.GridWidth, dim.GridHeight, effDim.x, effDim.y, out int gx, out int gy)) InventoryGridUtility.PlaceItem(cells, dim.GridWidth, gx, gy, effDim.x, effDim.y, itemEntity);Add passive effect to item at bake time:
var passives = AddBuffer<ItemPassiveEffect>(item);passives.Add(new ItemPassiveEffect{ Stat = StatType.PhysAtk, ModType = ModifierType.Flat, Value = 25f, Condition = PassiveCondition.InInventory});Configure set bonus singleton:
var defs = AddBuffer<SetBonusDefinition>(singleton);// 2-piece bonusdefs.Add(new SetBonusDefinition { SetId = 1, RequiredCount = 2, Stat = StatType.CritRate, ModType = ModifierType.PercentAdd, Value = 0.05f });// 4-piece bonus (stacks WITH 2-piece if 4 items owned)defs.Add(new SetBonusDefinition { SetId = 1, RequiredCount = 4, Stat = StatType.PhysAtk, ModType = ModifierType.PercentMul, Value = 0.20f });→ See references/demo-shapes-guide.md for ModifierSource separation table.
Reference Files
Section titled “Reference Files”| File | Content |
|---|---|
| grid-placement-guide.md | InventoryGridUtility API, rotation rules, auto-placement algorithm |
| passive-effects-guide.md | PassiveCondition, clear-and-rebuild pattern, bake setup |
| set-bonuses-guide.md | SetBonusDefinition config, counting logic, threshold stacking |
| gotchas.md | G1-G10, G14 — core gotchas |
| gotchas-ui-drag.md | G11-G13 — UI drag-and-drop gotchas |
| demo-shapes-guide.md | Polyomino shapes API, InventoryDemo, ModifierSource separation |
| library-api.md | DOTSInventory.Loot.RarityRoller — Burst-safe weighted rarity roll with pity |
Related rules
Section titled “Related rules”rules/library-feature-discovery-protocol.md— research the library 3× before implementing new functionality; always update this skill with what you find (or with the new code if you implement it)rules/manual-correction-implies-skill-gap-unity.md— if you manually inject library/API knowledge into a teammate brief, that knowledge belongs in this skill, not the brief