public static void RecalcItemObject(ref Pathea.ItemSystem.ItemObject __result, int pos, ref Pathea.CompoundSystem.CompoundItem __instance) { if (__result == null || __instance == null) { return; } // all this to avoid circular references. if (!originalValues.ContainsKey(__instance.Id)) { int[] arr = new int[3]; arr[0] = -1; arr[1] = -1; arr[2] = -1; originalValues.Add(__instance.Id, arr); } if (originalValues[__instance.Id][pos] == -1) { originalValues[__instance.Id][pos] = __result.Number; } int newnum = ChangeCraftingMaterialNumber(originalValues[__instance.Id][pos]); // redo if ( __result.Number != newnum ) { __result.DeleteNumber(__result.Number); __result.ChangeNumber(newnum); } }
static void PostfixGetHarvestItems(ref List <Pathea.ItemSystem.ItemObject> __result) { if (null == __result) { return; } for (int i = 0; i < __result.Count; i++) { Pathea.ItemSystem.ItemObject item = __result[i]; int newnum = Mathf.CeilToInt(item.Number * Main.modSettings.PlanterHarvestAmountMultiplier); item.DeleteNumber(item.Number); // at least one. item.ChangeNumber(Math.Max(1, newnum)); } }