Make aggro space spheroidal on Z

By doubling the z difference used in distance calculation, mobs above or below the player will aggro less often.
This commit is contained in:
Gent S 2020-12-02 09:20:33 -05:00
parent 86f17b6525
commit 73f8179836

View File

@ -1174,7 +1174,7 @@ bool MobManager::aggroCheck(Mob *mob, time_t currTime) {
// height is relevant for aggro distance because of platforming // height is relevant for aggro distance because of platforming
int xyDistance = hypot(mob->appearanceData.iX - plr->x, mob->appearanceData.iY - plr->y); int xyDistance = hypot(mob->appearanceData.iX - plr->x, mob->appearanceData.iY - plr->y);
int distance = hypot(xyDistance, mob->appearanceData.iZ - plr->z); int distance = hypot(xyDistance, (mob->appearanceData.iZ - plr->z) * 2); // difference in Z counts twice
if (distance > mobRange || distance > closestDistance) if (distance > mobRange || distance > closestDistance)
continue; continue;