Skip to content

Commit

Permalink
Close #1934
Browse files Browse the repository at this point in the history
  • Loading branch information
moo-man committed Apr 28, 2024
1 parent 09ff855 commit 5a5d14b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/actor/sheet/actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export default class ActorSheetWfrp4e extends WFRP4eSheetMixin(ActorSheet) {
cont.system.carrying = itemsInside.filter(i => i.type != "container"); // cont.system.carrying -> items the container is carrying
cont.system.packsInside = itemsInside.filter(i => i.type == "container"); // cont.system.packsInside -> containers the container is carrying
cont.system.carries.current = itemsInside.reduce(function (prev, cur) { // cont.system.holding -> total encumbrance the container is holding
return Number(prev) + Number(cur.encumbrance.value);
return Number(prev) + Number(cur.encumbrance.total);
}, 0);
cont.system.carries.current = Math.floor(cont.system.carries.current * 10) / 10;
cont.system.collapsed=this.actor.getFlag("wfrp4e", "sheetCollapsed")?.[cont.id];
Expand Down
10 changes: 10 additions & 0 deletions modules/model/item/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ export class ContainerModel extends PhysicalItemModel {
}
}

computeEncumbrance()
{
let enc = super.computeEncumbrance();
if (!this.countEnc.value)
{
enc = 0;
}
return enc;
}

shouldTransferEffect(effect)
{
return super.shouldTransferEffect(effect) && (!effect.applicationData.equipTransfer || this.isEquipped)
Expand Down
4 changes: 2 additions & 2 deletions static/templates/partials/item-container.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="column-section">
<span class="item-carries">{{localize 'Carries'}}: {{pack.carries.current}}/{{pack.carries.value}}</span>
<a class="toggle-enc" title="{{localize 'SHEET.CountEncOn'}}">{{localize "SHEET.EncAbbrev"}}:
{{pack.encumbrance.value}}</a>
{{pack.encumbrance.total}}</a>
</div>
{{else}}
<div class="column-section">
Expand Down Expand Up @@ -75,7 +75,7 @@
<div class="item-type">{{item.trappingCategory}}</div>

<a class="quantity quantity-click">{{item.quantity.value}}</a>
<span class="weight">{{item.encumbrance.value}}</span>
<span class="weight">{{item.encumbrance.total}}</span>
{{#if ../owner}}
<div class="item-controls">
{{else}}
Expand Down

0 comments on commit 5a5d14b

Please sign in to comment.