From b9141491a11a7658080539b130a375f8012b4a47 Mon Sep 17 00:00:00 2001 From: ChronoVortex Date: Fri, 21 Apr 2023 09:47:41 -0700 Subject: [PATCH] added aug effect charge scaling --- data/vertex_module/tags/augEffects.lua | 13 +++++++++++-- mod-appendix/metadata.xml | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/data/vertex_module/tags/augEffects.lua b/data/vertex_module/tags/augEffects.lua index 5f8b0fb..ebb77a2 100644 --- a/data/vertex_module/tags/augEffects.lua +++ b/data/vertex_module/tags/augEffects.lua @@ -39,6 +39,11 @@ local function parser(node) else augEffect.needsPower = parse_xml_bool(augEffectNode:first_attribute("needsPower"):value()) end + if not augEffectNode:first_attribute("chargeScaling") then + augEffect.chargeScaling = false -- augEffects do not scale by weapon charges by default + else + augEffect.chargeScaling = parse_xml_bool(augEffectNode:first_attribute("chargeScaling"):value()) + end if not augEffectNode:first_attribute("nostack") then augEffect.nostack = false -- augEffects stack by default else @@ -62,10 +67,14 @@ local function logic() for equipment in vter(system) do for _, augEffect in ipairs(equipmentInfo[equipment.blueprint.name]["augEffects"]) do if augEffect.effect == augName and (not augEffect.needsPower or equipment.powered) then + local effectAmount = augEffect.amount + if augEffect.chargeScaling and equipment.blueprint:GetType() == 0 then + effectAmount = effectAmount*(equipment.chargeLevel/math.max(equipment.weaponVisual.iChargeLevels, 1)) + end if augEffect.nostack then - table.insert(possibleValues, augEffect.amount) + table.insert(possibleValues, effectAmount) else - augBonusValue = augBonusValue + augEffect.amount + augBonusValue = augBonusValue + effectAmount end end end diff --git a/mod-appendix/metadata.xml b/mod-appendix/metadata.xml index 109283b..2dcdf6f 100644 --- a/mod-appendix/metadata.xml +++ b/mod-appendix/metadata.xml @@ -2,7 +2,7 @@ <![CDATA[ Vertex Tags and Utility Functions ]]> - +