Player is now floating between dimensions if the exit of the other stargate is blocked
also fixes #7
This commit is contained in:
parent
d64fb27413
commit
6700c33b8d
@ -59,7 +59,9 @@ public class Stargate {
|
|||||||
return isSpawned;
|
return isSpawned;
|
||||||
}
|
}
|
||||||
public boolean isOpen() {
|
public boolean isOpen() {
|
||||||
return isSpawned & other.isSpawned;
|
if(isSpawned & other.isSpawned)
|
||||||
|
return other.getCurrentWall().getAdjacentTile(other.getExitDirection()).isSteppable();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Direction getExitDirection() {
|
private Direction getExitDirection() {
|
||||||
@ -69,6 +71,8 @@ public class Stargate {
|
|||||||
public void teleport(PlayerBase player) {
|
public void teleport(PlayerBase player) {
|
||||||
if(isOpen())
|
if(isOpen())
|
||||||
player.setCurrentTile(other.getCurrentWall().getAdjacentTile(other.getExitDirection()));
|
player.setCurrentTile(other.getCurrentWall().getAdjacentTile(other.getExitDirection()));
|
||||||
|
else
|
||||||
|
player.setCurrentTile(this.getCurrentWall());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,6 +44,7 @@ public class Wall extends Tile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onExit(PlayerBase playerBase) throws IllegalStateException {
|
public void onExit(PlayerBase playerBase) throws IllegalStateException {
|
||||||
|
if(sg != null) return;
|
||||||
throw new IllegalStateException("Hiba! Te hogy kerültél a falba?");
|
throw new IllegalStateException("Hiba! Te hogy kerültél a falba?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user