Implemented research cost, tweaked some values.

This commit is contained in:
2026-05-09 22:30:18 +02:00
parent fc21c7c8d3
commit 09df4334b9
8 changed files with 119 additions and 39 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ public class Inventory
{
public List<Item> items = new List<Item>();
public int maxInventorySize = 16;
public int maxInventorySize = 10;
public event EventHandler OnInventoryUpdate;
public bool AddItem(Item item, int amount)
+16 -4
View File
@@ -15,10 +15,9 @@ public class Research
{
if (!paidResources)
{
foreach (Ingredient ingredient in data.Inputs)
{
GameData.inventory.RemoveItem(ingredient.Item, ingredient.Amount);
}
if (!CanStart()) return ResearchResult.FAILED;
PayResources();
paidResources = true;
}
@@ -31,6 +30,19 @@ public class Research
return ResearchResult.RESEARCHING;
}
public bool CanStart()
{
return GameData.inventory.CanCraft(data.Inputs, 1);
}
public void PayResources()
{
foreach (Ingredient ingredient in data.Inputs)
{
GameData.inventory.RemoveItem(ingredient.Item, ingredient.Amount);
}
}
public void Complete()
{
if (state == ResearchState.RESEARCHED) return;
+5 -5
View File
@@ -4,12 +4,12 @@ using Godot;
public partial class Robot : Node3D
{
private const float EnergyUsePerSecond = 0.2f;
private const float HeatGainPerSecond = 7.5f;
private const float ActiveHeatLossPerSecond = 18f;
private const float IdleHeatLossPerSecond = 9f;
private const float EnergyUsePerSecond = 0.12f;
private const float HeatGainPerSecond = 5f;
private const float ActiveHeatLossPerSecond = 22f;
private const float IdleHeatLossPerSecond = 12f;
private const float CooldownTarget = 35f;
private const float MaintenanceLossPerSecond = 0.04f;
private const float MaintenanceLossPerSecond = 0.025f;
private bool isExecuting = false;
private ProgramNode currentNode;
+9 -9
View File
@@ -2,10 +2,10 @@ using System;
public class SurvivalState
{
private const float HungerDrainPerSecond = 0.035f;
private const float ThirstDrainPerSecond = 0.055f;
private const float PassiveEnergyDrainPerSecond = 0.025f;
private const float AutoConsumeThreshold = 35f;
private const float HungerDrainPerSecond = 0.012f;
private const float ThirstDrainPerSecond = 0.018f;
private const float PassiveEnergyDrainPerSecond = 0.01f;
private const float AutoConsumeThreshold = 30f;
public float hunger = 100f;
public float thirst = 100f;
@@ -48,7 +48,7 @@ public class SurvivalState
if (hunger > AutoConsumeThreshold) return;
if (!GameData.inventory.TryRemoveItem("mushroom", 1)) return;
hunger = Math.Clamp(hunger + 35f, 0f, maxHunger);
hunger = Math.Clamp(hunger + 45f, 0f, maxHunger);
}
private void TryAutoConsumeWater()
@@ -56,7 +56,7 @@ public class SurvivalState
if (thirst > AutoConsumeThreshold) return;
if (!GameData.inventory.TryRemoveItem("water", 1)) return;
thirst = Math.Clamp(thirst + 40f, 0f, maxThirst);
thirst = Math.Clamp(thirst + 50f, 0f, maxThirst);
}
private void TryAutoConsumeEnergy()
@@ -65,19 +65,19 @@ public class SurvivalState
if (GameData.inventory.TryRemoveItem("battery_v2", 1))
{
energy = Math.Clamp(energy + 70f, 0f, maxEnergy);
energy = Math.Clamp(energy + 90f, 0f, maxEnergy);
return;
}
if (GameData.inventory.TryRemoveItem("battery_v1", 1))
{
energy = Math.Clamp(energy + 45f, 0f, maxEnergy);
energy = Math.Clamp(energy + 65f, 0f, maxEnergy);
return;
}
if (GameData.inventory.TryRemoveItem("steam", 1))
{
energy = Math.Clamp(energy + 25f, 0f, maxEnergy);
energy = Math.Clamp(energy + 40f, 0f, maxEnergy);
}
}