Ejemplo n.º 1
0
        public VanillaStorytellersWinstonWaves(ModContentPack mod)
        {
            // RNG
            {
                PatchingUtilities.PatchSystemRandCtor("VSEWW.Window_ChooseReward", false);
            }

            // Dialogs
            {
                var type = chooseRewardDialogType = AccessTools.TypeByName("VSEWW.Window_ChooseReward");
                choosenRewardField = AccessTools.FieldRefAccess <Def>(type, "choosenReward");

                type = AccessTools.TypeByName("VSEWW.RewardDef");
                MpCompat.harmony.Patch(AccessTools.Method(type, "DrawCard"),
                                       transpiler: new HarmonyMethod(typeof(VanillaStorytellersWinstonWaves), nameof(ReplaceButton)));
                MP.RegisterSyncMethod(typeof(VanillaStorytellersWinstonWaves), nameof(SyncedChooseReward));

                // The window is always visible and its default position covers MP chat button
                // This patch will move it under the button (if MP is on),
                // especially considering that it'll move up on autosave/joinstate creation
                type = AccessTools.TypeByName("VSEWW.Window_WaveCounter");
                MpCompat.harmony.Patch(AccessTools.Method(type, "SetInitialSizeAndPosition"),
                                       postfix: new HarmonyMethod(typeof(VanillaStorytellersWinstonWaves), nameof(PostSetInitialSizeAndPosition)));

                MP.RegisterPauseLock(PauseIfDialogOpen);
            }

            LongEventHandler.ExecuteWhenFinished(LatePatch);
        }
        public VFESecurity(ModContentPack mod)
        {
            // RNG fix
            {
                var methodNames = new[]
                {
                    "VFESecurity.ArtilleryStrikeArrivalAction_AIBase:Arrived",
                    "VFESecurity.ArtilleryStrikeArrivalAction_Insectoid:StrikeAction",
                    "VFESecurity.ArtilleryStrikeArrivalAction_Map:Arrived",
                    "VFESecurity.ArtilleryStrikeArrivalAction_Outpost:StrikeAction",
                    "VFESecurity.ArtilleryStrikeArrivalAction_PeaceTalks:Arrived",
                    "VFESecurity.ArtilleryStrikeArrivalAction_Settlement:StrikeAction",
                    "VFESecurity.WorldObjectCompProperties_Artillery:ArtilleryCountFor",
                    // ArtilleryStrikeUtility:GetRandomShellFor and ArtilleryStrikeUtility:PotentialStrikeCells are only called by methods that are patched already
                    "VFESecurity.Building_BarbedWire:SpringSub",
                    "VFESecurity.Building_TrapBear:SpringSub",
                    // This one seems like it should have no random calls at all in its hierarchy, but desync traces show that there are actually some.
                    "VFESecurity.Verb_Dazzle:TryCastShot",
                    "NoCamShakeExplosions.DamageWorker_FlameNoCamShake:Apply",
                    "NoCamShakeExplosions.DamageWorker_FlameNoCamShake:ExplosionAffectCell",
                    // Motes
                    "VFESecurity.ExtendedMoteMaker:SearchlightEffect",
                };

                PatchingUtilities.PatchPushPopRand(AccessTools.Method(AccessTools.Inner(AccessTools.TypeByName("VFESecurity.Patch_Building_Trap"), "Spring"), "ShouldDestroy"));
                PatchingUtilities.PatchPushPopRand(methodNames);
                LongEventHandler.ExecuteWhenFinished(LateSyncMethods);
            }
        }
