This commit is contained in:
sladecraven 2022-09-28 13:43:36 +02:00
parent ffaa9e4c19
commit 01a2fd9ff8
2 changed files with 31 additions and 38 deletions

View File

@ -371,9 +371,7 @@ export class PegasusActor extends Actor {
ppp += Number(power.system.powerlevelcost)
}
}
console.log("PPP update", ppp)
if (ppp != this.system.ppp.spentPPP) {
console.log("PPP update2", ppp)
this.update({ 'system.ppp.spentPPP': ppp })
}
}
@ -2114,29 +2112,6 @@ export class PegasusActor extends Actor {
}
}
// Shield management
if (item.type == "vehiclemodule" && item.system.category == "shield") {
let shieldsList = this.items.filter(item => item.type == "vehiclemodule" && item.system.category == "shield") || []
shieldsList.push(item)
let level = 0
for (let armour of shieldsList) {
if (armour.system.shielddicevalue > 0) {
level += Number(armour.system.shielddicevalue)
}
}
let shift = 500
for( let loc of __LocationsArmour) {
let arcKey = loc + "arc"
let arc = duplicate(this.system.arcs[arcKey])
if (level != Number(arc.shieldlevel)) {
arc.shieldlevel = level
setTimeout(shift, this.update({ [`system.arcs.${arcKey}`]: arc }))
shift += 200
}
}
}
return true
}
@ -2249,7 +2224,7 @@ export class PegasusActor extends Actor {
}
/* -------------------------------------------- */
activateVehicleModule(itemId) {
async activateVehicleModule(itemId) {
let mod = this.items.get(itemId)
if (mod) {
if (mod.system.nrg && mod.system.nrg > 0) {
@ -2259,7 +2234,7 @@ export class PegasusActor extends Actor {
ChatMessage.create({ content: `The Vehicle ${this.name} does not have enough Energy to Activate this module at this time.` })
return
}
this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }])
await this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }])
pc.actnrg += Number(mod.system.nrg)
pc.maxnrg -= Number(mod.system.nrg)
pc.curnrg -= Number(mod.system.nrg)
@ -2268,10 +2243,28 @@ export class PegasusActor extends Actor {
pc.actnrg -= Number(mod.system.nrg)
pc.maxnrg += Number(mod.system.nrg)
this.update({ 'system.statistics.pc': pc })
this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }])
await this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }])
}
} else {
this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }])
await this.updateEmbeddedDocuments('Item', [{ _id: mod.id, 'system.activated': !mod.system.activated }])
}
}
// Shield management
let shieldsList = this.items.filter(item => item.type == "vehiclemodule" && item.system.category == "shield" && item.system.activated) || []
let level = 0
for (let armour of shieldsList) {
if (armour.system.shielddicevalue > 0) {
level += Number(armour.system.shielddicevalue)
}
}
let shift = 500
for (let loc of __LocationsArmour) {
let arcKey = loc + "arc"
let arc = duplicate(this.system.arcs[arcKey])
if (level != Number(arc.shieldlevel)) {
arc.shieldlevel = level
setTimeout(shift, this.update({ [`system.arcs.${arcKey}`]: arc }))
shift += 200
}
}
}

View File

@ -115,8 +115,8 @@
<option value="none0">==== Combat Arcs</option>
<option value="d4">Combat Arc Flank (Grey) d4</option>
<option value="d6">Combat Arc Blind Spot (Red) d6</option>
<option value="d6">Slight cover d4</option>
<option value="none1">===== Cover defence</option>
<option value="d4">Slight cover d4</option>
<option value="d8">Half cover d8</option>
<option value="d12">Full cover d12</option>
<option value="d12">Full cover d12</option>