Skip to content

Commit

Permalink
Fixed sector generate producing inconsistent results
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Dec 14, 2024
1 parent 30328e6 commit fc5b508
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions core/src/mindustry/editor/SectorGenerateDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ void apply(){
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;
Expand Down
10 changes: 6 additions & 4 deletions core/src/mindustry/maps/generators/BaseGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,12 @@ public static boolean tryPlace(BasePart part, int x, int y, Team team, Rand rand
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;
}
}
}

Expand Down

0 comments on commit fc5b508

Please sign in to comment.