Big project cleanup with overhaul of file responsibilities (KISS) and code (DRY, YAGNI)

This commit is contained in:
2026-05-14 11:17:02 +02:00
parent bd6cdeb97b
commit 300c8f5a42
54 changed files with 2030 additions and 1745 deletions
+4 -9
View File
@@ -16,7 +16,7 @@ public partial class Layer : Node3D
public Vector2I gateCoordinate;
public List<string> currentResources;
public bool isGateOpen = false;
public List<Ingredient> gateIngredients = new();
public List<Ingredient> gateIngredients = new List<Ingredient>();
public override void _Ready()
{
@@ -125,14 +125,12 @@ public partial class Layer : Node3D
for (int z = 0; z < layerSize; z++)
{
if (x == 0 && z == 0 && level == 0) continue;
if (!IsBorder(x, z))
continue;
if (!IsBorder(x, z)) continue;
Tile tile = tiles[x, z];
List<string> possibilities = GetBorderPossibilities(x, z);
if (possibilities.Count == 0)
continue;
if (possibilities.Count == 0) continue;
tile.Collapse(possibilities[GameData.rand.Next(possibilities.Count)]);
Propagate(new Vector2I(x, z));
@@ -147,7 +145,6 @@ public partial class Layer : Node3D
private void GenerateNecessaryTiles()
{
//Generate spawn only in the first layer
if (level == 0)
{
tiles[0, 0].Collapse("spawn");
@@ -197,9 +194,7 @@ public partial class Layer : Node3D
safetyCounter++;
if (safetyCounter == layerSize * layerSize) return false;
}
if (updateFailed) return false;
if (!WFC.IsMapConnected(tiles, 1f)) return false;
return true;
return !updateFailed && WFC.IsMapConnected(tiles, 1f);
}
private void Propagate(Vector2I startPos)