Fix #24 #25 Cargo capacity

This commit is contained in:
sladecraven 2022-09-25 15:48:11 +02:00
parent 262bd3b480
commit 392c76f86a
4 changed files with 53 additions and 29 deletions

View File

@ -23,7 +23,8 @@ const __statBuild = [
const __isVehicleUnique = { vehiclehull: 1, powercoremodule: 1, mobilitymodule: 1, propulsionmodule: 1, combatmodule: 1 }
const __speed2Num = { fullstop: 0, crawling: 1, slow: 2, average: 3, fast: 4, extfast: 5 }
const __num2speed = ["fullstop", "crawling", "slow", "average", "fast", "extfast"]
const __isVehicle = { vehiclehull: 1, powercoremodule: 1, mobilitymodule: 1, combatmodule: 1, propulsionmodule: 1, vehiclemodule: 1, vehicleweaponmodule: 1, effect: 1 }
const __isVehicle = { vehiclehull: 1, powercoremodule: 1, mobilitymodule: 1, combatmodule: 1,
propulsionmodule: 1, vehiclemodule: 1, vehicleweaponmodule: 1, effect: 1, equipment: 1, weapon: 1, armor: 1, shield:1, money: 1 }
const __bonusEffect = {
name: "Crawling MAN Bonus", type: "effect", img: "systems/fvtt-pegasus-rpg/images/icons/icon_effect.webp",
system: {
@ -2154,4 +2155,17 @@ export class PegasusActor extends Actor {
this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }])
}
}
/* -------------------------------------------- */
getCurrentCargoCapacity( ) {
let capacity = 0
for (let cargo of this.items) {
if (cargo.type == "equipment" || cargo.type == "weapon" || cargo.type == "armor" || cargo.type == "money" || cargo.type == "shield" ) {
let q = cargo.system.quantity || 1
capacity += q * cargo.system.weight
}
}
return capacity
}
}

View File

@ -54,6 +54,12 @@ export class PegasusVehicleSheet extends ActorSheet {
propulsionModules: duplicate(this.actor.getPropulsionModules()),
vehicleModules: duplicate(this.actor.getVehicleModules()),
vehicleWeaponModules: duplicate(this.actor.getVehicleWeaponModules()),
weapons: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getWeapons()) ),
armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())),
shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields()) ),
equipments: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getEquipmentsOnly()) ),
cargoCurrent: this.actor.getCurrentCargoCapacity(),
moneys: duplicate(this.actor.getMoneys()),
options: this.options,
owner: this.document.isOwner,
editScore: this.options.editScore,

View File

@ -7,14 +7,14 @@
{{/if}}
<span class="item-field-label-long"><label>
{{equip.data.quantity}}
{{equip.system.quantity}}
(<a class="quantity-minus plus-minus-button">&nbsp;-</a>/<a class="quantity-plus plus-minus-button">+</a>)
</label>
</span>
<span class="item-field-label-medium">
{{#if (count equip.data.effects)}}
{{#if equip.data.activated}}
{{#if (count equip.system.effects)}}
{{#if equip.system.activated}}
<a class="equip-deactivate">Deactivate</a>
{{else}}
<a class="equip-activate">Activate</a>
@ -25,14 +25,14 @@
</span>
<span class="item-field-label-short">
{{#if equip.data.iscontainer}}
{{equip.data.contentsEnc}}
{{equip.system.contentsEnc}}
{{else}}
{{mul equip.data.weight equip.data.quantity}}
{{mul equip.system.weight equip.system.quantity}}
{{/if}}
</span>
<span class="item-field-label-medium">
{{#if equip.data.idrDice}}
<a class="roll-idr" data-dice-value="{{equip.data.idrDice}}">{{equip.data.idrDice}}</a>
{{#if equip.system.idrDice}}
<a class="roll-idr" data-dice-value="{{equip.data.idrDice}}">{{equip.system.idrDice}}</a>
{{else}}
&nbsp;-&nbsp;
{{/if}}
@ -40,9 +40,11 @@
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
{{#if (eq level 1)}}
<a class="item-control item-equip" title="Worn">{{#if equip.data.equipped}}<i
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
{{#if canequip}}
{{#if (eq level 1)}}
<a class="item-control item-equip" title="Worn">{{#if equip.system.equipped}}<i
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
{{/if}}
{{/if}}
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>

View File

@ -592,11 +592,17 @@
{{!-- Cargo Tab --}}
<div class="tab equipment" data-group="primary" data-tab="cargo">
<div class="flexrow">
<h3>Encumbrance</h3>
<span class="small-label">Current : {{encCurrent}}</span>
<span class="small-label">Capacity : {{encCapacity}}</span>
<span class="small-label">Hindrance : {{encHindrance}}</span>
<div class="stat-item">
<ul class="stat-list alternate-list">
<li class="item stat flexrow list-item">
<span class="generic-label small-label "><strong>Cargo Capacity</strong></span>
<input type="text" class="input-numeric-short padd-right" name="system.cargocapacity" value="{{data.cargocapacity}}"
data-dtype="Number" />
<span class="generic-label small-label"><strong>Total Cargo Capacity</strong></span>
<input type="text" class="input-numeric-short" value="{{cargoCurrent}}"
data-dtype="Number" />
</li>
</ul>
</div>
<ul class="item-list alternate-list">
@ -724,8 +730,6 @@
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<a class="item-control item-equip" title="Worn">{{#if weapon.system.equipped}}<i
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
@ -793,8 +797,6 @@
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<a class="item-control item-equip" title="Worn">{{#if armor.system.equipped}}<i
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
@ -852,8 +854,6 @@
</span>
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<a class="item-control item-equip" title="Worn">{{#if shield.system.equipped}}<i
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
@ -883,17 +883,19 @@
</div>
</li>
{{#each containersTree as |equip key|}}
{{> systems/fvtt-pegasus-rpg/templates/partial-actor-equipment.html equip=equip level=1}}
<ul class="item-list list-item-shadow2 list-item-margin1">
{{#each equip.system.contents as |subgear key|}}
{{> systems/fvtt-pegasus-rpg/templates/partial-actor-equipment.html equip=subgear level=2}}
{{/each}}
</ul>
{{#each equipments as |equip key|}}
{{> systems/fvtt-pegasus-rpg/templates/partial-actor-equipment.html equip=equip level=1 canequip=false}}
{{/each}}
</ul>
<hr>
<h3>Cargo information : </h3>
<div class="form-group editor">
{{editor data.cargo.cargoinformation target="system.cargo.cargoinformation" button=true owner=owner
editable=editable}}
</div>
<hr>
</div>