Added final features for this release. Now only polishing (if needed) remains.
Features: Sacrifice-Node, Maintain-Node, Options for screen type, lightcolor and soundvolume, tied in sound effects, game pause when menu is open, visibly open up gate when opening it.
This commit is contained in:
@@ -25,6 +25,7 @@ public class HarvestNode : ProgramNode
|
||||
|
||||
if (tile.resource.Extract(delta))
|
||||
{
|
||||
SoundManager.PlayMining();
|
||||
if (!GameData.inventory.AddItem(new Item {data = tile.resource.item}, 1))
|
||||
{
|
||||
lastExecutionMessage = "Not enough space";
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using Godot;
|
||||
|
||||
public class MaintainNode : ProgramNode
|
||||
{
|
||||
private const float MaintenancePerGear = 10f;
|
||||
|
||||
public MaintainNode()
|
||||
{
|
||||
DisplayText = "Maintain";
|
||||
}
|
||||
|
||||
public override NodeResult Execute(Robot robot, double delta)
|
||||
{
|
||||
string gearId = GetGearId(robot);
|
||||
|
||||
if (!GameData.inventory.TryRemoveItem(gearId, 1))
|
||||
{
|
||||
lastExecutionMessage = $"Missing {ItemData.GetReadableName(gearId)}";
|
||||
return NodeResult.FAILURE;
|
||||
}
|
||||
|
||||
robot.Maintain(MaintenancePerGear);
|
||||
lastExecutionMessage = "";
|
||||
return NodeResult.SUCCESS;
|
||||
}
|
||||
|
||||
public override void ReadParameters(NodeDisplay display)
|
||||
{
|
||||
}
|
||||
|
||||
public override ProgramNode Duplicate()
|
||||
{
|
||||
MaintainNode duplicate = new MaintainNode();
|
||||
return duplicate;
|
||||
}
|
||||
|
||||
public override void Setup(NodeDisplay display)
|
||||
{
|
||||
}
|
||||
|
||||
public override string Save()
|
||||
{
|
||||
return $"Name: {DisplayText}";
|
||||
}
|
||||
|
||||
public static string GetGearId(Robot robot)
|
||||
{
|
||||
string robotType = robot == null ? "stone_robot" : robot.robotType;
|
||||
return robotType.Replace("_robot", "_gear");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bmibtsh1iq2x
|
||||
@@ -0,0 +1,52 @@
|
||||
using Godot;
|
||||
|
||||
public class SacrificeNode : ProgramNode
|
||||
{
|
||||
public SacrificeNode()
|
||||
{
|
||||
DisplayText = "Sacrifice";
|
||||
}
|
||||
|
||||
public override NodeResult Execute(Robot robot, double delta)
|
||||
{
|
||||
Vector3I mapIndex = Pathfinding.GetClosestStartPoint(robot.Position);
|
||||
Tile tile = GameData.map[mapIndex.Y].tiles[mapIndex.X, mapIndex.Z];
|
||||
|
||||
if (!tile.containsResource || tile.resource == null)
|
||||
{
|
||||
lastExecutionMessage = "No resource on this tile";
|
||||
return NodeResult.FAILURE;
|
||||
}
|
||||
|
||||
if (tile.resource.IsEndless())
|
||||
{
|
||||
lastExecutionMessage = "Resource is already endless";
|
||||
return NodeResult.FAILURE;
|
||||
}
|
||||
|
||||
tile.resource.MakeEndless();
|
||||
GameData.robots.Remove(robot);
|
||||
robot.QueueFree();
|
||||
lastExecutionMessage = "";
|
||||
return NodeResult.SUCCESS;
|
||||
}
|
||||
|
||||
public override void ReadParameters(NodeDisplay display)
|
||||
{
|
||||
}
|
||||
|
||||
public override ProgramNode Duplicate()
|
||||
{
|
||||
SacrificeNode duplicate = new SacrificeNode();
|
||||
return duplicate;
|
||||
}
|
||||
|
||||
public override void Setup(NodeDisplay display)
|
||||
{
|
||||
}
|
||||
|
||||
public override string Save()
|
||||
{
|
||||
return $"Name: {DisplayText}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://dq8e7txyldpew
|
||||
Reference in New Issue
Block a user