v0.6.1: rooms can now specify whether they allow grass or water separately
This commit is contained in:
parent
d407144e28
commit
886b597eea
|
@ -252,7 +252,7 @@ public abstract class RegularPainter extends Painter {
|
||||||
|
|
||||||
if (!rooms.isEmpty()){
|
if (!rooms.isEmpty()){
|
||||||
for (Room r : rooms){
|
for (Room r : rooms){
|
||||||
for (Point p : r.terrainModifiablePoints()){
|
for (Point p : r.waterPlaceablePoints()){
|
||||||
int i = l.pointToCell(p);
|
int i = l.pointToCell(p);
|
||||||
if (lake[i] && l.map[i] == Terrain.EMPTY){
|
if (lake[i] && l.map[i] == Terrain.EMPTY){
|
||||||
l.map[i] = Terrain.WATER;
|
l.map[i] = Terrain.WATER;
|
||||||
|
@ -276,7 +276,7 @@ public abstract class RegularPainter extends Painter {
|
||||||
|
|
||||||
if (!rooms.isEmpty()){
|
if (!rooms.isEmpty()){
|
||||||
for (Room r : rooms){
|
for (Room r : rooms){
|
||||||
for (Point p : r.terrainModifiablePoints()){
|
for (Point p : r.grassPlaceablePoints()){
|
||||||
int i = l.pointToCell(p);
|
int i = l.pointToCell(p);
|
||||||
if (grass[i] && l.map[i] == Terrain.EMPTY){
|
if (grass[i] && l.map[i] == Terrain.EMPTY){
|
||||||
grassCells.add(i);
|
grassCells.add(i);
|
||||||
|
|
|
@ -264,16 +264,32 @@ public class Room extends Rect implements Graph.Node, Bundlable {
|
||||||
public void paint(Level level){}
|
public void paint(Level level){}
|
||||||
|
|
||||||
//whether or not a painter can make its own modifications to a specific point
|
//whether or not a painter can make its own modifications to a specific point
|
||||||
public boolean canModifyTerrain(Point p){
|
public boolean canPlaceWater(Point p){
|
||||||
return inside(p);
|
return inside(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final ArrayList<Point> terrainModifiablePoints(){
|
public final ArrayList<Point> waterPlaceablePoints(){
|
||||||
ArrayList<Point> points = new ArrayList<>();
|
ArrayList<Point> points = new ArrayList<>();
|
||||||
for (int i = left; i <= right; i++) {
|
for (int i = left; i <= right; i++) {
|
||||||
for (int j = top; j <= bottom; j++) {
|
for (int j = top; j <= bottom; j++) {
|
||||||
Point p = new Point(i, j);
|
Point p = new Point(i, j);
|
||||||
if (canModifyTerrain(p)) points.add(p);
|
if (canPlaceWater(p)) points.add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
//whether or not a painter can make place grass at a specific point
|
||||||
|
public boolean canPlaceGrass(Point p){
|
||||||
|
return inside(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final ArrayList<Point> grassPlaceablePoints(){
|
||||||
|
ArrayList<Point> points = new ArrayList<>();
|
||||||
|
for (int i = left; i <= right; i++) {
|
||||||
|
for (int j = top; j <= bottom; j++) {
|
||||||
|
Point p = new Point(i, j);
|
||||||
|
if (canPlaceGrass(p)) points.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return points;
|
return points;
|
||||||
|
|
|
@ -82,10 +82,15 @@ public class BurnedRoom extends PatchRoom {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canModifyTerrain(Point p) {
|
public boolean canPlaceWater(Point p) {
|
||||||
return super.canModifyTerrain(p) && !patch[xyToPatchCoords(p.x, p.y)];
|
return super.canPlaceWater(p) && !patch[xyToPatchCoords(p.x, p.y)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPlaceGrass(Point p) {
|
||||||
|
return super.canPlaceGrass(p) && !patch[xyToPatchCoords(p.x, p.y)];
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceTrap(Point p) {
|
public boolean canPlaceTrap(Point p) {
|
||||||
return super.canPlaceTrap(p) && !patch[xyToPatchCoords(p.x, p.y)];
|
return super.canPlaceTrap(p) && !patch[xyToPatchCoords(p.x, p.y)];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user