Skip to content
Open
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
8 changes: 6 additions & 2 deletions Source/AthenaFramework/Harmony/HarmonyPatches_Misc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,10 @@ public static void Postfix(Thing t, Pawn p, ref bool __result)
return;
}

GeneLockedRecipeExtension extension = t.def.GetModExtension<GeneLockedRecipeExtension>();
//GeneLockedRecipeExtension extension = t.def.GetModExtension<GeneLockedRecipeExtension>();
//At that point the building doesn't exists yet, the def you're pointing to is either the blueprint or the frame.
//The mod extension will likely be added to the buildingdef though, hence :
GeneLockedRecipeExtension extension = t.def.entityDefToBuild.GetModExtension<GeneLockedRecipeExtension>();

if (extension != null && !extension.CanCreate(p))
{
Expand All @@ -350,7 +353,8 @@ public static void Postfix(Bill __instance, Pawn p, ref bool __result)
return;
}

GeneLockedRecipeExtension extension = __instance.recipe.GetModExtension<GeneLockedRecipeExtension>();
//This will allow you to reach recipes hidden in recipeMakers by adding the modExtension to the parent thingDef instead
GeneLockedRecipeExtension extension = __instance.recipe.GetModExtension<GeneLockedRecipeExtension>() ?? __instance.recipe.ProducedThingDef?.GetModExtension<MindFlayerTechExtension>();

if (extension != null && !extension.CanCreate(p))
{
Expand Down