Durability
Enables the durable trait, along with the accompanying Wear and Repair operations.
Durable items can be indestructible or break, which tags them as Inventory.Item.Trait.Indestructible
and Inventory.Item.Trait.Broken
, respectively.
Tracking Durability
The fragment provides the following ways to track an item's durability:
Via the
GetDurability
function, for occasional queries on the current durability.Via the
OnDurabilityChanged
delegate, which broadcasts each time the value changes.
Broken Items
When the durability reaches zero, an item is considered Broken and is tagged as Inventory.Item.Trait.Broken
. You can also query if an item is broken using the IsBroken
function from this fragment.
Items can also have their wear effect disabled, making them indestructible. These items are tagged as Inventory.Item.Trait.Indestructible
. and this feature can also be checked using the IsIndestructible
function from this fragment.
Wear Operation
This fragment provides the Wear operation, which can be created via the CreateWearPayload
function. It reduces the item's durability and marks the item as broken, by tagging as Inventory.Item.Broken
.
If your design requires a direct approach to adding wear, you can use the function exposed by the fragment. Please note that it becomes your responsibility to manage network authority.
Repair Operation
This fragment provides the Restore operation, which can be created via the CreateRestoreRepair
function. It restores the item's durability to its original value, and it removes the Inventory.Item.Broken
Gameplay Tag.