Skip to content

Commit

Permalink
-Self bot improvement: If a self-bot falls through the terrain it's c…
Browse files Browse the repository at this point in the history
…orpse will be relocated to the surface.
  • Loading branch information
mostlikely4r committed Oct 7, 2024
1 parent e28ec44 commit 82c0f70
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions playerbot/strategy/actions/ReviveFromCorpseAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,26 @@ bool FindCorpseAction::Execute(Event& event)
WorldPosition botPos(bot), corpsePos(corpse), moveToPos = corpsePos, masterPos(master);
float reclaimDist = CORPSE_RECLAIM_RADIUS - 5.0f;
float corpseDist = botPos.distance(corpsePos);

//If player fell through terrain move corpse to player position.
if (bot->isRealPlayer())
{
//Try to correct the position upward.
if (!moveToPos.ClosestCorrectPoint(5.0f, 500.0f, bot->GetInstanceId()))
{
//Revive in place.
corpse->Relocate(botPos.getX(), botPos.getY(), botPos.getZ());
corpsePos = corpse;
corpseDist = botPos.distance(corpsePos);
}
else
{
corpse->Relocate(moveToPos.getX(), moveToPos.getY(), moveToPos.getZ());
corpsePos = corpse;
corpseDist = botPos.distance(corpsePos);
}
}

int64 deadTime = time(nullptr) - corpse->GetGhostTime();

bool moveToMaster = master && master != bot && masterPos.fDist(corpsePos) < reclaimDist;
Expand Down

0 comments on commit 82c0f70

Please sign in to comment.