Better pacing method for revalidate zones.
This commit is contained in:
@@ -227,7 +227,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
private boolean _allSkillsDisabled;
|
||||
|
||||
private final byte[] _zones = new byte[ZoneId.getZoneCount()];
|
||||
protected byte _zoneValidateCounter = 4;
|
||||
protected final Location _lastZoneValidateLocation = new Location(getX(), getY(), getZ());
|
||||
|
||||
private final StampedLock _attackLock = new StampedLock();
|
||||
|
||||
@@ -4073,23 +4073,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
|
||||
public void revalidateZone(boolean force)
|
||||
{
|
||||
// This function is called too often from movement code
|
||||
if (force)
|
||||
// This function is called too often from movement code.
|
||||
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < (isNpc() && !isInCombat() ? Config.MAX_DRIFT_RANGE : 100)))
|
||||
{
|
||||
_zoneValidateCounter = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
_zoneValidateCounter--;
|
||||
if (_zoneValidateCounter < 0)
|
||||
{
|
||||
_zoneValidateCounter = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
_lastZoneValidateLocation.setXYZ(this);
|
||||
|
||||
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
|
||||
if (region != null)
|
||||
|
@@ -1701,23 +1701,12 @@ public class PlayerInstance extends Playable
|
||||
return;
|
||||
}
|
||||
|
||||
// This function is called too often from movement code
|
||||
if (force)
|
||||
// This function is called too often from movement code.
|
||||
if (!force && (calculateDistance3D(_lastZoneValidateLocation) < 100))
|
||||
{
|
||||
_zoneValidateCounter = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
_zoneValidateCounter--;
|
||||
if (_zoneValidateCounter < 0)
|
||||
{
|
||||
_zoneValidateCounter = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
_lastZoneValidateLocation.setXYZ(this);
|
||||
|
||||
ZoneManager.getInstance().getRegion(this).revalidateZones(this);
|
||||
|
||||
|
Reference in New Issue
Block a user