Ejemplo n.º 3
0
        public AlphaBehavioursAndEvents(ModContentPack mod)
        {
            //RNG Fix
            {
                var rngFixConstructors = new[]
                {
                    "AlphaBehavioursAndEvents.CompAnimalProduct",
                    "AlphaBehavioursAndEvents.CompExploder",
                    "AlphaBehavioursAndEvents.CompGasProducer",
                    "AlphaBehavioursAndEvents.CompInitialHediff",
                    "AlphaBehavioursAndEvents.Gas_Ocular",
                    "AlphaBehavioursAndEvents.Hediff_Crushing",

                    //"NewAlphaAnimalSubproducts.CompAnimalProduct ", // System.Random initialized, but not used
                };

                PatchingUtilities.PatchSystemRandCtor(rngFixConstructors, false);

                var rngFixMethods = new[] //System.Random fixes
                {
                    "AlphaBehavioursAndEvents.CompGasProducer:CompTick",
                    "AlphaBehavioursAndEvents.CompAnimalProduct:InformGathered",
                    "AlphaBehavioursAndEvents.CompInitialHediff:CompTickRare",
                    "AlphaBehavioursAndEvents.Gas_Ocular:Tick",
                    "AlphaBehavioursAndEvents.Hediff_Crushing:RandomFilthGenerator",
                    "AlphaBehavioursAndEvents.CompExploder:wickInitializer",
                };
                PatchingUtilities.PatchPushPopRand(rngFixMethods);

                PatchingUtilities.PatchSystemRand("AlphaBehavioursAndEvents.DamageWorker_ExtraInfecter:ApplySpecialEffectsToPart");
            }
        }
        static void LateSyncMethods()
        {
            // Artillery fix
            {
                var type = AccessTools.TypeByName("VFESecurity.CompLongRangeArtillery");

                selectedCompsProperty  = AccessTools.Property(type, "SelectedComps");
                turretProperty         = AccessTools.Property(type, "Turret");
                targetedTileField      = AccessTools.Field(type, "targetedTile");
                resetWarmupTicksMethod = AccessTools.DeclaredMethod(type, "ResetWarmupTicks");

                MP.RegisterSyncMethod(type, "ResetForcedTarget");
                MP.RegisterSyncMethod(typeof(VFESecurity), nameof(SetTargetedTile));

                MpCompat.harmony.Patch(AccessTools.Method(type, "SetTargetedTile"), new HarmonyMethod(typeof(VFESecurity), nameof(Prefix)));
            }

            // RNG fix
            {
                var methods = new[]
                {
                    // ArtilleryComp:TryResolveArtilleryCount is called by ArtilleryComp:CompTick
                    "VFESecurity.ArtilleryComp:BombardmentTick",
                    "VFESecurity.ArtilleryComp:TryStartBombardment",
                    "VFESecurity.Building_Shield:Notify_EnergyDepleted",
                    "VFESecurity.Building_Shield:Draw",
                    "VFESecurity.CompLongRangeArtillery:CompTick",
                };

                PatchingUtilities.PatchPushPopRand(AccessTools.Method("VFESecurity.Building_Shield:AbsorbDamage", new Type[] { typeof(float), typeof(DamageDef), typeof(float) }));
                PatchingUtilities.PatchPushPopRand(methods);
            }
        }
        public VEE(ModContentPack mod)
        {
            var methodsForAll = new[]
            {
                "VEE.DummySpaceBattle:Tick",
                "VEE.HeddifComp_MightJoin:CompPostTick",
                "VEE.Shuttle:Tick",

                // These 4 methods initialize System.Random, but don't use them in any way whatsoever.
                //"VEE.PurpleEvents.GlobalWarming:ChangeBiomes",
                //"VEE.PurpleEvents.GlobalWarming:ChangeTileTemp",
                //"VEE.PurpleEvents.IceAge:ChangeBiomes",
                //"VEE.PurpleEvents.IceAge:ChangeTileTemp",
                "VEE.PurpleEvents.PsychicBloom:Init",

                "VEE.RegularEvents.ApparelPod:TryExecuteWorker",
                "VEE.RegularEvents.CaravanAnimalWI:GenerateGroup",
                "VEE.RegularEvents.Drought:HarmPlant",
                "VEE.RegularEvents.HuntingParty:TryExecuteWorker",
                "VEE.RegularEvents.MeteoriteShower:TryExecuteWorker",
                "VEE.RegularEvents.SpaceBattle:GameConditionTick", // This method was having issues with transpiling no matter what I did, skipping it until it can be fixed
                "VEE.RegularEvents.WeaponPod:TryExecuteWorker",
            };

            PatchingUtilities.PatchSystemRand(methodsForAll, false);
            // This method only calls other methods that use RNG calls
            PatchingUtilities.PatchPushPopRand("VEE.RegularEvents.EarthQuake:TryExecuteWorker");
            // Only patch System.Random out, as this methods is only called by other ones
            PatchingUtilities.PatchSystemRand("VEE.RegularEvents.EarthQuake:DamageInRadius", false);
        }
        public VanillaIdeologyMemes(ModContentPack mod)
        {
            // RNG
            {
                var methods = new[]
                {
                    // Commented out the ones that use seeded random, as they should be fine
                    // If not, then uncommenting those lines should fix it
                    "VanillaMemesExpanded.CompAbilityHarvestBodyParts:Apply",
                    //"VanillaMemesExpanded.VanillaMemesExpanded_GameConditionManager_RegisterCondition_Patch:SendRandomMood",
                    //"VanillaMemesExpanded.VanillaMemesExpanded_GameCondition_Aurora_Init_Patch:SendRandomMood",
                    //"VanillaMemesExpanded.RitualOutcomeEffectWorker_DivineStars:Apply",
                    "VanillaMemesExpanded.RitualOutcomeEffectWorker_SlaveEmancipation:Apply",
                    "VanillaMemesExpanded.RitualOutcomeEffectWorker_ViolentConversion:Apply",
                };

                PatchingUtilities.PatchSystemRand(methods, false);
            }

            // Gizmos
            {
                var type = AccessTools.TypeByName("VanillaMemesExpanded.CompDeconstructJunk");

                MP.RegisterSyncMethod(type, "SetObjectForDeconstruction");
                MP.RegisterSyncMethod(type, "CancelObjectForDeconstruction");
            }
        }
