region support for teleporting

This commit is contained in:
2023-07-22 12:44:59 -05:00
parent 53bae6e34f
commit 8a8bf8d2f9
2 changed files with 6 additions and 3 deletions
+4 -2
View File
@@ -535,9 +535,10 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
} }
public static void teleport(AbstractCharacter worldObject, final Vector3fImmutable targetLoc) { public static void teleport(AbstractCharacter worldObject, final Vector3fImmutable targetLoc) {
Regions targetRegion = Regions.GetRegionForTeleport(targetLoc);
worldObject.locationLock.writeLock().lock(); worldObject.locationLock.writeLock().lock();
try { try {
MovementManager.translocate(worldObject, targetLoc, null); MovementManager.translocate(worldObject, targetLoc, targetRegion);
if (worldObject.getObjectType().equals(GameObjectType.PlayerCharacter)) if (worldObject.getObjectType().equals(GameObjectType.PlayerCharacter))
InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter) worldObject); InterestManager.INTERESTMANAGER.HandleLoadForTeleport((PlayerCharacter) worldObject);
} catch (Exception e) { } catch (Exception e) {
@@ -1466,9 +1467,10 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
} }
public void teleport(final Vector3fImmutable targetLoc) { public void teleport(final Vector3fImmutable targetLoc) {
Regions targetRegion = Regions.GetRegionForTeleport(targetLoc);
locationLock.writeLock().lock(); locationLock.writeLock().lock();
try { try {
MovementManager.translocate(this, targetLoc, null); MovementManager.translocate(this, targetLoc, targetRegion);
MovementManager.sendRWSSMsg(this); MovementManager.sendRWSSMsg(this);
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
+2 -1
View File
@@ -5502,9 +5502,10 @@ public class PlayerCharacter extends AbstractCharacter {
@Override @Override
public final void teleport(final Vector3fImmutable targetLoc) { public final void teleport(final Vector3fImmutable targetLoc) {
Regions targetRegion = Regions.GetRegionForTeleport(targetLoc);
locationLock.writeLock().lock(); locationLock.writeLock().lock();
try { try {
MovementManager.translocate(this, targetLoc, null); MovementManager.translocate(this, targetLoc, targetRegion);
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
} finally { } finally {