Contents that are weightless are now summed and stored on the container

This commit is contained in:
Stefan Zermatten
2021-02-24 14:22:52 +02:00
parent 0404020335
commit 1e9f0515e5
4 changed files with 33 additions and 24 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -17,7 +17,7 @@
>
$vuetify.icons.weight
</v-icon>
{{ (model.contentsWeight || 0) + (model.weight || 0) }}
{{ (model.contentsWeight ? 0 : model.contentsWeight || 0) + (model.weight || 0) }}
</v-toolbar-title>
<v-toolbar-title
class="layout row align-center"

View File

@@ -65,24 +65,16 @@
row
align-center
justify-end
:class="{'mb-2': model.contentsWeightless}"
>
<template v-if="model.contentsWeightless">
<span
class="title"
>
contents weightless
</span>
</template>
<template v-else>
<span class="title mr-2">
{{ model.contentsWeight }} lb
</span>
<span
class="title"
>
contents
</span>
</template>
<span class="title mr-2">
{{ model.contentsWeight }} lb
</span>
<span
class="title"
>
contents
</span>
<v-icon
class="ml-2"
x-large
@@ -90,6 +82,24 @@
$vuetify.icons.injustice
</v-icon>
</v-layout>
<v-layout
v-if="model.contentsWeightless"
row
align-center
justify-end
>
<span
class="title"
>
Contents weightless
</span>
<v-icon
class="ml-2"
x-large
>
$vuetify.icons.weightless
</v-icon>
</v-layout>
</div>
</div>
<property-description