Added more symbols to the game, added gates blocking pathfinding and improved DSL feedback system with enum for better control and UX
This commit is contained in:
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 306 B |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://deuxffyhsrinn"
|
||||||
|
path="res://.godot/imported/EnergySymbol.png-64f11837bac65e727f9268f845f35249.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/EnergySymbol.png"
|
||||||
|
dest_files=["res://.godot/imported/EnergySymbol.png-64f11837bac65e727f9268f845f35249.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 147 B |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b77mo4fhklnja"
|
||||||
|
path="res://.godot/imported/OptionsSymbol.png-6737f7fc496e85a68b0e96b880f46122.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/OptionsSymbol.png"
|
||||||
|
dest_files=["res://.godot/imported/OptionsSymbol.png-6737f7fc496e85a68b0e96b880f46122.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 212 B |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://ban872p4eh4gi"
|
||||||
|
path="res://.godot/imported/RobotSymbol.png-986bd050c59e116c51936dcd370ba5c4.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/RobotSymbol.png"
|
||||||
|
dest_files=["res://.godot/imported/RobotSymbol.png-986bd050c59e116c51936dcd370ba5c4.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 287 B |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dje86ro2e37xl"
|
||||||
|
path="res://.godot/imported/WaterSymbol.png-cfddb36cae72b19ba800831b4972a1c5.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/WaterSymbol.png"
|
||||||
|
dest_files=["res://.godot/imported/WaterSymbol.png-cfddb36cae72b19ba800831b4972a1c5.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
+54
-8
@@ -8,6 +8,10 @@
|
|||||||
[ext_resource type="Script" uid="uid://k6vlo7ulvtep" path="res://Scripts/Robot/RobotList.cs" id="7_2irst"]
|
[ext_resource type="Script" uid="uid://k6vlo7ulvtep" path="res://Scripts/Robot/RobotList.cs" id="7_2irst"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cpq7ppe8bw2bq" path="res://Scenes/Options.tscn" id="8_71axn"]
|
[ext_resource type="PackedScene" uid="uid://cpq7ppe8bw2bq" path="res://Scenes/Options.tscn" id="8_71axn"]
|
||||||
[ext_resource type="Script" uid="uid://fegfbcnlk8p5" path="res://Scripts/WorldGeneration/Map.cs" id="8_bf53h"]
|
[ext_resource type="Script" uid="uid://fegfbcnlk8p5" path="res://Scripts/WorldGeneration/Map.cs" id="8_bf53h"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://deuxffyhsrinn" path="res://Assets/EnergySymbol.png" id="9_71axn"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dje86ro2e37xl" path="res://Assets/WaterSymbol.png" id="10_71axn"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://ban872p4eh4gi" path="res://Assets/RobotSymbol.png" id="11_dahhg"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b77mo4fhklnja" path="res://Assets/OptionsSymbol.png" id="12_3so38"]
|
||||||
|
|
||||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_u44n3"]
|
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_u44n3"]
|
||||||
|
|
||||||
@@ -311,6 +315,48 @@ text = "Exit"
|
|||||||
visible = false
|
visible = false
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
|
||||||
|
[node name="Survival" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI/Content" unique_id=141921319]
|
||||||
|
layout_mode = 1
|
||||||
|
offset_right = 150.0
|
||||||
|
offset_bottom = 23.0
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/Survival" unique_id=1716446061]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="RowEnergy" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/Survival/VBoxContainer" unique_id=867560906]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="CanvasLayer/UIHandler/MainUI/Content/Survival/VBoxContainer/RowEnergy" unique_id=1218525340]
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("9_71axn")
|
||||||
|
expand_mode = 2
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/UIHandler/MainUI/Content/Survival/VBoxContainer/RowEnergy" unique_id=32920400]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Energy: 100/100"
|
||||||
|
fit_content = true
|
||||||
|
autowrap_mode = 0
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="RowWater" type="HBoxContainer" parent="CanvasLayer/UIHandler/MainUI/Content/Survival/VBoxContainer" unique_id=465013052]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="CanvasLayer/UIHandler/MainUI/Content/Survival/VBoxContainer/RowWater" unique_id=1398125603]
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("10_71axn")
|
||||||
|
expand_mode = 2
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/UIHandler/MainUI/Content/Survival/VBoxContainer/RowWater" unique_id=1355787203]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "Water: 100/100"
|
||||||
|
fit_content = true
|
||||||
|
autowrap_mode = 0
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="FooterContainer" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI" unique_id=1495029884]
|
[node name="FooterContainer" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI" unique_id=1495029884]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
@@ -319,14 +365,6 @@ layout_mode = 2
|
|||||||
theme_override_constants/separation = 20
|
theme_override_constants/separation = 20
|
||||||
alignment = 2
|
alignment = 2
|
||||||
|
|
||||||
[node name="Robots" type="Button" parent="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer" unique_id=360269454]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Robots (R)"
|
|
||||||
|
|
||||||
[node name="Options" type="Button" parent="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer" unique_id=293744135]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Options (ESC)"
|
|
||||||
|
|
||||||
[node name="FPS" type="RichTextLabel" parent="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer" unique_id=2029942501]
|
[node name="FPS" type="RichTextLabel" parent="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer" unique_id=2029942501]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
fit_content = true
|
fit_content = true
|
||||||
@@ -337,6 +375,14 @@ layout_mode = 2
|
|||||||
fit_content = true
|
fit_content = true
|
||||||
autowrap_mode = 0
|
autowrap_mode = 0
|
||||||
|
|
||||||
|
[node name="Robots" type="TextureButton" parent="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer" unique_id=1666653447]
|
||||||
|
layout_mode = 2
|
||||||
|
texture_normal = ExtResource("11_dahhg")
|
||||||
|
|
||||||
|
[node name="Options" type="TextureButton" parent="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer" unique_id=1930105751]
|
||||||
|
layout_mode = 2
|
||||||
|
texture_normal = ExtResource("12_3so38")
|
||||||
|
|
||||||
[connection signal="button_up" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Buttons/Clear" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="ClearWindow"]
|
[connection signal="button_up" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Buttons/Clear" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="ClearWindow"]
|
||||||
[connection signal="button_up" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Buttons/Compile" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="CompileProgram"]
|
[connection signal="button_up" from="CanvasLayer/UIHandler/MainUI/Content/CodingWindow/VBoxContainer/Scripting/EditorWindow/Buttons/Compile" to="CanvasLayer/UIHandler/MainUI/Content/CodingWindow" method="CompileProgram"]
|
||||||
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/Menu/VBoxContainer/Button" to="CanvasLayer/UIHandler" method="HandleMenu"]
|
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/Menu/VBoxContainer/Button" to="CanvasLayer/UIHandler" method="HandleMenu"]
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
public enum NodeResult
|
||||||
|
{
|
||||||
|
SUCCESS,
|
||||||
|
FAILURE,
|
||||||
|
RUNNING
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dpp7ycquabyq8
|
||||||
@@ -6,7 +6,7 @@ public class CraftNode : ProgramNode
|
|||||||
{
|
{
|
||||||
DisplayText = "Craft";
|
DisplayText = "Craft";
|
||||||
}
|
}
|
||||||
public override bool Execute(Robot robot, double delta)
|
public override NodeResult Execute(Robot robot, double delta)
|
||||||
{
|
{
|
||||||
GD.Print("Craft");
|
GD.Print("Craft");
|
||||||
if (nextNode != null)
|
if (nextNode != null)
|
||||||
@@ -15,7 +15,7 @@ public class CraftNode : ProgramNode
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return true;
|
return NodeResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ public class HarvestNode : ProgramNode
|
|||||||
{
|
{
|
||||||
DisplayText = "Harvest";
|
DisplayText = "Harvest";
|
||||||
}
|
}
|
||||||
public override bool Execute(Robot robot, double delta)
|
public override NodeResult Execute(Robot robot, double delta)
|
||||||
{
|
{
|
||||||
GD.Print("Harvest");
|
GD.Print("Harvest");
|
||||||
if (nextNode != null)
|
if (nextNode != null)
|
||||||
@@ -15,7 +15,7 @@ public class HarvestNode : ProgramNode
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return true;
|
return NodeResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,14 @@ public class MoveNode : ProgramNode
|
|||||||
{
|
{
|
||||||
DisplayText = "Move";
|
DisplayText = "Move";
|
||||||
}
|
}
|
||||||
public override bool Execute(Robot robot, double delta)
|
public override NodeResult Execute(Robot robot, double delta)
|
||||||
{
|
{
|
||||||
pathPoints ??= [.. Pathfinding.GetPath(Pathfinding.GetClosestStartPoint(robot.Position), targetPosition)];
|
pathPoints ??= [.. Pathfinding.GetPath(Pathfinding.GetClosestStartPoint(robot.Position), targetPosition)];
|
||||||
|
if (pathPoints.Count <= 0)
|
||||||
|
{
|
||||||
|
lastExecutionMessage = "No path available";
|
||||||
|
return NodeResult.FAILURE;
|
||||||
|
}
|
||||||
startPosition = robot.Position;
|
startPosition = robot.Position;
|
||||||
Vector3 target = pathPoints[0] - startPosition;
|
Vector3 target = pathPoints[0] - startPosition;
|
||||||
float distance = target.Length();
|
float distance = target.Length();
|
||||||
@@ -32,11 +36,12 @@ public class MoveNode : ProgramNode
|
|||||||
pathPoints.Remove(pathPoints[0]);
|
pathPoints.Remove(pathPoints[0]);
|
||||||
if (pathPoints.Count <= 0)
|
if (pathPoints.Count <= 0)
|
||||||
{
|
{
|
||||||
pathPoints = null;
|
lastExecutionMessage = "";
|
||||||
return true;
|
return NodeResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
lastExecutionMessage = "";
|
||||||
|
return NodeResult.RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 direction = target / distance;
|
Vector3 direction = target / distance;
|
||||||
@@ -47,14 +52,12 @@ public class MoveNode : ProgramNode
|
|||||||
}
|
}
|
||||||
robot.GlobalPosition += direction * (float)delta * GameData.robotSpeed;
|
robot.GlobalPosition += direction * (float)delta * GameData.robotSpeed;
|
||||||
|
|
||||||
return false;
|
return NodeResult.RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ReadParameters(NodeDisplay display)
|
public override void ReadParameters(NodeDisplay display)
|
||||||
{
|
{
|
||||||
HBoxContainer valueContainer = display.GetNode<HBoxContainer>("./EditorDisplay/HBoxContainer/");
|
HBoxContainer valueContainer = display.GetNode<HBoxContainer>("./EditorDisplay/HBoxContainer/");
|
||||||
|
|
||||||
GD.Print(valueContainer.GetNode<SpinBox>("./CoordinateX").Value);
|
|
||||||
int posX = (int)valueContainer.GetNode<SpinBox>("./CoordinateX").Value;
|
int posX = (int)valueContainer.GetNode<SpinBox>("./CoordinateX").Value;
|
||||||
int posY = (int)valueContainer.GetNode<SpinBox>("./CoordinateY").Value;
|
int posY = (int)valueContainer.GetNode<SpinBox>("./CoordinateY").Value;
|
||||||
int posZ = (int)valueContainer.GetNode<SpinBox>("./CoordinateZ").Value;
|
int posZ = (int)valueContainer.GetNode<SpinBox>("./CoordinateZ").Value;
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ public abstract class ProgramNode
|
|||||||
{
|
{
|
||||||
public ProgramNode nextNode;
|
public ProgramNode nextNode;
|
||||||
public string DisplayText;
|
public string DisplayText;
|
||||||
|
public string lastExecutionMessage;
|
||||||
|
|
||||||
public abstract bool Execute(Robot robot, double delta);
|
public abstract NodeResult Execute(Robot robot, double delta);
|
||||||
public abstract void ReadParameters(NodeDisplay display);
|
public abstract void ReadParameters(NodeDisplay display);
|
||||||
public abstract ProgramNode Duplicate();
|
public abstract ProgramNode Duplicate();
|
||||||
}
|
}
|
||||||
+14
-5
@@ -18,13 +18,22 @@ public partial class Robot : Node3D
|
|||||||
{
|
{
|
||||||
if (isExecuting)
|
if (isExecuting)
|
||||||
{
|
{
|
||||||
if (currentNode.Execute(this, delta))
|
switch (currentNode.Execute(this, delta))
|
||||||
{
|
{
|
||||||
currentNode = currentNode.nextNode;
|
case NodeResult.SUCCESS:
|
||||||
if (currentNode == null)
|
currentNode = currentNode.nextNode;
|
||||||
{
|
if (currentNode == null)
|
||||||
|
{
|
||||||
|
isExecuting = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case NodeResult.FAILURE:
|
||||||
isExecuting = false;
|
isExecuting = false;
|
||||||
}
|
GD.Print(currentNode.lastExecutionMessage);
|
||||||
|
break;
|
||||||
|
case NodeResult.RUNNING:
|
||||||
|
//Currently does nothing.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ public partial class Layer : Node3D
|
|||||||
public bool hasContentGenerated = false;
|
public bool hasContentGenerated = false;
|
||||||
public Vector2I gateCoordinate;
|
public Vector2I gateCoordinate;
|
||||||
public List<string> currentResources;
|
public List<string> currentResources;
|
||||||
|
public bool isGateOpen = false;
|
||||||
|
|
||||||
// Called when the node enters the scene tree for the first time.
|
// Called when the node enters the scene tree for the first time.
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
@@ -89,7 +90,7 @@ public partial class Layer : Node3D
|
|||||||
var node = new Node3D
|
var node = new Node3D
|
||||||
{
|
{
|
||||||
Position = tile.Position,
|
Position = tile.Position,
|
||||||
Visible = false
|
Visible = tile.collapsedMesh != null && tile.collapsedMesh == "gate"
|
||||||
};
|
};
|
||||||
decorationRoot.AddChild(node);
|
decorationRoot.AddChild(node);
|
||||||
|
|
||||||
@@ -115,7 +116,7 @@ public partial class Layer : Node3D
|
|||||||
for (int z = 0; z < layerSize; z++)
|
for (int z = 0; z < layerSize; z++)
|
||||||
{
|
{
|
||||||
//Exclude spawn from border generation
|
//Exclude spawn from border generation
|
||||||
if(x == 0 && z == 0) continue;
|
if(x == 0 && z == 0 && level == 0) continue;
|
||||||
if (!IsBorder(x, z))
|
if (!IsBorder(x, z))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -155,6 +156,7 @@ public partial class Layer : Node3D
|
|||||||
if (tiles[posX, posY].tileMeshes.ContainsKey("gate"))
|
if (tiles[posX, posY].tileMeshes.ContainsKey("gate"))
|
||||||
{
|
{
|
||||||
tiles[posX, posY].Collapse("gate");
|
tiles[posX, posY].Collapse("gate");
|
||||||
|
tiles[posX, posY].containsDecoration = true;
|
||||||
gateCoordinate = new Vector2I(posX, posY);
|
gateCoordinate = new Vector2I(posX, posY);
|
||||||
Propagate(gateCoordinate);
|
Propagate(gateCoordinate);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ public class Pathfinding
|
|||||||
private static Dictionary<Vector3I, long> coordToId = new();
|
private static Dictionary<Vector3I, long> coordToId = new();
|
||||||
private static Dictionary<long, Vector3I> idToCoord = new();
|
private static Dictionary<long, Vector3I> idToCoord = new();
|
||||||
private static long nextId = 1;
|
private static long nextId = 1;
|
||||||
|
private static long[] layerGateIds = new long[GameData.ruinSize];
|
||||||
|
|
||||||
private static long GetOrCreateId(Vector3I coord)
|
private static long GetOrCreateId(Vector3I coord)
|
||||||
{
|
{
|
||||||
@@ -26,6 +27,7 @@ public class Pathfinding
|
|||||||
aStar.Clear();
|
aStar.Clear();
|
||||||
coordToId.Clear();
|
coordToId.Clear();
|
||||||
idToCoord.Clear();
|
idToCoord.Clear();
|
||||||
|
layerGateIds = new long[GameData.ruinSize];
|
||||||
nextId = 1;
|
nextId = 1;
|
||||||
|
|
||||||
for (int y = 0; y < GameData.ruinSize; y++)
|
for (int y = 0; y < GameData.ruinSize; y++)
|
||||||
@@ -43,6 +45,10 @@ public class Pathfinding
|
|||||||
long id = GetOrCreateId(coord);
|
long id = GetOrCreateId(coord);
|
||||||
|
|
||||||
aStar.AddPoint(id, tile.Position);
|
aStar.AddPoint(id, tile.Position);
|
||||||
|
if (tile.collapsedMesh == "gate")
|
||||||
|
{
|
||||||
|
layerGateIds[y] = id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,6 +80,16 @@ public class Pathfinding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int y = 0; y < GameData.ruinSize; y++)
|
||||||
|
{
|
||||||
|
UpdateGatePoint(y, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdateGatePoint(int layer, bool isOpen)
|
||||||
|
{
|
||||||
|
aStar.SetPointDisabled(layerGateIds[layer], !isOpen);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Vector3> GetPath(Vector3I start, Vector3I end)
|
public static List<Vector3> GetPath(Vector3I start, Vector3I end)
|
||||||
|
|||||||
@@ -132,7 +132,10 @@ public partial class Tile
|
|||||||
Position = placeholder.transform.Origin
|
Position = placeholder.transform.Origin
|
||||||
};
|
};
|
||||||
ContentNode.AddChild(decoration);
|
ContentNode.AddChild(decoration);
|
||||||
decoration.LookAt(transform.Origin, Vector3.Up);
|
if (!key.ToLower().Contains("gate"))
|
||||||
|
{
|
||||||
|
decoration.LookAt(transform.Origin, Vector3.Up);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ public class WFC
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return fromTile.collapsedMesh == "gate";
|
return fromTile.collapsedMesh == "gate" && GameData.map[from.Y].isGateOpen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user