From fc5b50822e2f8a18918472e5efaae033f75f7701 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 14 Dec 2024 15:06:06 -0500 Subject: [PATCH] Fixed sector generate producing inconsistent results --- core/src/mindustry/editor/SectorGenerateDialog.java | 1 + core/src/mindustry/maps/generators/BaseGenerator.java | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/editor/SectorGenerateDialog.java b/core/src/mindustry/editor/SectorGenerateDialog.java index f51b55f443..4d0b8bcb37 100644 --- a/core/src/mindustry/editor/SectorGenerateDialog.java +++ b/core/src/mindustry/editor/SectorGenerateDialog.java @@ -93,6 +93,7 @@ public class SectorGenerateDialog extends BaseDialog{ var preset = sectorobj.preset; sectorobj.preset = null; + logic.reset(); //TODO: is this a good idea? all rules and map state are cleared, but it fixes inconsistent gen world.loadSector(sectorobj, seed, false); sectorobj.preset = preset; diff --git a/core/src/mindustry/maps/generators/BaseGenerator.java b/core/src/mindustry/maps/generators/BaseGenerator.java index 013a4575e4..27623957be 100644 --- a/core/src/mindustry/maps/generators/BaseGenerator.java +++ b/core/src/mindustry/maps/generators/BaseGenerator.java @@ -209,10 +209,12 @@ public class BaseGenerator{ int cx = x - (int)rotator.x; int cy = y - (int)rotator.y; - for(Stile tile : result.tiles){ - int realX = tile.x + cx, realY = tile.y + cy; - if(!insanity && isTaken(tile.block, realX, realY)){ - return false; + if(!insanity){ + for(Stile tile : result.tiles){ + int realX = tile.x + cx, realY = tile.y + cy; + if(isTaken(tile.block, realX, realY)){ + return false; + } } }