Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(icons): Use icons that exist in 2.0.33 for science&launches. #402

Merged
merged 1 commit into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions Yafc.Model/Data/DataClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,13 @@ public override bool HasSpentFuel([NotNullWhen(true)] out Item? spent) {
spent = fuelResult;
return spent != null;
}

public override DependencyNode GetDependencies() {
if (this == Database.science) {
return (Database.technologies.all, DependencyNode.Flags.Source);
}
return base.GetDependencies();
}
}

public class Module : Item {
Expand Down Expand Up @@ -464,20 +471,11 @@ public class Location : FactorioObject {
public class Special : Goods {
internal string? virtualSignal { get; set; }
internal bool power;
internal bool isResearch;
internal bool isVoid;
public override bool isPower => power;
public override string type => isPower ? "Power" : "Special";
public override UnitOfMeasure flowUnitOfMeasure => isVoid ? UnitOfMeasure.None : isPower ? UnitOfMeasure.Megawatt : UnitOfMeasure.PerSecond;
internal override FactorioObjectSortOrder sortingOrder => FactorioObjectSortOrder.SpecialGoods;
public override DependencyNode GetDependencies() {
if (isResearch) {
return (Database.technologies.all, DependencyNode.Flags.Source);
}
else {
return base.GetDependencies();
}
}
}

[Flags]
Expand Down
2 changes: 1 addition & 1 deletion Yafc.Model/Data/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static class Database {
public static Dictionary<string, FactorioObject> objectsByTypeName { get; internal set; } = null!;
public static Dictionary<string, List<Fluid>> fluidVariants { get; internal set; } = null!;
public static Goods voidEnergy { get; internal set; } = null!;
public static Goods researchUnit { get; internal set; } = null!;
public static Goods science { get; internal set; } = null!;
public static Goods itemInput { get; internal set; } = null!;
public static Goods itemOutput { get; internal set; } = null!;
public static Goods electricity { get; internal set; } = null!;
Expand Down
1 change: 0 additions & 1 deletion Yafc.Parser/Data/DataParserUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ public static class SpecialNames {
public const string RocketLaunch = "launch";
public const string RocketCraft = "rocket.";
public const string ReactorRecipe = "reactor";
public const string ResearchUnit = "research-unit";
public const string SpoilRecipe = "spoil";
public const string PlantRecipe = "plant";
public const string AsteroidCapture = "asteroid-capture";
Expand Down
16 changes: 8 additions & 8 deletions Yafc.Parser/Data/FactorioDataDeserializer_Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal partial class FactorioDataDeserializer {
private readonly Special heat;
private readonly Special electricity;
private readonly Special rocketLaunch;
private readonly Special researchUnit;
private readonly Item science;
private readonly Item totalItemOutput;
private readonly Item totalItemInput;
private readonly EntityEnergy voidEntityEnergy;
Expand Down Expand Up @@ -86,12 +86,12 @@ Item createSpecialItem(string name, string locName, string locDescr, string icon
rootAccessible.Add(voidEnergy);

rocketLaunch = createSpecialObject(false, SpecialNames.RocketLaunch, "Rocket launch slot",
"This is a slot in a rocket ready to be launched", "__base__/graphics/entity/rocket-silo/02-rocket.png", "signal-R");
researchUnit = createSpecialObject(false, SpecialNames.ResearchUnit, "Research",
"This represents one unit of a research task.", "__base__/graphics/icons/compilatron.png", "signal-L");
researchUnit.isResearch = true;
researchUnit.showInExplorers = false;
Analysis.ExcludeFromAnalysis<CostAnalysis>(researchUnit);
"This is a slot in a rocket ready to be launched", "__base__/graphics/entity/rocket-silo/rocket-static-pod.png", "signal-R");

science = GetObject<Item>("science");
science.showInExplorers = false;
Analysis.ExcludeFromAnalysis<CostAnalysis>(science);
formerAliases["Special.research-unit"] = science;

generatorProduction = CreateSpecialRecipe(electricity, SpecialNames.GeneratorRecipe, "generating");
generatorProduction.products = [new Product(electricity, 1f)];
Expand Down Expand Up @@ -189,7 +189,7 @@ private void ExportBuiltData() {

Database.allSciencePacks = [.. sciencePacks];
Database.voidEnergy = voidEnergy;
Database.researchUnit = researchUnit;
Database.science = science;
Database.itemInput = totalItemInput;
Database.itemOutput = totalItemOutput;
Database.electricity = electricity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private static void DeserializeFlags(LuaTable table, RecipeOrTechnology recipe)
private void DeserializeTechnology(LuaTable table, ErrorCollector errorCollector) {
var technology = DeserializeCommon<Technology>(table, "technology");
LoadTechnologyData(technology, table, errorCollector);
technology.products = [new(researchUnit, 1)];
technology.products = [new(science, 1)];
}

private void DeserializeQuality(LuaTable table, ErrorCollector errorCollector) {
Expand Down
2 changes: 1 addition & 1 deletion Yafc/Workspace/ProductionTable/ProductionTableView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ void dropDownContent(ImGui gui) {
#region Recipe selection
int numberOfShownRecipes = 0;

if (goods.name == SpecialNames.ResearchUnit) {
if (goods == Database.science) {
if (gui.BuildButton("Add technology") && gui.CloseDropdown()) {
SelectMultiObjectPanel.Select(Database.technologies.all, "Select technology",
r => context.AddRecipe(r, DefaultVariantOrdering), checkMark: r => context.recipes.Any(rr => rr.recipe == r));
Expand Down