Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowTheAge committed Mar 3, 2021
1 parent 9b09ff6 commit 993bed1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions YAFC/Workspace/AutoPlannerView.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using YAFC.Model;
using YAFC.UI;

Expand Down Expand Up @@ -108,11 +109,13 @@ protected override void BuildContent(ImGui gui)

public override void CreateModelDropdown(ImGui gui, Type type, Project project, ref bool close)
{
/*
if (gui.BuildContextMenuButton("Auto planner (Alpha)"))
{
close = true;
WizardPanel.Show("New auto planner", CreateAutoPlannerWizard);
}
*/
}
}
}
6 changes: 3 additions & 3 deletions YAFC/Workspace/ProductionTable/ProductionTableView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private void OpenProductDropdown(ImGui targetGui, Rect rect, Goods goods, float

void DropDownContent(ImGui gui, ref bool close)
{
if (type == ProductDropdownType.Fuel && recipe?.entity != null && recipe.entity.energy.fuels.Count > 1)
if (type == ProductDropdownType.Fuel && recipe?.entity != null && (recipe.entity.energy.fuels.Count > 1 || recipe.entity.energy.fuels[0] != recipe.fuel))
{
close |= gui.BuildInlineObejctListAndButton(recipe.entity.energy.fuels, DataUtils.FavouriteFuel, selectFuel, "Select fuel", extra:fuelDisplayFunc);
}
Expand Down Expand Up @@ -259,7 +259,7 @@ private void BuildGoodsIcon(ImGui gui, Goods goods, ProductionLink link, float a
{
var linkIsError = link != null && ((link.flags & (ProductionLink.Flags.HasProductionAndConsumption | ProductionLink.Flags.LinkRecursiveNotMatched | ProductionLink.Flags.ChildNotMatched)) != ProductionLink.Flags.HasProductionAndConsumption);
var linkIsForeign = link != null && link.owner != context;
if (gui.BuildFactorioObjectWithAmount(goods, amount, goods?.flowUnitOfMeasure ?? UnitOfMeasure.None, link != null ? linkIsError ? SchemeColor.Error : linkIsForeign ? SchemeColor.Secondary : SchemeColor.Primary : goods.IsSourceResource() ? SchemeColor.Green : SchemeColor.None) && goods != Database.voidEnergy)
if (gui.BuildFactorioObjectWithAmount(goods, amount, goods?.flowUnitOfMeasure ?? UnitOfMeasure.None, link != null ? linkIsError ? SchemeColor.Error : linkIsForeign ? SchemeColor.Secondary : SchemeColor.Primary : goods.IsSourceResource() ? SchemeColor.Green : SchemeColor.None))
{
OpenProductDropdown(gui, gui.lastRect, goods, amount, link, dropdownType, recipe, context, variants);
}
Expand Down Expand Up @@ -287,7 +287,7 @@ private void BuildRecipeEntity(ImGui gui, RecipeRow recipe)
}

gui.AllocateSpacing(0.5f);
if (recipe.fuel != Database.voidEnergy)
if (recipe.fuel != Database.voidEnergy || recipe.entity == null || recipe.entity.energy.type != EntityEnergyType.Void)
{
BuildGoodsIcon(gui, recipe.fuel, recipe.links.fuel, (float) (recipe.parameters.fuelUsagePerSecondPerRecipe * recipe.recipesPerSecond), ProductDropdownType.Fuel, recipe, recipe.linkRoot);
}
Expand Down
2 changes: 1 addition & 1 deletion YAFCmodel/Model/ModuleFillerParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void AutoFillBeacons(RecipeParameters recipeParams, Recipe recipe, Entity

public void AutoFillModules(RecipeParameters recipeParams, Recipe recipe, Entity entity, Goods fuel, ref ModuleEffects effects, ref RecipeParameters.UsedModule used)
{
if (fillMiners || !recipe.flags.HasFlags(RecipeFlags.UsesMiningProductivity))
if (autoFillPayback > 0 && (fillMiners || !recipe.flags.HasFlags(RecipeFlags.UsesMiningProductivity)))
{
var productivityEconomy = recipe.Cost() / recipeParams.recipeTime;
var effectivityEconomy = recipeParams.fuelUsagePerSecondPerBuilding * fuel?.Cost() ?? 0;
Expand Down

0 comments on commit 993bed1

Please sign in to comment.