From 28628a31be362bd6f56b6a7b7e5de85fbb502b14 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 22 Apr 2024 15:56:40 -0400 Subject: [PATCH] v2.4.0: adjusted bridge rooms to not place items/chars in gaps --- .../levels/rooms/standard/BridgeRoom.java | 10 ++++++++++ .../levels/rooms/standard/CavesFissureRoom.java | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/BridgeRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/BridgeRoom.java index 43f90410a..4a72af5c0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/BridgeRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/BridgeRoom.java @@ -51,6 +51,16 @@ public abstract class BridgeRoom extends StandardRoom { return l.map[cell] != spaceTile(); } + @Override + public boolean canPlaceItem(Point p, Level l) { + return super.canPlaceItem(p, l) && !spaceRect.inside(p); + } + + @Override + public boolean canPlaceCharacter(Point p, Level l) { + return super.canPlaceItem(p, l) && !spaceRect.inside(p); + } + //keep these so that subclasses can use them in their methods protected Rect spaceRect; protected Rect bridgeRect; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/CavesFissureRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/CavesFissureRoom.java index e52cc2e60..1c2396387 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/CavesFissureRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/CavesFissureRoom.java @@ -59,6 +59,16 @@ public class CavesFissureRoom extends StandardRoom { } } + @Override + public boolean canPlaceItem(Point p, Level l) { + return super.canPlaceItem(p, l) && l.map[l.pointToCell(p)] != Terrain.EMPTY_SP; + } + + @Override + public boolean canPlaceCharacter(Point p, Level l) { + return super.canPlaceItem(p, l) && l.map[l.pointToCell(p)] != Terrain.EMPTY_SP; + } + @Override public void paint(Level level) {