public boolean addToRoom(Room room) { if (room.getSystem() != null && room.getSystem().canMann() && !room.getSystem().isManned()) { int x = room.getSystem().getStationX(); int y = room.getSystem().getStationY(); System.out.println("adding crew at " + x + " " + y); setPosition(room, x, y); state = CrewStates.MANNING; room.getSystem().mann(this); return true; } for (int tileX = 0; tileX < room.getWidth(); tileX++) { for (int tileY = room.getHeight() - 1; tileY >= 0; tileY--) { Tile tile = room.getTile(tileX, tileY); if (!tile.getProperties().containsValue("crew")) { setPosition(room, tileX, tileY); return true; } } } return false; }