Ejemplo n.º 7
0
        public VEE(ModContentPack mod)
        {
            var methodsForAll = new[]
            {
                "VEE.HeddifComp_MightJoin:CompPostTick",

                "VEE.HuntingParty:TryExecuteWorker",

                // These 4 methods initialize System.Random, but don't use them in any way whatsoever.
                //"VEE.PurpleEvents.GlobalWarming:ChangeBiomes",
                //"VEE.PurpleEvents.GlobalWarming:ChangeTileTemp",
                //"VEE.PurpleEvents.IceAge:ChangeBiomes",
                //"VEE.PurpleEvents.IceAge:ChangeTileTemp",
                "VEE.PurpleEvents.PsychicBloom:Init",

                "VEE.RegularEvents.ApparelPod:TryExecuteWorker",
                "VEE.RegularEvents.CaravanAnimalWI:GenerateGroup",
                "VEE.RegularEvents.MeteoriteShower:TryExecuteWorker",
                "VEE.RegularEvents.WeaponPod:TryExecuteWorker",
            };

            PatchingUtilities.PatchSystemRand(methodsForAll, false);
            // This method only calls other methods that use RNG calls
            PatchingUtilities.PatchPushPopRand("VEE.RegularEvents.EarthQuake:TryExecuteWorker");
            // Only patch System.Random out, as this methods is only called by other ones
            PatchingUtilities.PatchSystemRand("VEE.RegularEvents.EarthQuake:DamageInRadius", false);

            // Unity RNG
            PatchingUtilities.PatchUnityRand("VEE.Shuttle:Tick");

            LongEventHandler.ExecuteWhenFinished(LatePatch);
        }
        public AlphaBehavioursAndEvents(ModContentPack mod)
        {
            //RNG Fix
            {
                var rngFixConstructors = new[]
                {
                    "AlphaBehavioursAndEvents.DeathActionWorker_ExplodeAndSpawnEggs",
                    "AlphaBehavioursAndEvents.Hediff_Crushing",

                    // Ocular plant conversion
                    "AlphaBehavioursAndEvents.CompAbilityOcularConversion",
                    "AlphaBehavioursAndEvents.Gas_Ocular",
                };

                PatchingUtilities.PatchSystemRandCtor(rngFixConstructors, false);

                var rngFixMethods = new[] //System.Random fixes
                {
                    "AlphaBehavioursAndEvents.Hediff_Crushing:RandomFilthGenerator",

                    // Ocular plant conversion
                    "AlphaBehavioursAndEvents.CompAbilityOcularConversion:Apply",
                    "AlphaBehavioursAndEvents.Gas_Ocular:Tick",
                };
                PatchingUtilities.PatchPushPopRand(rngFixMethods);
            }
        }
