From c794cb9fee7545871bbf039a012255336b1e4bed Mon Sep 17 00:00:00 2001 From: Player Name Date: Sat, 27 Jun 2026 15:44:46 +0200 Subject: [PATCH] Improve vinesweeper hole restoration --- .../minigame/vinesweeper/Vinesweeper.kt | 9 ++++++- .../main/core/game/world/map/RegionChunk.java | 24 +++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Server/src/main/content/minigame/vinesweeper/Vinesweeper.kt b/Server/src/main/content/minigame/vinesweeper/Vinesweeper.kt index d4461b424..7d3fec4a0 100644 --- a/Server/src/main/content/minigame/vinesweeper/Vinesweeper.kt +++ b/Server/src/main/content/minigame/vinesweeper/Vinesweeper.kt @@ -665,7 +665,14 @@ class VinesweeperNPC : AbstractNPC { 1 -> { animate(Animation(Animations.GNOME_FARMER_SPADE_SMACK_8732)) sendChat(FARMER_FLAG_LINES.DEAD_PLANT.line) - SceneryBuilder.replace(scenery, scenery.transform(HOLES[0])) + var originalHoleId = HOLES[0] + for (obj in scenery.location.chunk.getStatObjects(scenery.location.chunkOffsetX, scenery.location.chunkOffsetY)) { + if (obj?.id != null) { + originalHoleId = obj.id + break + } + } + SceneryBuilder.replace(scenery, scenery.transform(originalHoleId)) } 2 -> { animate(Animation(Animations.GNOME_FARMER_CLEAR_HOLES_8724)) diff --git a/Server/src/main/core/game/world/map/RegionChunk.java b/Server/src/main/core/game/world/map/RegionChunk.java index cf406ffca..111ce88b8 100644 --- a/Server/src/main/core/game/world/map/RegionChunk.java +++ b/Server/src/main/core/game/world/map/RegionChunk.java @@ -509,15 +509,29 @@ public class RegionChunk { } /** - * Gets the sceneries located on the coordinates in this chunk. - * @param chunkX The chunk x-coordinate (0-7). - * @param chunkY The chunk y-coordinate (0-7). + * Gets the dynamic sceneries located on the coordinates in this chunk. + * @param chunkOffsetX The x coordinate within the chunk (0-7). + * @param chunkOffsetY The y coordinate within the chunk (0-7). * @return The objects. */ - public Scenery[] getObjects(int chunkX, int chunkY) { + public Scenery[] getObjects(int chunkOffsetX, int chunkOffsetY) { Scenery[] result = new Scenery[ARRAY_SIZE]; for (int i = 0; i < objects.length; i++) { - result[i] = objects[i][chunkX][chunkY]; + result[i] = objects[i][chunkOffsetX][chunkOffsetY]; + } + return result; + } + + /** + * Gets the static sceneries located on the coordinates in this chunk. + * @param chunkOffsetX The x coordinate within the chunk (0-7). + * @param chunkOffsetY The y coordinate within the chunk (0-7). + * @return The objects. + */ + public Scenery[] getStatObjects(int chunkOffsetX, int chunkOffsetY) { + Scenery[] result = new Scenery[ARRAY_SIZE]; + for (int i = 0; i < statObjects.length; i++) { + result[i] = statObjects[i][chunkOffsetX][chunkOffsetY]; } return result; }