Added increase to robotcount when completing research, added value modifiers for robot types.
This commit is contained in:
+28
-4
@@ -36,7 +36,13 @@
|
|||||||
],
|
],
|
||||||
"research": "stoneage",
|
"research": "stoneage",
|
||||||
"crafttime": 5.0,
|
"crafttime": 5.0,
|
||||||
"texture": "res://Assets/Images/Items/StoneGearSymbol.png"
|
"texture": "res://Assets/Images/Items/StoneGearSymbol.png",
|
||||||
|
"effects": [
|
||||||
|
{
|
||||||
|
"stat": "robot_count_increase",
|
||||||
|
"value": 10
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "basic_machines",
|
"id": "basic_machines",
|
||||||
@@ -166,7 +172,13 @@
|
|||||||
],
|
],
|
||||||
"research": "heat_control",
|
"research": "heat_control",
|
||||||
"crafttime": 12.0,
|
"crafttime": 12.0,
|
||||||
"texture": "res://Assets/Images/Research/CopperageSymbol.png"
|
"texture": "res://Assets/Images/Research/CopperageSymbol.png",
|
||||||
|
"effects": [
|
||||||
|
{
|
||||||
|
"stat": "robot_count_increase",
|
||||||
|
"value": 10
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "copper_smelting",
|
"id": "copper_smelting",
|
||||||
@@ -358,7 +370,13 @@
|
|||||||
],
|
],
|
||||||
"research": "basic_electricity",
|
"research": "basic_electricity",
|
||||||
"crafttime": 24.0,
|
"crafttime": 24.0,
|
||||||
"texture": "res://Assets/Images/Research/BronzeageSymbol.png"
|
"texture": "res://Assets/Images/Research/BronzeageSymbol.png",
|
||||||
|
"effects": [
|
||||||
|
{
|
||||||
|
"stat": "robot_count_increase",
|
||||||
|
"value": 10
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "bronze_smelting",
|
"id": "bronze_smelting",
|
||||||
@@ -480,7 +498,13 @@
|
|||||||
],
|
],
|
||||||
"research": "bronze_robotics",
|
"research": "bronze_robotics",
|
||||||
"crafttime": 38.0,
|
"crafttime": 38.0,
|
||||||
"texture": "res://Assets/Images/Research/IronageSymbol.png"
|
"texture": "res://Assets/Images/Research/IronageSymbol.png",
|
||||||
|
"effects": [
|
||||||
|
{
|
||||||
|
"stat": "robot_count_increase",
|
||||||
|
"value": 10
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "iron_smelting",
|
"id": "iron_smelting",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Godot;
|
|||||||
|
|
||||||
public partial class GameData
|
public partial class GameData
|
||||||
{
|
{
|
||||||
public static bool debugMode = true;
|
public static bool debugMode = false;
|
||||||
public static Random rand = new Random(seed);
|
public static Random rand = new Random(seed);
|
||||||
public static Layer[] map;
|
public static Layer[] map;
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ public partial class GameData
|
|||||||
public static int lowestLayer = 0;
|
public static int lowestLayer = 0;
|
||||||
|
|
||||||
public static bool canMove = true;
|
public static bool canMove = true;
|
||||||
public static int maxRobotCount = 1000;
|
public static int maxRobotCount = 10;
|
||||||
public static List<Robot> robots = new List<Robot>();
|
public static List<Robot> robots = new List<Robot>();
|
||||||
public static float robotSpeed = 10f;
|
public static float robotSpeed = 10f;
|
||||||
public static float tileWidth = 6;
|
public static float tileWidth = 6;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public class ResearchEffect
|
|||||||
"robot_cooling_bonus" => $"Robot cooling +{Value * 100f:0}%",
|
"robot_cooling_bonus" => $"Robot cooling +{Value * 100f:0}%",
|
||||||
"robot_maintenance_loss_reduction" => $"Robot maintenance loss -{Value * 100f:0}%",
|
"robot_maintenance_loss_reduction" => $"Robot maintenance loss -{Value * 100f:0}%",
|
||||||
"robot_minimum_efficiency_bonus" => $"Damaged robot efficiency +{Value * 100f:0}%",
|
"robot_minimum_efficiency_bonus" => $"Damaged robot efficiency +{Value * 100f:0}%",
|
||||||
|
"robot_count_increase" => $"Allows more robots +{Value}",
|
||||||
_ => Stat
|
_ => Stat
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ public partial class Robot : Node3D
|
|||||||
private const float CooldownTarget = 35f;
|
private const float CooldownTarget = 35f;
|
||||||
private const float MaintenanceLossPerSecond = 0.04f;
|
private const float MaintenanceLossPerSecond = 0.04f;
|
||||||
|
|
||||||
private List<ProgramNode> nodes = new List<ProgramNode>();
|
|
||||||
private bool isExecuting = false;
|
private bool isExecuting = false;
|
||||||
private ProgramNode currentNode;
|
private ProgramNode currentNode;
|
||||||
|
|
||||||
@@ -21,6 +20,12 @@ public partial class Robot : Node3D
|
|||||||
public float maintenance = 100f;
|
public float maintenance = 100f;
|
||||||
public bool isCoolingDown = false;
|
public bool isCoolingDown = false;
|
||||||
public bool isBroken = false;
|
public bool isBroken = false;
|
||||||
|
public string robotType = "iron_robot";
|
||||||
|
|
||||||
|
private RobotTypeStats TypeStats =>
|
||||||
|
GameData.robotStats.RobotTypes.TryGetValue(robotType, out RobotTypeStats stats)
|
||||||
|
? stats
|
||||||
|
: GameData.robotStats.RobotTypes["stone_robot"];
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
@@ -33,14 +38,16 @@ public partial class Robot : Node3D
|
|||||||
case NodeResult.SUCCESS:
|
case NodeResult.SUCCESS:
|
||||||
currentNode = currentNode.nextNode;
|
currentNode = currentNode.nextNode;
|
||||||
if (currentNode == null)
|
if (currentNode == null)
|
||||||
{
|
{
|
||||||
isExecuting = false;
|
isExecuting = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NodeResult.FAILURE:
|
case NodeResult.FAILURE:
|
||||||
isExecuting = false;
|
isExecuting = false;
|
||||||
currentMessage = "(FAILED)" + currentNode.lastExecutionMessage;
|
currentMessage = "(FAILED)" + currentNode.lastExecutionMessage;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NodeResult.RUNNING:
|
case NodeResult.RUNNING:
|
||||||
currentMessage = "";
|
currentMessage = "";
|
||||||
break;
|
break;
|
||||||
@@ -49,26 +56,32 @@ public partial class Robot : Node3D
|
|||||||
}
|
}
|
||||||
else if (currentMessage.Length <= 0)
|
else if (currentMessage.Length <= 0)
|
||||||
{
|
{
|
||||||
CoolDown(delta, GameData.robotStats.GetCoolingRate(IdleHeatLossPerSecond));
|
CoolDown(
|
||||||
|
delta,
|
||||||
|
GameData.robotStats.GetCoolingRate(IdleHeatLossPerSecond)
|
||||||
|
* TypeStats.CoolingMultiplier
|
||||||
|
);
|
||||||
|
|
||||||
currentMessage = "No script executing";
|
currentMessage = "No script executing";
|
||||||
}
|
}
|
||||||
|
|
||||||
Visible = Math.Round(Math.Abs(Position.Y / GameData.tileHeight), 0) == GameData.visibleLayer;
|
Visible = Math.Round(Math.Abs(Position.Y / GameData.tileHeight), 0) == GameData.visibleLayer;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetupExecution(List<ProgramNode> nodes)
|
public void SetupExecution(List<ProgramNode> nodes)
|
||||||
{
|
{
|
||||||
if (nodes.Count <= 0) return;
|
if (nodes.Count <= 0) return;
|
||||||
|
|
||||||
this.nodes = new List<ProgramNode>(nodes);
|
|
||||||
isExecuting = true;
|
isExecuting = true;
|
||||||
currentNode = nodes[0];
|
currentNode = nodes[0];
|
||||||
|
currentMessage = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetMovementSpeed()
|
public float GetMovementSpeed()
|
||||||
{
|
{
|
||||||
return GameData.robotStats.GetMovementSpeed(GameData.robotSpeed) * GetWorkEfficiency();
|
return GameData.robotStats.GetMovementSpeed(GameData.robotSpeed)
|
||||||
|
* TypeStats.SpeedMultiplier
|
||||||
|
* GetWorkEfficiency();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetWorkEfficiency()
|
public float GetWorkEfficiency()
|
||||||
@@ -76,8 +89,17 @@ public partial class Robot : Node3D
|
|||||||
if (isBroken) return 0f;
|
if (isBroken) return 0f;
|
||||||
if (maintenance >= 50f) return 1f;
|
if (maintenance >= 50f) return 1f;
|
||||||
|
|
||||||
float minimumEfficiency = GameData.robotStats.GetMinimumEfficiency();
|
float minimumEfficiency =
|
||||||
return Math.Clamp(minimumEfficiency + maintenance / 100f, minimumEfficiency, 1f);
|
GameData.robotStats.GetMinimumEfficiency()
|
||||||
|
+ TypeStats.MinimumEfficiencyBonus;
|
||||||
|
|
||||||
|
minimumEfficiency = Math.Clamp(minimumEfficiency, 0f, 1f);
|
||||||
|
|
||||||
|
return Math.Clamp(
|
||||||
|
minimumEfficiency + maintenance / 100f,
|
||||||
|
minimumEfficiency,
|
||||||
|
1f
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Maintain()
|
public void Maintain()
|
||||||
@@ -103,19 +125,42 @@ public partial class Robot : Node3D
|
|||||||
|
|
||||||
if (isCoolingDown)
|
if (isCoolingDown)
|
||||||
{
|
{
|
||||||
CoolDown(delta, GameData.robotStats.GetCoolingRate(ActiveHeatLossPerSecond));
|
CoolDown(
|
||||||
|
delta,
|
||||||
|
GameData.robotStats.GetCoolingRate(ActiveHeatLossPerSecond)
|
||||||
|
* TypeStats.CoolingMultiplier
|
||||||
|
);
|
||||||
|
|
||||||
currentMessage = $"Cooling down ({heat:0}%)";
|
currentMessage = $"Cooling down ({heat:0}%)";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GameData.survival.TryConsumeEnergy(GameData.robotStats.GetEnergyUse(EnergyUsePerSecond) * (float)delta))
|
float energyUse =
|
||||||
|
GameData.robotStats.GetEnergyUse(EnergyUsePerSecond)
|
||||||
|
* TypeStats.EnergyUseMultiplier
|
||||||
|
* (float)delta;
|
||||||
|
|
||||||
|
if (!GameData.survival.TryConsumeEnergy(energyUse))
|
||||||
{
|
{
|
||||||
currentMessage = "Not enough energy";
|
currentMessage = "Not enough energy";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
heat = Math.Clamp(heat + GameData.robotStats.GetHeatGain(HeatGainPerSecond) * (float)delta, 0f, 100f);
|
heat = Math.Clamp(
|
||||||
maintenance = Math.Clamp(maintenance - GameData.robotStats.GetMaintenanceLoss(MaintenanceLossPerSecond) * (float)delta, 0f, 100f);
|
heat + GameData.robotStats.GetHeatGain(HeatGainPerSecond)
|
||||||
|
* TypeStats.HeatGainMultiplier
|
||||||
|
* (float)delta,
|
||||||
|
0f,
|
||||||
|
100f
|
||||||
|
);
|
||||||
|
|
||||||
|
maintenance = Math.Clamp(
|
||||||
|
maintenance - GameData.robotStats.GetMaintenanceLoss(MaintenanceLossPerSecond)
|
||||||
|
* TypeStats.MaintenanceLossMultiplier
|
||||||
|
* (float)delta,
|
||||||
|
0f,
|
||||||
|
100f
|
||||||
|
);
|
||||||
|
|
||||||
if (heat >= 100f)
|
if (heat >= 100f)
|
||||||
{
|
{
|
||||||
@@ -136,10 +181,15 @@ public partial class Robot : Node3D
|
|||||||
|
|
||||||
private void CoolDown(double delta, float heatLossPerSecond)
|
private void CoolDown(double delta, float heatLossPerSecond)
|
||||||
{
|
{
|
||||||
heat = Math.Clamp(heat - heatLossPerSecond * (float)delta, 0f, 100f);
|
heat = Math.Clamp(
|
||||||
|
heat - heatLossPerSecond * (float)delta,
|
||||||
|
0f,
|
||||||
|
100f
|
||||||
|
);
|
||||||
|
|
||||||
if (heat <= CooldownTarget)
|
if (heat <= CooldownTarget)
|
||||||
{
|
{
|
||||||
isCoolingDown = false;
|
isCoolingDown = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,14 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
public class RobotStats
|
public class RobotStats
|
||||||
{
|
{
|
||||||
|
public readonly Dictionary<string, RobotTypeStats> RobotTypes = new()
|
||||||
|
{
|
||||||
|
["stone_robot"] = new RobotTypeStats(0.75f, 0.60f, 0.80f, 0.80f, 1.40f, -0.10f),
|
||||||
|
["copper_robot"] = new RobotTypeStats(1.00f, 1.00f, 1.00f, 1.00f, 1.00f, 0.00f),
|
||||||
|
["tin_robot"] = new RobotTypeStats(1.00f, 1.00f, 1.00f, 1.00f, 1.00f, 0.00f),
|
||||||
|
["bronze_robot"] = new RobotTypeStats(1.15f, 1.10f, 0.90f, 1.10f, 0.80f, 0.05f),
|
||||||
|
["iron_robot"] = new RobotTypeStats(1.35f, 1.25f, 1.15f, 1.20f, 0.65f, 0.10f)
|
||||||
|
};
|
||||||
private const float BaseMinimumEfficiency = 0.35f;
|
private const float BaseMinimumEfficiency = 0.35f;
|
||||||
|
|
||||||
private float speedBonus = 0f;
|
private float speedBonus = 0f;
|
||||||
@@ -76,6 +84,9 @@ public class RobotStats
|
|||||||
case "robot_minimum_efficiency_bonus":
|
case "robot_minimum_efficiency_bonus":
|
||||||
minimumEfficiencyBonus += effect.Value;
|
minimumEfficiencyBonus += effect.Value;
|
||||||
break;
|
break;
|
||||||
|
case "robot_count_increase":
|
||||||
|
GameData.maxRobotCount += (int)effect.Value;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
public readonly struct RobotTypeStats
|
||||||
|
{
|
||||||
|
public readonly float SpeedMultiplier;
|
||||||
|
public readonly float EnergyUseMultiplier;
|
||||||
|
public readonly float HeatGainMultiplier;
|
||||||
|
public readonly float CoolingMultiplier;
|
||||||
|
public readonly float MaintenanceLossMultiplier;
|
||||||
|
public readonly float MinimumEfficiencyBonus;
|
||||||
|
|
||||||
|
public RobotTypeStats(
|
||||||
|
float speedMultiplier,
|
||||||
|
float energyUseMultiplier,
|
||||||
|
float heatGainMultiplier,
|
||||||
|
float coolingMultiplier,
|
||||||
|
float maintenanceLossMultiplier,
|
||||||
|
float minimumEfficiencyBonus)
|
||||||
|
{
|
||||||
|
SpeedMultiplier = speedMultiplier;
|
||||||
|
EnergyUseMultiplier = energyUseMultiplier;
|
||||||
|
HeatGainMultiplier = heatGainMultiplier;
|
||||||
|
CoolingMultiplier = coolingMultiplier;
|
||||||
|
MaintenanceLossMultiplier = maintenanceLossMultiplier;
|
||||||
|
MinimumEfficiencyBonus = minimumEfficiencyBonus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bfmf5tb3pmmug
|
||||||
Reference in New Issue
Block a user