Browse Source

setLoc now handles region assignment

feature-region-set
FatBoy-DOTC 1 year ago
parent
commit
847e62dd27
  1. 12
      src/engine/objects/AbstractCharacter.java
  2. 3
      src/engine/objects/AbstractWorldObject.java
  3. 4
      src/engine/objects/Mob.java
  4. 3
      src/engine/objects/PlayerCharacter.java

12
src/engine/objects/AbstractCharacter.java

@ -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() {

3
src/engine/objects/AbstractWorldObject.java

@ -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.

4
src/engine/objects/Mob.java

@ -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();

3
src/engine/objects/PlayerCharacter.java

@ -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,

Loading…
Cancel
Save