This commit is contained in:
sladecraven 2022-09-26 18:42:13 +02:00
parent 1e37ae3eb1
commit 1a5ff925b7
4 changed files with 76 additions and 11 deletions

View File

@ -24,7 +24,8 @@ const __isVehicleUnique = { vehiclehull: 1, powercoremodule: 1, mobilitymodule:
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, equipment: 1, weapon: 1, armor: 1, shield:1, money: 1 }
propulsionmodule: 1, vehiclemodule: 1, vehicleweaponmodule: 1, effect: 1, equipment: 1, weapon: 1, armor: 1, shield:1, money: 1, cargo: 1 }
const __isVehicleCargo = {equipment: 1, weapon: 1, armor: 1, shield:1, money: 1, cargo: 1}
const __bonusEffect = {
name: "Crawling MAN Bonus", type: "effect", img: "systems/fvtt-pegasus-rpg/images/icons/icon_effect.webp",
system: {
@ -159,32 +160,30 @@ export class PegasusActor extends Actor {
let comp = this.items.filter(item => item.type == 'combatmodule');
return comp;
}
/* -------------------------------------------- */
getCargos() {
let comp = this.items.filter(item => item.type == 'cargo');
return comp;
}
getVehicleHull() {
let comp = this.items.filter(item => item.type == 'vehiclehull');
return comp;
}
/* -------------------------------------------- */
getPowercoreModules() {
let comp = this.items.filter(item => item.type == 'powercoremodule');
return comp;
}
/* -------------------------------------------- */
getMobilityModules() {
let comp = this.items.filter(item => item.type == 'mobilitymodule');
return comp;
}
/* -------------------------------------------- */
getPropulsionModules() {
let comp = this.items.filter(item => item.type == 'propulsionmodule');
return comp;
}
/* -------------------------------------------- */
getVehicleModules() {
let comp = this.items.filter(item => item.type == 'vehiclemodule');
return comp;
}
/* -------------------------------------------- */
getVehicleWeaponModules() {
let comp = this.items.filter(item => item.type == 'vehicleweaponmodule');
return comp;
@ -2050,6 +2049,20 @@ export class PegasusActor extends Actor {
return false
}
}
if( __isVehicleCargo[item.type]) {
let capacity = this.getCurrentCargoCapacity()
if ( item.type == "cargo") {
capacity += Number(item.system.capacity)
} else {
let q = item.system.quantity || 1
capacity += Number(q) * Number(item.system.weight)
}
console.log("capa", capacity, this.system.cargo.cargocapacity)
if ( capacity > this.system.cargo.cargocapacity) {
ui.notifications.warn("Your cargo capacity is already full, unable to add this content : " + item.name)
return false
}
}
return true
}
@ -2163,7 +2176,10 @@ export class PegasusActor extends Actor {
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
capacity += Number(q) * Number(cargo.system.weight)
}
if (cargo.type == "cargo" ) {
capacity += Number(cargo.system.capacity)
}
}
return capacity

View File

@ -58,6 +58,7 @@ export class PegasusVehicleSheet extends ActorSheet {
armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())),
shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields()) ),
equipments: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getEquipmentsOnly()) ),
cargos: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getCargos()) ),
cargoCurrent: this.actor.getCurrentCargoCapacity(),
moneys: duplicate(this.actor.getMoneys()),
options: this.options,

View File

@ -253,7 +253,7 @@
],
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "10.0.17",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.17.zip",
"version": "10.0.18",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.18.zip",
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
}

View File

@ -596,7 +596,7 @@
<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}}"
<input type="text" class="input-numeric-short padd-right" name="system.cargo.cargocapacity" value="{{data.cargo.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}}"
@ -605,6 +605,54 @@
</ul>
</div>
<ul class="item-list alternate-list">
<li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header">
<h3><label class="items-title-text">Cargo</label></h3>
</span>
<span class="item-field-label-long">
<label class="short-label">Capacity</label>
</span>
<span class="item-field-label-medium">
<label class="short-label">Value</label>
</span>
<span class="item-field-label-medium">
<label class="short-label">IDR</label>
</span>
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<a class="item-control item-add" data-type="cargo" title="Create Item"><i class="fas fa-plus"></i></a>
</div>
</li>
{{#each cargos as |cargo key|}}
<li class="item flexrow list-item list-item-shadow" data-item-id="{{money._id}}">
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
src="{{cargo.img}}" /></a>
<span class="item-name-label">{{cargo.name}}</span>
<span class="item-field-label-long"><label>
{{cargo.system.capacity}}
</label>
</span>
<span class="item-field-label-medium">
<label>{{cargo.system.value}}</label>
</span>
<span class="item-field-label-medium">
{{#if cargo.system.idrDice}}
<a class="roll-idr" data-dice-value="{{cargo.system.idrDice}}">{{cargo.system.idrDice}}</a>
{{else}}
&nbsp;-&nbsp;
{{/if}}
</span>
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<ul class="item-list alternate-list">
<li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header">