Ejemplo n.º 9
0
 public AlphaMemes(ModContentPack mod)
 {
     PatchingUtilities.PatchSystemRand("AlphaMemes.AlphaMemes_DamageWorker_AddInjury_Apply_Patch:SendHistoryIfMelee", false);
     // The following method is seeded, so it should be fine
     // If not, then patching it as well should fix it
     //"AlphaMemes.GameComponent_RandomMood:GameComponentTick",
 }
Ejemplo n.º 10
0
        public RunandGun(ModContentPack mod)
        {
            Type type = AccessTools.TypeByName("RunAndGun.Harmony.Pawn_DraftController_GetGizmos_Patch");

            MP.RegisterSyncDelegate(type, "<>c__DisplayClass0_0", "<Postfix>b__1");

            PatchingUtilities.PatchSystemRand("RunAndGun.Harmony.MentalStateHandler_TryStartMentalState:shouldRunAndGun", false);
        }
        public VanillaPlantsMorePlants(ModContentPack mod)
        {
            PatchingUtilities.PatchSystemRand("VanillaPlantsExpandedMorePlants.Plant_SowsAdjacent:SpawnSetup", false);
            PatchingUtilities.PatchSystemRand("VanillaPlantsExpandedMorePlants.Plant_TransformOnMaturity:TickLong", false);

            MpCompat.RegisterLambdaMethod("VanillaPlantsExpandedMorePlants.Zone_GrowingAquatic", "GetGizmos", 1, 3);
            MpCompat.RegisterLambdaMethod("VanillaPlantsExpandedMorePlants.Zone_GrowingSandy", "GetGizmos", 1, 3);
        }
Ejemplo n.º 12
0
        public AnimaObelisk(ModContentPack mod)
        {
            var type = AccessTools.TypeByName("PsyObelisk.Things.ThingComp_PsyObelisk");

            PatchingUtilities.PatchUnityRand(AccessTools.Method(type, "GlowAround"), false);
            var syncMethods = MpCompat.RegisterLambdaMethod(type, "CompGetGizmosExtra", Enumerable.Range(0, 8).ToArray()); // 0 to 7

            syncMethods.Skip(2).SetDebugOnly();
        }
        public VanillaIdeologyDryads(ModContentPack mod)
        {
            // RNG
            PatchingUtilities.PatchSystemRandCtor("VanillaIdeologyExpanded_Dryads.HediffComp_PeriodicWounds");

            // Gizmos
            MP.RegisterSyncMethod(AccessTools.TypeByName("VanillaIdeologyExpanded_Dryads.CompPawnMerge"), "SetDryadAwakenPod");
            MpCompat.RegisterLambdaMethod("VanillaIdeologyExpanded_Dryads.CompSpawnAwakened", "CompGetGizmosExtra", 0).SetDebugOnly();
        }
        public WitcherMonsterHunt(ModContentPack mod)
        {
            var methods = new[]
            {
                "WMHAnimalBehaviours.DamageWorker_ExtraInfecter:ApplySpecialEffectsToPart",
                "WMHAnimalBehaviours.IncidentWorker_MonsterEncounter:TryExecuteWorker",
            };

            PatchingUtilities.PatchSystemRand(methods, false);
        }
        public Reunion(ModContentPack mod)
        {
            var methods = new[]
            {
                "Kyrun.Reunion.GameComponent:GetRandomAllyForSpawning",
                "Kyrun.Reunion.GameComponent:TryScheduleNextEvent",
                "Kyrun.Reunion.GameComponent:DecideAndDoEvent",
            };

            PatchingUtilities.PatchUnityRand(methods);
        }
        public VanillaFurnitureExpanded(ModContentPack mod)
        {
            var methods = new[]
            {
                "AOMoreFurniture.JobDriver_PlayComputerIndustrial:WatchTickAction",
                "AOMoreFurniture.JobDriver_PlayComputerModern:WatchTickAction",
                "AOMoreFurniture.JobDriver_PlayArcadeSounds:WatchTickAction",
                "AOMoreFurniture.JobDriver_PlayPunchingBag:WatchTickAction",
            };

            PatchingUtilities.PatchSystemRand(methods, false);
        }
