Skip to content

Commit

Permalink
fix: Treat recycling recipes as special. (#374)
Browse files Browse the repository at this point in the history
Unlike the other special recipe types, recycling recipes are detected
based on the category, not the recipe behavior. I think this is fair
since they're generated by the quality mod; they'll likely still be the
same categories in all mod packs.
  • Loading branch information
shpaass authored Dec 17, 2024
2 parents 489982e + 7731ddc commit f4451f9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions Yafc.Model/Data/DataClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public enum FactorioObjectSpecialType {
Stacking,
Pressurization,
Crating,
Recycling,
}

public class Recipe : RecipeOrTechnology {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ private void DeserializeRecipe(LuaTable table, ErrorCollector errorCollector) {
var recipe = DeserializeCommon<Recipe>(table, "recipe");
LoadRecipeData(recipe, table, errorCollector);
_ = table.Get("category", out string recipeCategory, "crafting");
// "recycling-or-hand-crafting" is Scrap recycling. It's special so it isn't considered a potential source recipe when ctrl+clicking.
// It'll still be used as a ctrl+click consumption recipe for scrap.
if (recipeCategory is "recycling" or "recycling-or-hand-crafting") {
recipe.specialType = FactorioObjectSpecialType.Recycling;
}
recipeCategories.Add(recipeCategory, recipe);
AllowedEffects allowedEffects = AllowedEffects.None;
if (table.Get("allow_consumption", true)) {
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Date:
- Recipes that are referenced without being defined do not prevent YAFC from loading.
- (SA) Tree seeds used by the agricultural tower no longer appear twice in the Dependency Explorer.
- Milestone analysis got slower in 2.4.0; increase its speed.
- (SA) Recycling recipes are now considered special, like barrelling/voiding.
----------------------------------------------------------------------------------------------------------------------
Version: 2.4.0
Date: November 21st 2024
Expand Down

0 comments on commit f4451f9

Please sign in to comment.