Item Lifecycle Specification - wwestlake/Steamforge GitHub Wiki
🔄 Item Lifecycle Specification
Purpose
To define the valid runtime states an item can exist in within Steamforge, along with their allowed transitions, associated behaviors, and how these capabilities are exposed and enforced through Blueprint and engine-level logic.
1. 🧾 Item States
Item states define where and how an item exists during gameplay. An item instance can only be in one state at a time.
State | Description |
---|---|
Inventory |
Held within an actor’s inventory (player, container, NPC) |
InUse |
Actively equipped, consumed, or providing a persistent effect |
Dropped |
Exists as a world AItemActor , available for pickup |
Placed |
Manually positioned in the world (e.g., furniture, machines, decorations) |
2. 🧠 Item Capabilities
Capabilities define what an item can support, not what it is currently doing. These are static properties defined in the item’s DataTable row.
Capability | Description |
---|---|
bCanBeDropped |
Item supports being dropped into the world |
bCanBePlaced |
Item can be placed and aligned (e.g., furniture) |
bCanBeEquipped |
Item can enter the InUse state through equip or activation |
bStackable |
Item can be stacked in inventory |
3. 🔁 State Transition Flow
From | To | Trigger | Notes |
---|---|---|---|
Inventory | Dropped | Drop action | Only if bCanBeDropped = true |
Inventory | Placed | Placement system | Only if bCanBePlaced = true ; places in world grid |
Inventory | InUse | Equip/Use | Only if bCanBeEquipped = true ; effects applied or attached |
Dropped | Inventory | Pickup | Requires AItemActor pickup |
Placed | Inventory | Dismantle/Recover | Optional mechanic |
InUse | Inventory | Unequip/Consume End | Unequipping or consuming ends use |
All transitions must be validated by the server.
4. 📘 Blueprint Integration
Each item instance (via FItemInstanceData
or actor) will expose:
CurrentState : EItemState
- Capability checks:
CanBeDropped()
CanBeEquipped()
CanBePlaced()
- Transition calls:
DropItem()
UseItem()
PlaceItem(FVector Location)
These methods:
- Internally validate capabilities
- Run on server (RPC if needed)
- Replicate updated state to clients
5. ⚙️ Engine-Level Enforcement
Placing an Item
- System checks
bCanBePlaced
- Spawns a static world actor (decor, machinery, etc.)
- Anchors to player’s building grid (if applicable)
Dropping an Item
- Spawns a replicated
AItemActor
- Transfers instance data
- Enables physics/collision
Equipping/Using
- Applies gameplay effect or equips mesh/attachment
- May consume item or transition to cooldown state
6. 🧩 Future Extensions
- Durability depletion triggering state change
- Binding items to specific owners or characters
- Persistent world placement saved through SaveGame
- State history for auditing/tracking
Summary
This specification ensures all item behaviors in Steamforge are consistent, rule-based, and extendable, while supporting secure multiplayer logic and Blueprint-based development for rapid prototyping and modding.