Fixed sector generate producing inconsistent results
Some checks failed
Validate Gradle Wrapper / Validation (push) Successful in 1m3s
Tests / runPush (push) Failing after 1m33s

This commit is contained in:
Anuken 2024-12-14 15:06:06 -05:00
parent 30328e61a5
commit fc5b50822e
2 changed files with 7 additions and 4 deletions

View File

@ -93,6 +93,7 @@ public class SectorGenerateDialog extends BaseDialog{
var preset = sectorobj.preset; var preset = sectorobj.preset;
sectorobj.preset = null; 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); world.loadSector(sectorobj, seed, false);
sectorobj.preset = preset; sectorobj.preset = preset;

View File

@ -209,10 +209,12 @@ public class BaseGenerator{
int cx = x - (int)rotator.x; int cx = x - (int)rotator.x;
int cy = y - (int)rotator.y; int cy = y - (int)rotator.y;
for(Stile tile : result.tiles){ if(!insanity){
int realX = tile.x + cx, realY = tile.y + cy; for(Stile tile : result.tiles){
if(!insanity && isTaken(tile.block, realX, realY)){ int realX = tile.x + cx, realY = tile.y + cy;
return false; if(isTaken(tile.block, realX, realY)){
return false;
}
} }
} }