Ejemplo n.º 17
0
        public VanillaFactionsVikings(ModContentPack mod)
        {
            LongEventHandler.ExecuteWhenFinished(LatePatch);

            // Debug stuff
            var type = AccessTools.TypeByName("VFEV.Apiary");

            MpCompat.RegisterSyncMethodsByIndex(type, "<GetGizmos>", 0, 1).Do(m => m.SetDebugOnly());

            // This method seems unused... But I guess it's better to be safe than sorry.
            PatchingUtilities.PatchSystemRand(AccessTools.Method(type, "ResetTend"), false);
        }
Ejemplo n.º 18
0
        public VanillaGeneticsExpanded(ModContentPack mod)
        {
            // Sync worker
            {
                var type = AccessTools.TypeByName("GeneticRim.Command_SetGenomeList");

                setGenomeListMap      = AccessTools.FieldRefAccess <Map>(type, "map");
                setGenomeListBuilding = AccessTools.FieldRefAccess <Building>(type, "building");

                MP.RegisterSyncWorker <Command>(SyncCommand, type, shouldConstruct: true);
            }

            // RNG
            {
                var constructors = new[]
                {
                    "GeneticRim.CompExploder",
                    "GeneticRim.HediffComp_PeriodicWounds",
                };

                PatchingUtilities.PatchSystemRandCtor(constructors, false);
            }

            // Gizmos
            {
                // Archocentipide former - start and (dev) finish gizmos
                MpCompat.RegisterLambdaMethod("GeneticRim.Building_ArchocentipedeFormer", "GetGizmos", 0, 1)[1].SetDebugOnly();

                // Archowomb - awaken confirmation and (dev) finish gizmo
                MpCompat.RegisterLambdaMethod("GeneticRim.Building_ArchoWomb", "GetGizmos", 1, 2)[1].SetDebugOnly();

                // Mechahybridizer - (dev) finish gizmo
                MpCompat.RegisterLambdaMethod("GeneticRim.Building_Mechahybridizer", "GetGizmos", 0).SetDebugOnly();

                // Age related disease dev gizmo
                MpCompat.RegisterLambdaMethod("GeneticRim.CompApplyAgeDiseases", "GetGizmos", 0).SetDebugOnly();

                // DNA storage bank and mechahybridizer gizmos
                var type = AccessTools.TypeByName("GeneticRim.ArchotechExtractableAnimals_MapComponent");
                MP.RegisterSyncMethod(type, "AddAnimalToCarry");
                MP.RegisterSyncMethod(type, "AddParagonToCarry");

                // DNA storage bank gizmo
                MpCompat.RegisterLambdaDelegate("GeneticRim.Command_SetGenomeList", "ProcessInput", 2);
            }

            // Float menu
            {
                MpCompat.RegisterLambdaDelegate("GeneticRim.CompArchotechGrowthCell", "CompFloatMenuOptions", 0);
            }

            LongEventHandler.ExecuteWhenFinished(LatePatch);
        }
        public VFEF(ModContentPack mod)
        {
            //RNG Fix
            {
                var methods = new[] {
                    "VFEF.MoteSprinkler:NewMote",
                    "VFEF.MoteSprinkler:ThrowWaterSpray",
                };

                PatchingUtilities.PatchPushPopRand(methods);
            }
        }
