public static bool GetRetrieveFinishedItemGoal(CraftGoal instance, Character character, CraftingProp craftingProp, out Goal goal) { throw new NotImplementedException("stub"); }
static Goal Postfix(Goal __result, ref CraftGoal __instance, Character character, Goal parent) { // System.Text.StringBuilder goal_sb = new System.Text.StringBuilder(); // System.Text.StringBuilder result_goal_sb = new System.Text.StringBuilder(); // __instance.BuildDebugString(goal_sb); if (__result != null) { // __result.BuildDebugString(result_goal_sb); } else { // result_goal_sb.Append("null"); } // Main.mod.Logger.Log($"{character.FirstName} {character.Surname} {goal_sb.ToString()} => {result_goal_sb.ToString()}"); if (__instance.FollowingRecipe == null) { // Main.mod.Logger.Warning("no recipe!"); } else { // Main.mod.Logger.Log($"recipe {__instance.FollowingRecipe.UniqueID}"); // try to create an order to clear a reserved campfire with food if (__result == null && !CraftGoal__ReversePatch.HasUsedIngredientsWaitingForProduct(__instance, character) && __instance.FollowingRecipe.RequiredPropToWorkOn() != 0) { GameTerrain terrain = GameTerrain.Instance; CraftingProp craftingProp = terrain.GetFixedObjectOnTile(__instance.DestTile.x, __instance.DestTile.y) as CraftingProp; if (craftingProp != null && (craftingProp.CraftingFinished || craftingProp.CraftingRecipe == null)) { if (craftingProp.Inventory.GetTotalNutrition() > 0f) { // Main.mod.Logger.Log("target prop has stuck food"); if (__instance.DesiredAmount == int.MaxValue && character.GetRole() == Role.Cook) { // Main.mod.Logger.Log("is cook"); if (CraftGoal__ReversePatch.GetRetrieveFinishedItemGoal(__instance, character, craftingProp, out Goal goal2)) { // result_goal_sb.Clear(); // goal2.BuildDebugString(result_goal_sb); // Main.mod.Logger.Log($"found a new goal: {result_goal_sb.ToString()}"); return(goal2); } else { // Main.mod.Logger.Warning("couldn't find a new goal"); } } } } } // stop current recipe if crafting limit was reached if (__result == null && character.Community.HasReachedCraftingLimitForProduct(__instance.FollowingRecipe)) { // Main.mod.Logger.Log("crafting limit reached for recipe"); __instance.StopRecipe(character); } } return(__result); }
public static bool HasUsedIngredientsWaitingForProduct(CraftGoal instance, Character character) { throw new NotImplementedException("stub"); }