From 2a0102e0495e22c5edd2612f51abae39e4ce4a53 Mon Sep 17 00:00:00 2001 From: Wil Thieme Date: Sun, 21 Mar 2021 12:19:16 -0400 Subject: [PATCH] preformat for other scripts set up code to make it easier for other extensions to add compatibility --- scripts/manager_ammunition.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/manager_ammunition.lua b/scripts/manager_ammunition.lua index 15e2a69..f9f3904 100644 --- a/scripts/manager_ammunition.lua +++ b/scripts/manager_ammunition.lua @@ -182,10 +182,13 @@ local function onAttack_new(rSource, rTarget, rRoll) table.insert(rAction.aMessages, "[MISS CHANCE " .. nMissChance .. "%]"); end - -- bmos adding hit margin tracking - local nHitMargin = calculateHitMargin(nDefenseVal, rAction.nTotal) - if nHitMargin then table.insert(rAction.aMessages, "[BY " .. nHitMargin .. "+]") end - -- end bmos adding hit margin tracking + -- bmos adding hit margin tracking + -- for compatibility with ammunition tracker, add this here in your onAttack function + if AmmunitionManager then + local nHitMargin = AmmunitionManager.calculateHitMargin(nDefenseVal, rAction.nTotal) + if nHitMargin then table.insert(rAction.aMessages, "[BY " .. nHitMargin .. "+]") end + end + -- end bmos adding hit margin tracking Comm.deliverChatMessage(rMessage); @@ -253,9 +256,10 @@ local function onAttack_new(rSource, rTarget, rRoll) end end - -- bmos adding automatic ammunition ticker and chat messaging - ammoTracker(rSource, bIsSourcePC, rRoll.sDesc, rAction.sResult) - -- end bmos adding automatic ammunition ticker and chat messaging + -- bmos adding automatic ammunition ticker and chat messaging + -- for compatibility with ammunition tracker, add this here in your onAttack function + if AmmunitionManager then AmmunitionManager.ammoTracker(rSource, bIsSourcePC, rRoll.sDesc, rAction.sResult) end + -- end bmos adding automatic ammunition ticker and chat messaging if rTarget then ActionAttack.notifyApplyAttack(rSource, rTarget, rRoll.bTower, rRoll.sType, rRoll.sDesc, rAction.nTotal, table.concat(rAction.aMessages, " "));