From 1e9f0515e5720cf8014788953efd56dc2926bfc4 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 24 Feb 2021 14:22:52 +0200 Subject: [PATCH] Contents that are weightless are now summed and stored on the container --- .../denormalise/recomputeInventory.js | 7 +-- app/imports/constants/SVG_ICONS.js | 4 ++ .../components/inventory/ContainerCard.vue | 2 +- .../ui/properties/viewers/ContainerViewer.vue | 44 ++++++++++++------- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/app/imports/api/creature/denormalise/recomputeInventory.js b/app/imports/api/creature/denormalise/recomputeInventory.js index b5754330..e030f1cf 100644 --- a/app/imports/api/creature/denormalise/recomputeInventory.js +++ b/app/imports/api/creature/denormalise/recomputeInventory.js @@ -95,12 +95,7 @@ function getInventoryData(tree, containersToWrite){ } function storeContentsData(node, childData, containersToWrite){ - let newContentsWeight; - if (node.contentsWeightless){ - newContentsWeight = 0; - } else { - newContentsWeight = childData.weightCarried - } + let newContentsWeight = childData.weightCarried if (node.contentsWeight !== newContentsWeight){ node.contentsWeight = newContentsWeight; node.contentsWeightChanged = true; diff --git a/app/imports/constants/SVG_ICONS.js b/app/imports/constants/SVG_ICONS.js index 35263685..d988a2ee 100644 --- a/app/imports/constants/SVG_ICONS.js +++ b/app/imports/constants/SVG_ICONS.js @@ -91,6 +91,10 @@ const SVG_ICONS = Object.freeze({ name: 'weight', shape: 'M256 46c-45.074 0-82 36.926-82 82 0 25.812 12.123 48.936 30.938 64H128L32 480h448l-96-288h-76.938C325.877 176.936 338 153.812 338 128c0-45.074-36.926-82-82-82zm0 36c25.618 0 46 20.382 46 46s-20.382 46-46 46-46-20.382-46-46 20.382-46 46-46z', }, + 'weightless': { + name: 'weightless', + shape: 'M470.72 20L368.186 49.813l41.563-28.094c-26.254 5.922-59.36 17.502-100.97 36.186l-67.874 70.78L264.97 79.25c-23.247 12.958-47.95 29.99-71.814 49.844l-15.78 64.312L174 145.844c-23.55 21.548-45.624 45.6-63.875 70.812-19.25 26.59-34.28 54.506-41.813 82.438L40.19 280.28c6.138 19.613 11.892 39.232 22.906 58.845.032 1.468.1 2.944.187 4.406L29.657 333.19c11.227 18.284 23.577 35.893 43 49.125.45 1.003.953 1.973 1.438 2.968-11.838 33.33-20.568 67.004-26.53 101.69l18.405 3.155c4.952-28.808 11.836-56.842 20.905-84.563.04.053.084.105.125.157 44.277-156.11 142.813-266.846 287.03-324l6.876 17.374c-129.048 51.143-219.303 145.15-265.78 279.062 18.106.102 35.796-2.088 52.218-6.22l4.875-60.967 13.093 55.5c10.84-3.922 20.88-8.762 29.812-14.376l-20.688-43.47 32.782 34.813c7.944-6.468 14.613-13.678 19.624-21.53 30.308-47.507 62.195-94.728 124.75-134.188l-45.72-16.25 70.157 2.124c2.044-1.085 4.087-2.18 6.19-3.25 9.087-4.63 17.916-10.182 26.31-16.375L378.814 150l74.718-17.625c5.788-5.81 11.174-11.836 16.033-17.97 17.384-21.94 29.034-44.784 26.28-65.56-1.376-10.39-7.556-20.154-17.624-25.626-2.333-1.27-4.832-2.337-7.5-3.22zM106.25 406c-.89 3.06-1.778 6.122-2.625 9.22l2.625-9.22z' + } }); export default SVG_ICONS; diff --git a/app/imports/ui/properties/components/inventory/ContainerCard.vue b/app/imports/ui/properties/components/inventory/ContainerCard.vue index bf68a64f..fcb280f0 100644 --- a/app/imports/ui/properties/components/inventory/ContainerCard.vue +++ b/app/imports/ui/properties/components/inventory/ContainerCard.vue @@ -17,7 +17,7 @@ > $vuetify.icons.weight - {{ (model.contentsWeight || 0) + (model.weight || 0) }} + {{ (model.contentsWeight ? 0 : model.contentsWeight || 0) + (model.weight || 0) }} - - + + {{ model.contentsWeight }} lb + + + contents + + + + Contents weightless + + + $vuetify.icons.weightless + +