Fix #113 weapon modules

This commit is contained in:
sladecraven 2022-10-07 10:48:44 +02:00
parent 0d70783e9b
commit 37d27104fc

View File

@ -194,8 +194,13 @@ export class PegasusActor extends Actor {
let comp = this.items.filter(item => item.type == 'vehiclemodule');
return comp;
}
getVehicleWeaponModules() {
let comp = this.items.filter(item => item.type == 'vehicleweaponmodule' && item.system.activated);
getVehicleWeaponModules( activated = false ) {
let comp = []
if (activated ) {
comp = this.items.filter(item => item.type == 'vehicleweaponmodule' && item.system.activated)
} else {
comp = this.items.filter(item => item.type == 'vehicleweaponmodule' )
}
return comp;
}
@ -1801,7 +1806,7 @@ export class PegasusActor extends Actor {
}
addVehicleWeapons(rollData, vehicle) {
if (vehicle) {
let modules = vehicle.items.filter(vehicle => vehicle.type == "vehicleweaponmodule")
let modules = vehicle.items.filter(item => item.type == "vehicleweaponmodule" && item.system.activated)
if (modules && modules.length > 0) {
for (let module of modules) {
rollData.vehicleWeapons.push({ label: `Weapon ${module.name}`, type: "item", applied: false, weapon: module, value: module.system.damagedicevalue })