|
|
@ -216,41 +216,41 @@ public class Regions { |
|
|
|
|
|
|
|
|
|
|
|
public static boolean CanEnterRegion(AbstractWorldObject worldObject, Regions toEnter){ |
|
|
|
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) |
|
|
|
if (toEnter.level == 0 || toEnter.room == -1 || toEnter.exit) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
else |
|
|
|
else |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if (worldObject.getRegion().equals(toEnter)) |
|
|
|
if (worldObject.region.equals(toEnter)) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
if (worldObject.getRegion().level == toEnter.level) |
|
|
|
if (worldObject.region.level == toEnter.level) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
//next region is stairs, if they are on the same level as stairs or 1 up, world object can enter.
|
|
|
|
//next region is stairs, if they are on the same level as stairs or 1 up, world object can enter.
|
|
|
|
if (toEnter.stairs) |
|
|
|
if (toEnter.stairs) |
|
|
|
if (worldObject.getRegion().level == toEnter.level || toEnter.level - 1 == worldObject.getRegion().level) |
|
|
|
if (worldObject.region.level == toEnter.level || toEnter.level - 1 == worldObject.region.level) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
if (worldObject.getRegion().stairs){ |
|
|
|
if (worldObject.region.stairs) { |
|
|
|
|
|
|
|
|
|
|
|
boolean movingUp = false; |
|
|
|
boolean movingUp = false; |
|
|
|
|
|
|
|
|
|
|
|
boolean movingDown = false; |
|
|
|
boolean movingDown = false; |
|
|
|
float yLerp = worldObject.getRegion().lerpY(worldObject); |
|
|
|
float yLerp = worldObject.region.lerpY(worldObject); |
|
|
|
|
|
|
|
|
|
|
|
if (yLerp == (worldObject.getRegion().highLerp.y)) |
|
|
|
if (yLerp == (worldObject.region.highLerp.y)) |
|
|
|
movingUp = true; |
|
|
|
movingUp = true; |
|
|
|
else if (yLerp == (worldObject.getRegion().lowLerp.y)) |
|
|
|
else if (yLerp == (worldObject.region.lowLerp.y)) |
|
|
|
movingDown = true; |
|
|
|
movingDown = true; |
|
|
|
//Stairs are always considered on the bottom floor.
|
|
|
|
//Stairs are always considered on the bottom floor.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (movingUp) { |
|
|
|
if (movingUp) { |
|
|
|
if(toEnter.level == worldObject.getRegion().level + 1) |
|
|
|
if (toEnter.level == worldObject.region.level + 1) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} else if (movingDown) |
|
|
|
} else if (movingDown) |
|
|
|
if (toEnter.level == worldObject.getRegion().level) |
|
|
|
if (toEnter.level == worldObject.region.level) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|