From 2a47b1188c5fc922f34ae5ee59e5ada29169c234 Mon Sep 17 00:00:00 2001 From: UndeadZeratul Date: Sat, 17 Feb 2024 13:35:09 -0600 Subject: [PATCH] Fix Bounty Initialization Logic Split up the bounty thinkers from the target selection, as now even without bounty targets, there can still be money dropping and thus the thinkers need to be initialized regardless. --- zscript/accensus/merchant/EventHandler.zsc | 26 +++++++++++++--------- zscript/accensus/merchant/econ/bounty.zsc | 5 ++++- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/zscript/accensus/merchant/EventHandler.zsc b/zscript/accensus/merchant/EventHandler.zsc index 124c0b2..522a921 100644 --- a/zscript/accensus/merchant/EventHandler.zsc +++ b/zscript/accensus/merchant/EventHandler.zsc @@ -292,21 +292,27 @@ class MerchantHandler : EventHandler PokerTick(); } - if (level.time == 35 && (MoneyMode == 1 || (MoneyMode == 2 && !SpawnedTiberium))) + if (level.time == 35) { - int count = 1; - for (int i = 0; i < 2; ++i) + InitBounty(); + + if (MoneyMode == 1 || (MoneyMode == 2 && !SpawnedTiberium)) { - if (random() <= AceCore.GetscaledChance(0, 64, 5, 15 + (5 * i))) - { - count++; - } - else + int count = 1; + for (int i = 0; i < 2; ++i) { - break; + if (random() <= AceCore.GetscaledChance(0, 64, 5, 15 + (5 * i))) + { + count++; + } + else + { + break; + } } + + InitBountyTargets(count); } - InitBounty(count); } } diff --git a/zscript/accensus/merchant/econ/bounty.zsc b/zscript/accensus/merchant/econ/bounty.zsc index 12cb2c5..2221f4f 100644 --- a/zscript/accensus/merchant/econ/bounty.zsc +++ b/zscript/accensus/merchant/econ/bounty.zsc @@ -2,7 +2,7 @@ extend class MerchantHandler { Array > bountyThinkers; - private void InitBounty(int count) + private void InitBounty() { bountyThinkers.clear(); @@ -13,7 +13,10 @@ extend class MerchantHandler bountyThinkers.Push((class)(AllClasses[i])); } } + } + private void InitBountyTargets(int count) + { Array chosenActors; ThinkerIterator it = ThinkerIterator.Create('Actor', Thinker.STAT_DEFAULT);