Ejemplo n.º 20
0
        public VanillaFactionsSettlers(ModContentPack mod)
        {
            var type = AccessTools.TypeByName("VFE_Settlers.Utilities.UtilityEvent");

            // Protection fee event
            MP.RegisterSyncDialogNodeTree(type, "ProtectionFee");
            // Caravan gizmo - turn in wanted criminal to settlement
            MP.RegisterSyncDelegate(type, "<>c__DisplayClass8_0", "<CommandTurnInWanted>b__0");
            // Toggle mode
            MpCompat.RegisterSyncMethodByIndex(AccessTools.TypeByName("Warmup.CompWarmUpReduction"), "<CompGetGizmosExtra>", 1);
            // Five fingers fillet table
            PatchingUtilities.PatchUnityRand("VFE_Settlers.JobGivers.JobDriver_PlayFiveFingerFillet:WatchTickAction", false);
        }
Ejemplo n.º 21
0
        public WhatTheHack(ModContentPack mod)
        {
            var methods = new[]
            {
                AccessTools.Method(AccessTools.TypeByName("WhatTheHack.Harmony.IncidentWorker_Raid_TryExecuteWorker"), "SpawnHackedMechanoids"),
                AccessTools.Method(AccessTools.TypeByName("WhatTheHack.Harmony.Pawn_JobTracker_DetermineNextJob"), "HackedPoorlyEvent"),
                AccessTools.Method(AccessTools.TypeByName("WhatTheHack.Harmony.Thing_ButcherProducts"), "GenerateExtraButcherProducts"),
                AccessTools.Method(AccessTools.TypeByName("WhatTheHack.Needs.Need_Maintenance"), "MaybeUnhackMechanoid"),
                AccessTools.Method(AccessTools.TypeByName("WhatTheHack.Recipes.Recipe_Hacking"), "CheckHackingFail"),
            };

            PatchingUtilities.PatchSystemRand(methods, false);
        }
 public AlphaBehavioursAndEvents(ModContentPack mod)
 {
     //RNG Fix
     {
         var rngFixMethods = new[] { //System.Random fixes
             "AlphaBehavioursAndEvents.CompGasProducer:CompTick",
             "AlphaBehavioursAndEvents.CompAnimalProduct:InformGathered",
             "AlphaBehavioursAndEvents.CompInitialHediff:CompTickRare",
             "AlphaBehavioursAndEvents.Gas_Ocular:Tick",
             "AlphaBehavioursAndEvents.Hediff_Crushing:RandomFilthGenerator",
         };
         PatchingUtilities.PatchSystemRand(rngFixMethods);
     }
 }
Ejemplo n.º 23
0
        public FertileFieldsCompat(ModContentPack mod)
        {
            {
                // RNG
                PatchingUtilities.PatchSystemRand("RFF_Code.Building_CompostBin:PlaceProduct");
            }

            Type type = GrowZoneManagerType = AccessTools.TypeByName("RFF_Code.GrowZoneManager");

            MP.RegisterSyncMethod(type, "ToggleReturnToSoil");
            MP.RegisterSyncMethod(type, "ToggleDesignateReplacements");

            MP.RegisterSyncWorker <MapComponent>(SyncWorkerForGrowZoneManager, type);
        }
