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:
@@ -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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user