Fix #53
This commit is contained in:
parent
01a2fd9ff8
commit
65d0b18191
@ -2032,7 +2032,7 @@ export class PegasusActor extends Actor {
|
|||||||
if (this.system.statistics.hr.currentlevel == 0) {
|
if (this.system.statistics.hr.currentlevel == 0) {
|
||||||
ChatMessage.create({ content: `The vehicle ${this.name} has been destroyed !` })
|
ChatMessage.create({ content: `The vehicle ${this.name} has been destroyed !` })
|
||||||
}
|
}
|
||||||
|
this.processVehicleArmorShields()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2094,24 +2094,6 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Armour management
|
|
||||||
if (item.type == "vehiclemodule" && item.system.category == "armor") {
|
|
||||||
let armorsList = this.items.filter(item => item.type == "vehiclemodule" && item.system.category == "armor") || []
|
|
||||||
armorsList.push(item)
|
|
||||||
let arcKey = item.system.location + "arc"
|
|
||||||
let arc = duplicate(this.system.arcs[arcKey])
|
|
||||||
let level = 0
|
|
||||||
for (let armour of armorsList) {
|
|
||||||
if (armour.system.armourdicevalue > 0) {
|
|
||||||
level += Number(armour.system.armourdicevalue)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (level != Number(arc.armourlevel)) {
|
|
||||||
arc.armourlevel = level
|
|
||||||
setTimeout(500, this.update({ [`system.arcs.${arcKey}`]: arc }))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2249,6 +2231,12 @@ export class PegasusActor extends Actor {
|
|||||||
await this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }])
|
await this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.processVehicleArmorShields()
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
processVehicleArmorShields() {
|
||||||
// Shield management
|
// Shield management
|
||||||
let shieldsList = this.items.filter(item => item.type == "vehiclemodule" && item.system.category == "shield" && item.system.activated) || []
|
let shieldsList = this.items.filter(item => item.type == "vehiclemodule" && item.system.category == "shield" && item.system.activated) || []
|
||||||
let level = 0
|
let level = 0
|
||||||
@ -2267,6 +2255,23 @@ export class PegasusActor extends Actor {
|
|||||||
shift += 200
|
shift += 200
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Armour management
|
||||||
|
let armorsList = this.items.filter(item => item.type == "vehiclemodule" && item.system.category == "armor" && item.system.activated) || []
|
||||||
|
for (let loc of __LocationsArmour) {
|
||||||
|
let arcKey = loc + "arc"
|
||||||
|
let arc = duplicate(this.system.arcs[arcKey])
|
||||||
|
let level = 0
|
||||||
|
for (let armour of armorsList) {
|
||||||
|
if (armour.system.location == loc && armour.system.armourdicevalue > 0) {
|
||||||
|
level += Number(armour.system.armourdicevalue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (level != Number(arc.armourlevel)) {
|
||||||
|
arc.armourlevel = level
|
||||||
|
setTimeout(500, this.update({ [`system.arcs.${arcKey}`]: arc }))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user