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 __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 __speed2Num = { fullstop: 0, crawling: 1, slow: 2, average: 3, fast: 4, extfast: 5 }
const __num2speed = ["fullstop", "crawling", "slow", "average", "fast", "extfast"] 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 = { const __bonusEffect = {
name: "Crawling MAN Bonus", type: "effect", img: "systems/fvtt-pegasus-rpg/images/icons/icon_effect.webp", name: "Crawling MAN Bonus", type: "effect", img: "systems/fvtt-pegasus-rpg/images/icons/icon_effect.webp",
system: { system: {
@ -2154,4 +2155,17 @@ export class PegasusActor extends Actor {
this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }]) 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()), propulsionModules: duplicate(this.actor.getPropulsionModules()),
vehicleModules: duplicate(this.actor.getVehicleModules()), vehicleModules: duplicate(this.actor.getVehicleModules()),
vehicleWeaponModules: duplicate(this.actor.getVehicleWeaponModules()), 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, options: this.options,
owner: this.document.isOwner, owner: this.document.isOwner,
editScore: this.options.editScore, editScore: this.options.editScore,

View File

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

View File

@ -592,11 +592,17 @@
{{!-- Cargo Tab --}} {{!-- Cargo Tab --}}
<div class="tab equipment" data-group="primary" data-tab="cargo"> <div class="tab equipment" data-group="primary" data-tab="cargo">
<div class="flexrow"> <div class="stat-item">
<h3>Encumbrance</h3> <ul class="stat-list alternate-list">
<span class="small-label">Current : {{encCurrent}}</span> <li class="item stat flexrow list-item">
<span class="small-label">Capacity : {{encCapacity}}</span> <span class="generic-label small-label "><strong>Cargo Capacity</strong></span>
<span class="small-label">Hindrance : {{encHindrance}}</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> </div>
<ul class="item-list alternate-list"> <ul class="item-list alternate-list">
@ -724,8 +730,6 @@
<div class="item-filler">&nbsp;</div> <div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed"> <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> <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
@ -793,8 +797,6 @@
<div class="item-filler">&nbsp;</div> <div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed"> <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> <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
@ -852,8 +854,6 @@
</span> </span>
<div class="item-filler">&nbsp;</div> <div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed"> <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> <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
@ -883,17 +883,19 @@
</div> </div>
</li> </li>
{{#each containersTree as |equip key|}} {{#each equipments as |equip key|}}
{{> systems/fvtt-pegasus-rpg/templates/partial-actor-equipment.html equip=equip level=1}} {{> systems/fvtt-pegasus-rpg/templates/partial-actor-equipment.html equip=equip level=1 canequip=false}}
<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}} {{/each}}
</ul> </ul>
<hr> <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> </div>