Added lowest layer to GameDate and Pathfinding. Fixed tile contentNode not being made visible.

This commit is contained in:
2026-05-09 10:07:16 +02:00
parent e00259cd31
commit 892365ff79
6 changed files with 6 additions and 8 deletions
-1
View File
@@ -12,7 +12,6 @@ public class Inventory
Item inventoryItem = items.Find(x => x.data.Id == item.data.Id && x.currentAmount + amount <= x.data.StackSize);
if (inventoryItem != null)
{
GD.Print(items.IndexOf(inventoryItem) + ": " + inventoryItem.currentAmount);
inventoryItem.currentAmount += amount;
return true;
}
+2 -2
View File
@@ -18,7 +18,7 @@ public class ExploreNode : ProgramNode
int safetyCounter = 0;
while (true)
{
targetPosition = new Vector3I(GameData.rand.Next(GameData.layerSize), GameData.currentLayer, GameData.rand.Next(GameData.layerSize));
targetPosition = new Vector3I(GameData.rand.Next(GameData.layerSize), GameData.rand.Next(GameData.lowestLayer), GameData.rand.Next(GameData.layerSize));
if (!GameData.map[targetPosition.Y].tiles[targetPosition.X, targetPosition.Z].wasVisited) break;
safetyCounter++;
if (safetyCounter > Math.Pow(GameData.layerSize, 2) * 2)
@@ -33,7 +33,7 @@ public class ExploreNode : ProgramNode
if (pathPoints.Count <= 0)
{
lastExecutionMessage = "No path available";
lastExecutionMessage = $"No path available {targetPosition}";
return NodeResult.FAILURE;
}
+1
View File
@@ -11,6 +11,7 @@ public partial class GameData
public static int currentLayer = 0;
//The layer that is currently visible
public static int visibleLayer = 0;
public static int lowestLayer = 0;
//Determines if the player can move the camera or not (Necessary for input and options menu)
public static bool canMove = true;
public static int maxRobotCount = 1000;
-1
View File
@@ -50,7 +50,6 @@ public partial class ResearchList : PanelContainer
{
foreach (Research research in GameData.availableResearch.Values)
{
GD.Print(research.state);
GraphNode node = CreateResearchNode(
research.data.Id,
research.data.Texture,
+1
View File
@@ -144,5 +144,6 @@ public partial class Tile
{
wasVisited = true;
OnTileVisited?.Invoke(this, EventArgs.Empty);
ContentNode.Visible = true;
}
}
+1 -3
View File
@@ -47,10 +47,8 @@ public partial class World : Node3D
HandleRenderData(BuildRenderData(0));
//TODO: Remove for live build -> DEBUG ONLY
Robot robot = ResourceLoader.LoadRobotPrefab().Instantiate<Robot>();
robot.Name = $"Robot #{robots.Count + 1}";
robot.Name = "Bob";
robot.Position = map[0].tiles[0, 0].Position;
AddChild(robot);
robots.Add(robot);