Esempio n. 1
0
            public static void Postfix(ref Bill_Production __instance, Pawn billDoer, List <Thing> ingredients)
            {
                if (recursing == true)
                {
                    return;// true;
                }
                MeeseeksBillStorage billStorage = Current.Game.World.GetComponent <MeeseeksBillStorage>();

                Bill_Production originalBill  = billStorage.GetOriginalBillFromDuplicate(__instance) as Bill_Production;
                Bill_Production duplicateBill = billStorage.GetDuplicateBillFromOriginal(__instance) as Bill_Production;

                if (originalBill == null && duplicateBill == null)
                {
                }
                // The finished iteration was on an original bill, doesn't matter who did it, mirror the result
                else if (duplicateBill != null)
                {
                    UpdateBill(duplicateBill);
                    return;// true;
                }
                // The finished iteration was on a duplicate bill, copy the result to the original, if it exists and make sure the duplicate is properly updated and check for deletion
                else if (billStorage.IsDuplicate(__instance))
                {
                    UpdateBill(__instance, false);

                    if (originalBill != null)
                    {
                        try
                        {
                            recursing = true;
                            originalBill.Notify_IterationCompleted(billDoer, ingredients);
                        }
                        finally
                        {
                            recursing = false;
                        }
                    }

                    //return false;
                }

                //return true;
            }