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