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;
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;

View File

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