Weight and durability
Both are additive modules built on Core's extension points, and both are worth reading as examples of how a feature is added without touching Core.
Weight
FEDWeightFragment gives an item a unit weight. An item without one weighs nothing.
UEDWeightComponent sums the weight an actor is carrying and fires when it changes:
Weight->OnWeightChanged.AddDynamic(this, &AMyCharacter::HandleWeightChanged);
const float Total = Weight->GetTotalWeight();
By default it counts every container the actor has. Set bIncludeAllContainers false to count only
its main one — which is what you want if a stash should not slow the player down.
FEDWeightLimitRule is a container rule that refuses what would push it over a cap:
| Field | Meaning |
|---|---|
| Max Weight | The cap. |
| Weight Attribute | Optional GAS attribute, so a Strength perk raises it without touching the asset. |
Because it is a rule, it is consulted at the same acceptance gate as everything else. A vendor's Buy
button greys out with "That is too heavy" before the player clicks, and EvaluateAddItem and the
real add can never disagree.
const float Item = UEDInventoryWeightStatics::GetItemWeight(Entry);
const float Bag = UEDInventoryWeightStatics::GetContainerWeight(Container);
Durability
FEDDurabilityFragment gives an item a maximum durability and what happens when it runs out.
Current durability is per-stack state, not a fragment field — it lives in the entry's
FEDItemStateContainer, replicates with the entry, and saves with it.
UEDDurabilityStatics::GetDurability(Entry);
UEDDurabilityStatics::GetMaxDurability(Definition);
UEDDurabilityStatics::ApplyWear(Container, Handle, Amount);
UEDDurabilityStatics::Repair(Container, Handle, Amount);
Two consequences fall out of durability being per-stack state, and both are deliberate:
- Two swords at different durability never stack. Merging them would have to invent a number.
- A worn item keeps its wear through a move, because a transfer preserves handle and state.
What happens at zero — destroyed, rendered unusable, unequipped — is configured on the fragment, and the wear itself is your game's business. The framework does not know that swinging a sword should wear it out.
The pattern both follow
- A fragment describing the item's participation. Absent means not participating.
- Statics that read it, so Blueprint and C++ get the same surface.
- Optionally a rule or an observer component, registered through Core's registries.
Nothing in Core knows either module exists. That is what "additive" means here, and it is the shape to copy for a feature of your own — see Extending.
Where next
- Extending — writing a module like these
- Fragment reference