Teleport to spawn when too far away and region becomes inactive.

This commit is contained in:
MobiusDevelopment
2022-06-10 14:31:55 +00:00
parent 3000820cdb
commit 2f57ce5ac4
26 changed files with 182 additions and 0 deletions

View File

@ -81,6 +81,13 @@ public class WorldRegion
mob.clearAggroList();
mob.getAttackByList().clear();
// Teleport to spawn when too far away.
final Spawn spawn = mob.getSpawn();
if ((spawn != null) && (mob.calculateDistance2D(spawn) > Config.MAX_DRIFT_RANGE))
{
mob.teleToLocation(spawn);
}
// Stop the AI tasks.
if (mob.hasAI())
{