Пример #1
0
    /// <summary>
    /// Applies the patches for this mod.
    /// </summary>
    /// <param name="harmony">This mod's harmony instance.</param>
    /// <remarks>Delay until GameLaunched in order to patch other mods....</remarks>
    private void ApplyPatches(Harmony harmony)
    {
        try
        {
            harmony.PatchAll();

            if (this.Helper.ModRegistry.Get("spacechase0.MultiFertilizer") is IModInfo info &&
                info.Manifest.Version.IsOlderThan("1.0.6"))
            {
                this.Monitor.Log("Found MultiFertilizer, applying compat patches", LogLevel.Info);
                HoeDirtPatcher.ApplyPatches(harmony);
                MultiFertilizerDrawTranspiler.ApplyPatches(harmony);
            }
            else
            {
                HoeDirtDrawTranspiler.ApplyPatches(harmony);
            }

            if (!this.Helper.ModRegistry.IsLoaded("spacechase0.MoreGiantCrops"))
            {
                RemoveFarmCheck.ApplyPatches(harmony);
            }

            if (this.Helper.ModRegistry.Get("spacechase0.DynamicGameAssets") is IModInfo dga &&
                dga.Manifest.Version.IsNewerThan("1.4.1"))
            {
                this.Monitor.Log("Found Dynamic Game Assets, applying compat patches", LogLevel.Info);
                CropTranspiler.ApplyDGAPatches(harmony);
            }
        }
Пример #2
0
    /// <summary>
    /// Applies the patches for this mod.
    /// </summary>
    /// <param name="harmony">This mod's harmony instance.</param>
    private void ApplyPatches(Harmony harmony)
    {
        try
        {
            harmony.PatchAll();

            if (this.Helper.ModRegistry.Get("spacechase0.MultiFertilizer") is IModInfo info &&
                info.Manifest.Version.IsOlderThan("1.0.6"))
            {
                this.Monitor.Log("Found MultiFertilizer, applying compat patches", LogLevel.Info);

                HoeDirtPatcher.ApplyPatches(harmony);
                MultiFertilizerDrawTranspiler.ApplyPatches(harmony);
            }
            else
            {
                HoeDirtDrawTranspiler.ApplyPatches(harmony);
            }

            if (!this.Helper.ModRegistry.IsLoaded("Digus.ProducerFrameworkMod"))
            {
                PerformObjectDropInTranspiler.ApplyPatches(harmony);
            }
            else if (this.Helper.ModRegistry.Get("Digus.PFMAutomate") is IModInfo pfmAutomate &&
                     pfmAutomate.Manifest.Version.IsNewerThan("1.4.1"))
            {
                this.Monitor.Log("Found PFMAutomate, transpiling PFM to support that.", LogLevel.Info);
                PFMAutomateTranspilers.ApplyPatches(harmony);
            }

            if (this.Helper.ModRegistry.Get("spacechase0.DynamicGameAssets") is IModInfo dga &&
                dga.Manifest.Version.IsNewerThan("1.4.1"))
            {
                this.Monitor.Log("Found Dynamic Game Assets, applying compat patches", LogLevel.Info);
                FruitTreeDayUpdateTranspiler.ApplyDGAPatch(harmony);
                FruitTreeDrawTranspiler.ApplyDGAPatch(harmony);
                CropHarvestTranspiler.ApplyDGAPatch(harmony);
                SObjectPatches.ApplyDGAPatch(harmony);
            }

            if (this.Helper.ModRegistry.Get("Cherry.MultiYieldCrops") is IModInfo multiYield &&
                multiYield.Manifest.Version.IsNewerThan("1.0.1"))
            {
                this.Monitor.Log("Found MultiYieldCrops, applying compat patches", LogLevel.Info);
                MultiYieldCropsCompat.ApplyPatches(harmony);
            }

            if (this.Helper.ModRegistry.Get("Pathoschild.Automate") is IModInfo automate &&
                automate.Manifest.Version.IsNewerThan("1.25.2"))
            {
                this.Monitor.Log("Found Automate, applying compat patches", LogLevel.Info);
                AutomateTranspiler.ApplyPatches(harmony);
            }

            if (this.Helper.ModRegistry.Get("Satozaki.MillerTime") is IModInfo millerTime &&
                millerTime.Manifest.Version.IsNewerThan("0.99.0"))
            {
                this.Monitor.Log("Found Miller Time, applying compat patches", LogLevel.Info);
                MillerTimeDayUpdateTranspiler.ApplyPatches(harmony);
            }
        }