From 919420eac49db5f135bef833b3de0e2f6f9acd04 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Tue, 27 Sep 2022 16:49:51 +0200 Subject: [PATCH] Fix #52 --- modules/pegasus-actor.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js index 741776e..700b5ab 100644 --- a/modules/pegasus-actor.js +++ b/modules/pegasus-actor.js @@ -2086,13 +2086,34 @@ export class PegasusActor extends Actor { level += Number(armour.system.armourdicevalue) } } - //console.log(">>>> AMROR, ", level, arc.armourlevel) if (level != Number(arc.armourlevel)) { arc.armourlevel = level setTimeout(500, this.update({ [`system.arcs.${arcKey}`]: arc })) } } + // 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 }