forked from MagicBane/Server
setLoc now handles region assignment
This commit is contained in:
@@ -983,8 +983,16 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
|
||||
@Override
|
||||
public final void setLoc(final Vector3fImmutable value) {
|
||||
super.setLoc(value); // set the location in the world
|
||||
this.resetLastSetLocUpdate();
|
||||
Regions region = Regions.GetRegionForTeleport(value);
|
||||
if(region != null){
|
||||
this.region = region;
|
||||
Vector3fImmutable newValue = new Vector3fImmutable(value.x,region.lerpY(this),value.z);
|
||||
super.setLoc(newValue); // set the location in the world
|
||||
this.resetLastSetLocUpdate();
|
||||
} else {
|
||||
super.setLoc(value); // set the location in the world
|
||||
this.resetLastSetLocUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3fImmutable getMovementLoc() {
|
||||
|
||||
@@ -610,9 +610,6 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
||||
this.movingUp = movingUp;
|
||||
}
|
||||
|
||||
public void setRegion(Regions region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
//used for interestmanager loading and unloading objects to client.
|
||||
// if not in grid, unload from player.
|
||||
|
||||
@@ -841,13 +841,11 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
if (newLoc.equals(this.getEndLoc())) {
|
||||
this.stopMovement(newLoc);
|
||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
||||
return;
|
||||
//Next upda
|
||||
}
|
||||
|
||||
setLoc(newLoc);
|
||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
||||
//Next update will be end Loc, lets stop him here.
|
||||
|
||||
}
|
||||
@@ -971,8 +969,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
if (this.building == null && this.guardCaptain != null && ((Mob) this.guardCaptain).behaviourType.equals(MobBehaviourType.GuardCaptain))
|
||||
this.building = this.guardCaptain.building;
|
||||
else if (this.building != null)
|
||||
this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);
|
||||
|
||||
this.loadInventory();
|
||||
|
||||
|
||||
@@ -4888,12 +4888,10 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
if (this.isAlive() == false || this.getBonuses().getBool(ModType.Stunned, SourceType.None) || this.getBonuses().getBool(ModType.CannotMove, SourceType.None)) {
|
||||
//Target is stunned or rooted. Don't move
|
||||
this.stopMovement(newLoc);
|
||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
||||
return;
|
||||
}
|
||||
if (newLoc.equals(this.getEndLoc())) {
|
||||
this.stopMovement(newLoc);
|
||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
||||
if (this.getDebug(1))
|
||||
ChatManager.chatSystemInfo(this,
|
||||
"Arrived at End location. " + this.getEndLoc());
|
||||
@@ -4902,7 +4900,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
|
||||
setLoc(newLoc);
|
||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
||||
|
||||
if (this.getDebug(1))
|
||||
ChatManager.chatSystemInfo(this,
|
||||
|
||||
Reference in New Issue
Block a user