From facc613fac9fe8abf68dbb42777a676af3a786e7 Mon Sep 17 00:00:00 2001 From: hexhexD Date: Fri, 12 Jan 2024 06:37:26 -0500 Subject: [PATCH] Add back item take logic in finishAttacking (#3844) item take in actor_died_or_disappeared is only for itemsTakeAuto_party --- src/AI/Attack.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/AI/Attack.pm b/src/AI/Attack.pm index 6f7d689ed0..2aa1c824d1 100644 --- a/src/AI/Attack.pm +++ b/src/AI/Attack.pm @@ -236,8 +236,15 @@ sub finishAttacking { Plugins::callHook('target_died', {monster => $monsters_old{$ID}}); monKilled(); - # Cheap way to suspend all movement to make it look real - ai_clientSuspend(0, $timeout{'ai_attack_waitAfterKill'}{'timeout'}); + # Pickup loot when monster's dead + if (AI::state == AI::AUTO && $config{'itemsTakeAuto'} && $monsters_old{$ID}{dmgFromYou} > 0 && !$monsters_old{$ID}{ignore}) { + AI::clear("items_take"); + ai_items_take($monsters_old{$ID}{pos}{x}, $monsters_old{$ID}{pos}{y}, + $monsters_old{$ID}{pos_to}{x}, $monsters_old{$ID}{pos_to}{y}); + } else { + # Cheap way to suspend all movement to make it look real + ai_clientSuspend(0, $timeout{'ai_attack_waitAfterKill'}{'timeout'}); + } ## kokal start ## mosters counting