Duplicate region field removed and inlined.
This commit is contained in:
@@ -60,7 +60,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
||||
protected GridObjectType gridObjectType;
|
||||
|
||||
protected float altitude = 0;
|
||||
protected Regions region;
|
||||
public Regions region;
|
||||
protected boolean movingUp = false;
|
||||
public Regions landingRegion = null;
|
||||
public Vector3fImmutable lastLoc = Vector3fImmutable.ZERO;
|
||||
@@ -608,10 +608,6 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
||||
return gridObjectType;
|
||||
}
|
||||
|
||||
public Regions getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
|
||||
public boolean isMovingUp() {
|
||||
return movingUp;
|
||||
|
||||
@@ -90,7 +90,6 @@ public class NPC extends AbstractCharacter {
|
||||
private String nameOverride = "";
|
||||
private int equipmentSetID = 0;
|
||||
public int runeSetID = 0;
|
||||
public Regions region = null;
|
||||
|
||||
private int repairCost = 5;
|
||||
public int extraRune2 = 0;
|
||||
|
||||
@@ -2054,17 +2054,17 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
writer.putInt(playerCharacter.getHeadlightsAsInt());
|
||||
|
||||
|
||||
if (playerCharacter.getRegion() != null && !loginData){
|
||||
Building building = Regions.GetBuildingForRegion(playerCharacter.getRegion());
|
||||
|
||||
if (building == null){
|
||||
if (playerCharacter.region != null && !loginData) {
|
||||
Building building = Regions.GetBuildingForRegion(playerCharacter.region);
|
||||
|
||||
if (building == null) {
|
||||
writer.putInt(0);
|
||||
writer.putInt(0);
|
||||
}else{
|
||||
} else {
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(building.getObjectUUID());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
writer.putInt(0);
|
||||
|
||||
@@ -216,42 +216,42 @@ public class Regions {
|
||||
|
||||
public static boolean CanEnterRegion(AbstractWorldObject worldObject, Regions toEnter){
|
||||
|
||||
if (worldObject.getRegion() == null)
|
||||
if (worldObject.region == null)
|
||||
if (toEnter.level == 0 || toEnter.room == -1 || toEnter.exit)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
if (worldObject.getRegion().equals(toEnter))
|
||||
|
||||
if (worldObject.region.equals(toEnter))
|
||||
return true;
|
||||
|
||||
if (worldObject.getRegion().level == toEnter.level)
|
||||
if (worldObject.region.level == toEnter.level)
|
||||
return true;
|
||||
|
||||
|
||||
//next region is stairs, if they are on the same level as stairs or 1 up, world object can enter.
|
||||
if (toEnter.stairs)
|
||||
if (worldObject.getRegion().level == toEnter.level || toEnter.level - 1 == worldObject.getRegion().level)
|
||||
if (toEnter.stairs)
|
||||
if (worldObject.region.level == toEnter.level || toEnter.level - 1 == worldObject.region.level)
|
||||
return true;
|
||||
if (worldObject.getRegion().stairs){
|
||||
|
||||
if (worldObject.region.stairs) {
|
||||
|
||||
boolean movingUp = false;
|
||||
|
||||
|
||||
boolean movingDown = false;
|
||||
float yLerp = worldObject.getRegion().lerpY(worldObject);
|
||||
|
||||
if (yLerp == (worldObject.getRegion().highLerp.y))
|
||||
float yLerp = worldObject.region.lerpY(worldObject);
|
||||
|
||||
if (yLerp == (worldObject.region.highLerp.y))
|
||||
movingUp = true;
|
||||
else if (yLerp == (worldObject.getRegion().lowLerp.y))
|
||||
movingDown = true;
|
||||
else if (yLerp == (worldObject.region.lowLerp.y))
|
||||
movingDown = true;
|
||||
//Stairs are always considered on the bottom floor.
|
||||
|
||||
|
||||
if (movingUp){
|
||||
if(toEnter.level == worldObject.getRegion().level + 1)
|
||||
return true;
|
||||
}else if (movingDown)
|
||||
if (toEnter.level == worldObject.getRegion().level)
|
||||
return true;
|
||||
if (movingUp) {
|
||||
if (toEnter.level == worldObject.region.level + 1)
|
||||
return true;
|
||||
} else if (movingDown)
|
||||
if (toEnter.level == worldObject.region.level)
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user