forked from MagicBane/Server
region assignment in AbstractCharacter.setLoc
This commit is contained in:
@@ -12,6 +12,7 @@ package engine.objects;
|
||||
import engine.Enum;
|
||||
import engine.Enum.*;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.Terrain;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.gameManager.*;
|
||||
@@ -985,11 +986,22 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
@Override
|
||||
public final void setLoc(final Vector3fImmutable value) {
|
||||
Regions region = Regions.GetRegionForTeleport(value);
|
||||
float regionHeightOffset = 0;
|
||||
if(region != null){
|
||||
this.region = region;
|
||||
regionHeightOffset = region.lerpY(this);
|
||||
this.inBuilding = region.level; // -1 not in building 0 on ground floor, 1 on first floor etc
|
||||
this.inBuildingID = region.parentBuildingID;
|
||||
this.inFloorID = region.room;
|
||||
} else {
|
||||
this.region = null;
|
||||
this.inBuilding = -1;
|
||||
this.inBuildingID = 0;
|
||||
this.inFloorID = -1;
|
||||
}
|
||||
|
||||
super.setLoc(value); // set the location in the world
|
||||
float terrainHeight = Terrain.getWorldHeight(value);
|
||||
Vector3fImmutable finalLocation = new Vector3fImmutable(value.x,terrainHeight + regionHeightOffset, value.z);
|
||||
super.setLoc(finalLocation); // set the location in the world
|
||||
this.resetLastSetLocUpdate();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user