From 5a5d14bd99ffb0317b430a7c35b2d44c204cc3b0 Mon Sep 17 00:00:00 2001 From: Russell Date: Sat, 27 Apr 2024 21:25:13 -0500 Subject: [PATCH] Close #1934 --- modules/actor/sheet/actor-sheet.js | 2 +- modules/model/item/container.js | 10 ++++++++++ static/templates/partials/item-container.hbs | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/actor/sheet/actor-sheet.js b/modules/actor/sheet/actor-sheet.js index 7ede88bd4..d2ff33049 100644 --- a/modules/actor/sheet/actor-sheet.js +++ b/modules/actor/sheet/actor-sheet.js @@ -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]; diff --git a/modules/model/item/container.js b/modules/model/item/container.js index 75a59fbf0..94aeeaaa9 100644 --- a/modules/model/item/container.js +++ b/modules/model/item/container.js @@ -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) diff --git a/static/templates/partials/item-container.hbs b/static/templates/partials/item-container.hbs index f3bc038f3..335223aac 100644 --- a/static/templates/partials/item-container.hbs +++ b/static/templates/partials/item-container.hbs @@ -15,7 +15,7 @@
{{localize 'Carries'}}: {{pack.carries.current}}/{{pack.carries.value}} {{localize "SHEET.EncAbbrev"}}: - {{pack.encumbrance.value}} + {{pack.encumbrance.total}}
{{else}}
@@ -75,7 +75,7 @@
{{item.trappingCategory}}
{{item.quantity.value}} - {{item.encumbrance.value}} + {{item.encumbrance.total}} {{#if ../owner}}
{{else}}