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
|
@Override
|
||||||
public final void setLoc(final Vector3fImmutable value) {
|
public final void setLoc(final Vector3fImmutable value) {
|
||||||
super.setLoc(value); // set the location in the world
|
Regions region = Regions.GetRegionForTeleport(value);
|
||||||
this.resetLastSetLocUpdate();
|
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() {
|
public Vector3fImmutable getMovementLoc() {
|
||||||
|
|||||||
@@ -610,9 +610,6 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
|||||||
this.movingUp = movingUp;
|
this.movingUp = movingUp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegion(Regions region) {
|
|
||||||
this.region = region;
|
|
||||||
}
|
|
||||||
|
|
||||||
//used for interestmanager loading and unloading objects to client.
|
//used for interestmanager loading and unloading objects to client.
|
||||||
// if not in grid, unload from player.
|
// if not in grid, unload from player.
|
||||||
|
|||||||
@@ -841,13 +841,11 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
if (newLoc.equals(this.getEndLoc())) {
|
if (newLoc.equals(this.getEndLoc())) {
|
||||||
this.stopMovement(newLoc);
|
this.stopMovement(newLoc);
|
||||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
|
||||||
return;
|
return;
|
||||||
//Next upda
|
//Next upda
|
||||||
}
|
}
|
||||||
|
|
||||||
setLoc(newLoc);
|
setLoc(newLoc);
|
||||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
|
||||||
//Next update will be end Loc, lets stop him here.
|
//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))
|
if (this.building == null && this.guardCaptain != null && ((Mob) this.guardCaptain).behaviourType.equals(MobBehaviourType.GuardCaptain))
|
||||||
this.building = this.guardCaptain.building;
|
this.building = this.guardCaptain.building;
|
||||||
else if (this.building != null)
|
|
||||||
this.region = BuildingManager.GetRegion(this.building, bindLoc.x, bindLoc.y, bindLoc.z);
|
|
||||||
|
|
||||||
this.loadInventory();
|
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)) {
|
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
|
//Target is stunned or rooted. Don't move
|
||||||
this.stopMovement(newLoc);
|
this.stopMovement(newLoc);
|
||||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (newLoc.equals(this.getEndLoc())) {
|
if (newLoc.equals(this.getEndLoc())) {
|
||||||
this.stopMovement(newLoc);
|
this.stopMovement(newLoc);
|
||||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
|
||||||
if (this.getDebug(1))
|
if (this.getDebug(1))
|
||||||
ChatManager.chatSystemInfo(this,
|
ChatManager.chatSystemInfo(this,
|
||||||
"Arrived at End location. " + this.getEndLoc());
|
"Arrived at End location. " + this.getEndLoc());
|
||||||
@@ -4902,7 +4900,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setLoc(newLoc);
|
setLoc(newLoc);
|
||||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
|
||||||
|
|
||||||
if (this.getDebug(1))
|
if (this.getDebug(1))
|
||||||
ChatManager.chatSystemInfo(this,
|
ChatManager.chatSystemInfo(this,
|
||||||
|
|||||||
Reference in New Issue
Block a user