Light and decorations adjusted. Added all resource and light spawn points

This commit is contained in:
=
2026-04-28 10:48:32 +02:00
parent 92a86c13b7
commit eccaec859f
4 changed files with 8 additions and 7 deletions
Binary file not shown.
+1 -1
View File
@@ -6,7 +6,7 @@ public class Placeholder
public Transform3D transform;
public Placeholder(string name, Transform3D transform){
this.name = name.Split("_")[0];
this.name = name.Split("_")[0].ToLower();
this.transform = transform;
}
}
+4 -5
View File
@@ -77,12 +77,11 @@ public partial class Tile
public void SpawnContent(Dictionary<string, MeshInstance3D> contentMeshes, Transform3D transform, List<Placeholder> placeholders)
{
foreach (Placeholder placeholder in placeholders)
{
if (containsLight && placeholder.name.ToLower() == "light") SpawnLight(contentMeshes["light"], placeholder, transform);
else if (containsResource && placeholder.name.ToLower() == "resource") SpawnResource(contentMeshes["resource"], placeholder, transform);
else if (containsDecoration) SpawnDecorations(contentMeshes, placeholder, transform);
if (containsLight && placeholder.name == "light") SpawnLight(contentMeshes["light"], placeholder, transform);
else if (containsResource && placeholder.name == "resource") SpawnResource(contentMeshes["resource"], placeholder, transform);
else if (containsDecoration && placeholder.name != "light" && placeholder.name != "resource") SpawnDecorations(contentMeshes, placeholder, transform);
}
}
@@ -125,7 +124,7 @@ public partial class Tile
{
foreach (string key in contentMeshes.Keys)
{
if (key.ToLower() != placeholder.name.ToLower()) continue;
if (key.ToLower() != placeholder.name) continue;
MeshInstance3D decoration = new MeshInstance3D
{
Mesh = contentMeshes[key].Mesh,
+3 -1
View File
@@ -141,10 +141,12 @@ public partial class World : Node3D
int posX, posY;
while(currentLight < layerSize * layerSize / 4)
while(currentLight < layerSize * 3)
{
posX = rand.Next(layerSize);
posY = rand.Next(layerSize);
//Skip already placed lights and skip junction and gate as they do not contain lights
if(layer.tiles[posX, posY].collapsedMesh == "junction" || layer.tiles[posX, posY].collapsedMesh == "gate") continue;
if(layer.tiles[posX, posY].containsLight) continue;
layer.tiles[posX, posY].containsLight = true;
currentLight++;