Ejemplo n.º 24
0
        public Desynchronized(ModContentPack mod)
        {
            var rngFixMethods = new[]
            {
                "Desynchronized.TNDBS.Pawn_NewsKnowledgeTracker:ForgetRandom",
                "Desynchronized.TNDBS.Pawn_NewsKnowledgeTracker:ForgetRandomly",
                "Desynchronized.TNDBS.Utilities.NewsSpreadUtility:SelectNewsRandomly",
                "Desynchronized.TNDBS.Utilities.NewsSpreadUtility:SelectNewsDistinctly",
                "Desynchronized.Patches.NewsTransmit.PostFix_InteractionWorker:ExecuteNewsTarnsmission",
                "Desynchronized.TNDBS.TaleNewsPawnDied:CalculateNewsImportanceForPawn",
            };

            PatchingUtilities.PatchPushPopRand(rngFixMethods);
        }
Ejemplo n.º 25
0
        public VanillaFactionsSettlers(ModContentPack mod)
        {
            var type = AccessTools.TypeByName("VFE_Settlers.Utilities.UtilityEvent");

            // Protection fee event
            NodeTreeDialogSync.EnableNodeTreeDialogSync();
            MpCompat.harmony.Patch(AccessTools.Method(type, "ProtectionFee"), prefix: NodeTreeDialogSync.HarmonyMethodMarkDialogAsOpen);
            // Caravan gizmo - turn in wanted criminal to settlement
            MP.RegisterSyncDelegate(type, "<>c__DisplayClass8_0", "<CommandTurnInWanted>b__0");
            // Dev mode set progress to 1
            MpCompat.RegisterSyncMethodByIndex(AccessTools.TypeByName("VFE_Settlers.Buildings.Building_ChemshineBarrel"), "<GetGizmos>", 0);
            // Toggle mode
            MpCompat.RegisterSyncMethodByIndex(AccessTools.TypeByName("VanillaFactionsExpandedSettlers.CompWarmUpReduction"), "<CompGetGizmosExtra>", 1);
            // Five fingers fillet table
            PatchingUtilities.PatchUnityRand("VFE_Settlers.JobGivers.JobDriver_PlayFiveFingerFillet:WatchTickAction", false);
        }
