♻️ Optimizations of the various system

🍱 Retexture of the enemy portal
This commit is contained in:
2025-08-31 18:26:45 +08:00
parent 09511b37c9
commit b424aafeab
16 changed files with 497 additions and 399 deletions

View File

@@ -55,15 +55,15 @@ public partial class NaturalResourceGenerator : Node2D
return;
}
// Test if enemy_nest is in the registry
var testBuilding = Registry.GetBuilding("enemy_nest");
// Test if enemy_portal is in the registry
var testBuilding = Registry.GetBuilding("enemy_portal");
if (testBuilding == null)
{
GD.PrintErr($"{LogPrefix} 'enemy_nest' is not found in BuildingRegistry!");
GD.PrintErr($"{LogPrefix} 'enemy_portal' is not found in BuildingRegistry!");
}
else
{
GD.Print($"{LogPrefix} Found enemy_nest in registry!");
GD.Print($"{LogPrefix} Found enemy_portal in registry!");
}
GD.Print($"{LogPrefix} NaturalResourceGenerator ready, SpawnEnemyNest = {SpawnEnemyNest}");
@@ -287,9 +287,9 @@ public partial class NaturalResourceGenerator : Node2D
// Remove all tiles in this chunk
var chunkWorldPos = ChunkToWorldCoords(chunkPos);
for (int x = 0; x < ChunkSize; x++)
for (var x = 0; x < ChunkSize; x++)
{
for (int y = 0; y < ChunkSize; y++)
for (var y = 0; y < ChunkSize; y++)
{
var cell = new Vector2I(chunkWorldPos.X + x, chunkWorldPos.Y + y);
// Free a 1x1 area for each cell
@@ -416,7 +416,7 @@ public partial class NaturalResourceGenerator : Node2D
while (attempts < maxAttempts)
{
if (PlaceTile("enemy_nest", nestPosition))
if (PlaceTile("enemy_portal", nestPosition))
{
GD.Print($"{LogPrefix} Placed enemy nest at {nestPosition}");
return;