Added complete crafting to the game. Next step would be research and buildings. Updated DSL with Setup to work with dynamic loading.

This commit is contained in:
2026-05-05 21:44:30 +02:00
parent ffe1077abc
commit 6445c24202
11 changed files with 116 additions and 39 deletions
+11 -2
View File
@@ -32,9 +32,9 @@ public class Inventory
{
bool canCraft = true;
Item item;
foreach(Ingredient ingredient in neededIngredients)
foreach (Ingredient ingredient in neededIngredients)
{
item = items.Find(x => x.data.Id == ingredient.item && x.currentAmount >= ingredient.amount * amount);
item = items.Find(x => x.data.Id == ingredient.Item && x.currentAmount >= ingredient.Amount * amount);
if (item == null)
{
canCraft = false;
@@ -43,4 +43,13 @@ public class Inventory
}
return canCraft;
}
public void RemoveItem(string id, int amount)
{
Item item = items.Find(x => x.data.Id == id && x.currentAmount >= amount);
if (item != null)
{
item.currentAmount -= amount;
}
}
}