Changed craft times for all items,buildings, researches and added research that can change game stats/effects.
This commit is contained in:
@@ -49,7 +49,7 @@ public partial class Robot : Node3D
|
||||
}
|
||||
else if (currentMessage.Length <= 0)
|
||||
{
|
||||
CoolDown(delta, IdleHeatLossPerSecond);
|
||||
CoolDown(delta, GameData.robotStats.GetCoolingRate(IdleHeatLossPerSecond));
|
||||
currentMessage = "No script executing";
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public partial class Robot : Node3D
|
||||
|
||||
public float GetMovementSpeed()
|
||||
{
|
||||
return GameData.robotSpeed * GetWorkEfficiency();
|
||||
return GameData.robotStats.GetMovementSpeed(GameData.robotSpeed) * GetWorkEfficiency();
|
||||
}
|
||||
|
||||
public float GetWorkEfficiency()
|
||||
@@ -76,7 +76,8 @@ public partial class Robot : Node3D
|
||||
if (isBroken) return 0f;
|
||||
if (maintenance >= 50f) return 1f;
|
||||
|
||||
return Math.Clamp(0.35f + maintenance / 100f, 0.35f, 1f);
|
||||
float minimumEfficiency = GameData.robotStats.GetMinimumEfficiency();
|
||||
return Math.Clamp(minimumEfficiency + maintenance / 100f, minimumEfficiency, 1f);
|
||||
}
|
||||
|
||||
public void Maintain()
|
||||
@@ -102,19 +103,19 @@ public partial class Robot : Node3D
|
||||
|
||||
if (isCoolingDown)
|
||||
{
|
||||
CoolDown(delta, ActiveHeatLossPerSecond);
|
||||
CoolDown(delta, GameData.robotStats.GetCoolingRate(ActiveHeatLossPerSecond));
|
||||
currentMessage = $"Cooling down ({heat:0}%)";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GameData.survival.TryConsumeEnergy(EnergyUsePerSecond * (float)delta))
|
||||
if (!GameData.survival.TryConsumeEnergy(GameData.robotStats.GetEnergyUse(EnergyUsePerSecond) * (float)delta))
|
||||
{
|
||||
currentMessage = "Not enough energy";
|
||||
return false;
|
||||
}
|
||||
|
||||
heat = Math.Clamp(heat + HeatGainPerSecond * (float)delta, 0f, 100f);
|
||||
maintenance = Math.Clamp(maintenance - MaintenanceLossPerSecond * (float)delta, 0f, 100f);
|
||||
heat = Math.Clamp(heat + GameData.robotStats.GetHeatGain(HeatGainPerSecond) * (float)delta, 0f, 100f);
|
||||
maintenance = Math.Clamp(maintenance - GameData.robotStats.GetMaintenanceLoss(MaintenanceLossPerSecond) * (float)delta, 0f, 100f);
|
||||
|
||||
if (heat >= 100f)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class RobotStats
|
||||
{
|
||||
private const float BaseMinimumEfficiency = 0.35f;
|
||||
|
||||
private float speedBonus = 0f;
|
||||
private float energyUseReduction = 0f;
|
||||
private float heatGainReduction = 0f;
|
||||
private float coolingBonus = 0f;
|
||||
private float maintenanceLossReduction = 0f;
|
||||
private float minimumEfficiencyBonus = 0f;
|
||||
|
||||
public float GetMovementSpeed(float baseSpeed)
|
||||
{
|
||||
return baseSpeed * (1f + speedBonus);
|
||||
}
|
||||
|
||||
public float GetEnergyUse(float baseEnergyUse)
|
||||
{
|
||||
return baseEnergyUse * (1f - Math.Clamp(energyUseReduction, 0f, 0.8f));
|
||||
}
|
||||
|
||||
public float GetHeatGain(float baseHeatGain)
|
||||
{
|
||||
return baseHeatGain * (1f - Math.Clamp(heatGainReduction, 0f, 0.8f));
|
||||
}
|
||||
|
||||
public float GetCoolingRate(float baseCoolingRate)
|
||||
{
|
||||
return baseCoolingRate * (1f + coolingBonus);
|
||||
}
|
||||
|
||||
public float GetMaintenanceLoss(float baseMaintenanceLoss)
|
||||
{
|
||||
return baseMaintenanceLoss * (1f - Math.Clamp(maintenanceLossReduction, 0f, 0.8f));
|
||||
}
|
||||
|
||||
public float GetMinimumEfficiency()
|
||||
{
|
||||
return Math.Clamp(BaseMinimumEfficiency + minimumEfficiencyBonus, BaseMinimumEfficiency, 0.85f);
|
||||
}
|
||||
|
||||
public void Apply(List<ResearchEffect> effects)
|
||||
{
|
||||
if (effects == null) return;
|
||||
|
||||
foreach (ResearchEffect effect in effects)
|
||||
{
|
||||
Apply(effect);
|
||||
}
|
||||
}
|
||||
|
||||
private void Apply(ResearchEffect effect)
|
||||
{
|
||||
if (effect == null) return;
|
||||
|
||||
switch (effect.Stat)
|
||||
{
|
||||
case "robot_speed_bonus":
|
||||
speedBonus += effect.Value;
|
||||
break;
|
||||
case "robot_energy_use_reduction":
|
||||
energyUseReduction += effect.Value;
|
||||
break;
|
||||
case "robot_heat_gain_reduction":
|
||||
heatGainReduction += effect.Value;
|
||||
break;
|
||||
case "robot_cooling_bonus":
|
||||
coolingBonus += effect.Value;
|
||||
break;
|
||||
case "robot_maintenance_loss_reduction":
|
||||
maintenanceLossReduction += effect.Value;
|
||||
break;
|
||||
case "robot_minimum_efficiency_bonus":
|
||||
minimumEfficiencyBonus += effect.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://djuorq37m01xc
|
||||
Reference in New Issue
Block a user