Ejemplo n.º 26
0
        private static void LatePatch()
        {
            var types = new[]
            {
                "VSEWW.MapComponent_Winston:SetNextNormalRaidInfo",
                "VSEWW.MapComponent_Winston:SetNextBossRaidInfo",
                "VSEWW.NextRaidInfo:WavePawns",
                "VSEWW.NextRaidInfo:ChooseAndApplyModifier",
            };

            PatchingUtilities.PatchSystemRand(types, false);

            var type = AccessTools.TypeByName("VSEWW.MapComponent_Winston");

            MP.RegisterSyncMethod(type, "ExecuteRaid");
        }
        public ExplosiveTrailsEffect(ModContentPack mod)
        {
            if (isApplied)
            {
                return;
            }

            isApplied = true;

            var methodNames = new[]
            {
                "ExplosiveTrailsEffect.ExhaustFlames:ThrowRocketExhaustFlame",
                "ExplosiveTrailsEffect.SmokeThrowher:ThrowSmokeTrail",
            };

            PatchingUtilities.PatchPushPopRand(methodNames);
        }
        public VanillaExpandedFramework(ModContentPack mod)
        {
            var type = AccessTools.TypeByName("ItemProcessor.Building_ItemProcessor");

            // _1, _5 and _7 are used to check if gizmo should be enabled, so we don't sync them
            MpCompat.RegisterSyncMethodsByIndex(type, "<GetGizmos>", 0, 2, 3, 4, 6, 8, 9, 10);

            type = AccessTools.TypeByName("ItemProcessor.Command_SetQualityList");
            MP.RegisterSyncWorker <Command>(SyncCommandWithBuilding, type, shouldConstruct: true);
            MpCompat.RegisterSyncMethodsByIndex(type, "<ProcessInput>", Enumerable.Range(0, 8).ToArray());

            type = AccessTools.TypeByName("ItemProcessor.Command_SetOutputList");
            MP.RegisterSyncWorker <Command>(SyncCommandWithBuilding, type, shouldConstruct: true);
            MP.RegisterSyncMethod(type, "TryConfigureIngredientsByOutput");

            // Keep an eye on this in the future, seems like something the devs could combine into a single class at some point
            foreach (var ingredientNumber in new[] { "First", "Second", "Third", "Fourth" })
            {
                type = AccessTools.TypeByName($"ItemProcessor.Command_Set{ingredientNumber}ItemList");
                MP.RegisterSyncWorker <Command>(SyncSetIngredientCommand, type, shouldConstruct: true);
                MP.RegisterSyncMethod(type, $"TryInsert{ingredientNumber}Thing");
                MpCompat.RegisterSyncMethodsByIndex(type, "<ProcessInput>", 0);
            }

            // AddHediff desyncs with Arbiter, but seems fine without it
            PatchingUtilities.PatchPushPopRand("VanillaCookingExpanded.Thought_Hediff:MoodOffset");

            type = AccessTools.TypeByName("VFECore.CompPawnDependsOn");
            MpCompat.RegisterSyncMethodByIndex(type, "<CompGetGizmosExtra>", 0).SetDebugOnly();

            type = AccessTools.TypeByName("VanillaFurnitureExpanded.CompConfigurableSpawner");
            MpCompat.RegisterSyncMethodByIndex(type, "<CompGetGizmosExtra>", 0).SetDebugOnly();

            type = AccessTools.TypeByName("VanillaFurnitureExpanded.Command_SetItemsToSpawn");
            MP.RegisterSyncDelegate(type, "<>c__DisplayClass2_0", "<ProcessInput>b__1");

            type = AccessTools.TypeByName("VanillaFurnitureExpanded.CompRockSpawner");
            MpCompat.RegisterSyncMethodByIndex(type, "<CompGetGizmosExtra>", 0);

            type = AccessTools.TypeByName("VanillaFurnitureExpanded.Command_SetStoneType");
            setStoneBuildingField = AccessTools.Field(type, "building");
            MpCompat.RegisterSyncMethodByIndex(type, "<ProcessInput>", 0);
            MP.RegisterSyncWorker <Command>(SyncSetStoneTypeCommand, type, shouldConstruct: true);
            MP.RegisterSyncDelegate(type, "<>c__DisplayClass2_0", "<ProcessInput>b__1");
        }
        public CommonSense(ModContentPack mod)
        {
            var type = AccessTools.TypeByName("CommonSense.CompUnloadChecker");

            // We need to make a sync worker for this Comp, as it is initialized dynamically and might not exists at the time
            MP.RegisterSyncWorker <ThingComp>(SyncComp, type);
            shouldUnloadSyncField = MP.RegisterSyncField(AccessTools.Field(type, "ShouldUnload"));
            // The GetChecker method either gets an existing, or creates a new comp
            getCompUnlockerCheckerMethod = AccessTools.Method(type, "GetChecker");

            // Watch unload bool changes
            MpCompat.harmony.Patch(AccessTools.Method("CommonSense.Utility:DrawThingRow"),
                                   prefix: new HarmonyMethod(typeof(CommonSense), nameof(CommonSensePatchPrefix)),
                                   postfix: new HarmonyMethod(typeof(CommonSense), nameof(CommonSensePatchPostix)));

            // RNG Patch
            PatchingUtilities.PatchUnityRand("CommonSense.JobGiver_Wander_TryGiveJob_CommonSensePatch:Postfix", false);
        }
Ejemplo n.º 30
0
        public VFEF(ModContentPack mod)
        {
            //RNG Fix
            {
                var methods = new[] {
                    "VFEF.MoteSprinkler:NewMote",
                    "VFEF.MoteSprinkler:ThrowWaterSpray",
                };

                PatchingUtilities.PatchPushPopRand(methods);
            }

            // Gizmo fix
            {
                // Toggle should scarecrow affect tamed/player animals
                MpCompat.RegisterLambdaMethod("VFEF.Building_Scarecrow", "GetGizmos", 1);
            }
        }