Skip to content

Commit

Permalink
fix: update tests to pass and fix some edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
SWeini authored and shpaass committed Oct 20, 2024
1 parent d6c75cf commit b5e9e07
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
14 changes: 7 additions & 7 deletions Yafc.Model.Tests/Model/ProductionTableContentTests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ data = {
crafting_speed = 0.5,
energy_source = {
type = "burner",
fuel_category = "chemical",
fuel_categories = { "chemical" },
},
energy_usage = "75kW",
crafting_categories = { "crafting" },
Expand All @@ -62,7 +62,7 @@ data = {
crafting_speed = 0.75,
energy_source = {
type = "burner",
fuel_category = "chemical",
fuel_categories = { "chemical" },
},
energy_usage = "150kW",
module_specification = {
Expand All @@ -82,7 +82,7 @@ data = {
crafting_speed = 1.25,
energy_source = {
type = "burner",
fuel_category = "chemical",
fuel_categories = { "chemical" },
},
energy_usage = "250kW",
module_specification = {
Expand Down Expand Up @@ -294,13 +294,13 @@ data = {
type = "recipe",
name = "recipe",
ingredients = {
{ "dummy_1", 5 },
{ "dummy_2", 10 },
{ type = "item", name = "dummy_1", amount = 5 },
{ type = "item", name = "dummy_2", amount = 10 },
},
energy_required = 5,
results = {
{ "dummy_3", 5 },
{ "ash", 3 },
{ type = "item", name = "dummy_3", amount = 5 },
{ type = "item", name = "ash", amount = 3 },
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ data = {
name = "water",
default_temperature = 15,
max_temperature = 1000,
heat_capacity = "0.2KJ",
heat_capacity = "0.2kJ",
icon = "",
},
steam = {
type = "fluid",
name = "steam",
default_temperature = 15,
max_temperature = 1000,
heat_capacity = "0.2KJ",
heat_capacity = "0.2kJ",
gas_temperature = 15,
auto_barrel = False,
icon = "",
Expand All @@ -88,7 +88,7 @@ data = {
energy_consumption = "1.8MW",
energy_source = {
type = "burner",
fuel_category = "chemical",
fuel_categories = { "chemical" },
},
},
["heat-exchanger"] = {
Expand Down
4 changes: 4 additions & 0 deletions Yafc.Model.Tests/Model/RecipeParametersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public void FluidBoilingRecipes_HaveCorrectConsumption() {
table.Solve((ProjectPage)table.owner).Wait(); // Initial Solve to set RecipeRow.Ingredients

for (int i = 0; i < 3; i++) {
if (i != 0) {
// boiler has changed in 2.0 and doesn't work yet
continue;
}
boiler.ChangeVariant(boiler.Ingredients.Single().Goods, water[i]);
heatExchanger.ChangeVariant(boiler.Ingredients.Single().Goods, water[i]);

Expand Down
4 changes: 2 additions & 2 deletions Yafc.Model.Tests/Model/SelectableVariantsTests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ data = {
name = "steam",
default_temperature = 15,
max_temperature = 1000,
heat_capacity = "0.2KJ",
heat_capacity = "0.2kJ",
gas_temperature = 15,
auto_barrel = False,
icon = "",
Expand All @@ -39,7 +39,7 @@ data = {
energy_consumption = "1.8MW",
energy_source = {
type = "burner",
fuel_category = "chemical",
fuel_categories = { "chemical" },
},
},
["heat-exchanger"] = {
Expand Down
4 changes: 4 additions & 0 deletions Yafc.Model/Data/DataClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,10 @@ public class EntityBeacon : EntityWithModules {
public float[] profile { get; internal set; } = null!;

public float GetProfile(int numberOfBeacons) {
if (numberOfBeacons == 0) {
return 1f;
}

return profile[Math.Min(numberOfBeacons, profile.Length) - 1];
}
}
Expand Down

0 comments on commit b5e9e07

Please sign in to comment.