- Fixed loot trigger to respect stay strategy (#1437)

This commit is contained in:
kadeshar
2025-07-14 19:27:16 +02:00
committed by GitHub
parent 96cc0daea6
commit 761ef634da

View File

@@ -11,11 +11,21 @@
bool LootAvailableTrigger::IsActive() bool LootAvailableTrigger::IsActive()
{ {
bool distanceCheck = false;
if (botAI->HasStrategy("stay", BOT_STATE_NON_COMBAT))
{
distanceCheck =
sServerFacade->IsDistanceLessOrEqualThan(AI_VALUE2(float, "distance", "loot target"), CONTACT_DISTANCE);
}
else
{
distanceCheck = sServerFacade->IsDistanceLessOrEqualThan(AI_VALUE2(float, "distance", "loot target"),
INTERACTION_DISTANCE - 2.0f);
}
// if loot target if empty, always pass distance check
return AI_VALUE(bool, "has available loot") && return AI_VALUE(bool, "has available loot") &&
// if loot target if empty, always pass distance check (distanceCheck || AI_VALUE(GuidVector, "all targets").empty());
(sServerFacade->IsDistanceLessOrEqualThan(AI_VALUE2(float, "distance", "loot target"),
INTERACTION_DISTANCE - 2.0f) ||
AI_VALUE(GuidVector, "all targets").empty());
} }
bool FarFromCurrentLootTrigger::IsActive() bool FarFromCurrentLootTrigger::IsActive()