Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Chaotic Company v1.0.1
Plugins/ChaoticCompany.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using ChaoticCompany.Patches; using ChaoticCompany.Patches.AIPatch; using ChaoticCompany.Patches.Items; using GameNetcodeStuff; using HarmonyLib; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ChaoticCompany")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HP Inc.")] [assembly: AssemblyProduct("ChaoticCompany")] [assembly: AssemblyCopyright("Copyright © HP Inc. 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("6427ddb7-6211-4b67-8400-d02833eea9e8")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace ChaoticCompany { [BepInPlugin("Chaotic_Company", "Chaotic_Company", "1.0.1")] public class ChaoticCompany : BaseUnityPlugin { private const string modGUID = "Chaotic_Company"; private const string modName = "Chaotic_Company"; private const string modVersion = "1.0.1"; private readonly Harmony harmony = new Harmony("Chaotic_Company"); private static ChaoticCompany Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Chaotic_Company"); mls.LogInfo((object)"garfeild"); harmony.PatchAll(typeof(ChaoticCompany)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(TimeOfDayPatch)); harmony.PatchAll(typeof(TerminalPatch)); harmony.PatchAll(typeof(ItemDropshipPatch)); harmony.PatchAll(typeof(ExtensionLadderItemPatch)); harmony.PatchAll(typeof(FlashlightItemPatch)); harmony.PatchAll(typeof(GrabbableObjectPatch)); harmony.PatchAll(typeof(JetpackItemPatch)); harmony.PatchAll(typeof(PatcherToolPatch)); harmony.PatchAll(typeof(ShovelPatch)); harmony.PatchAll(typeof(StunGrenadeItemPatch)); harmony.PatchAll(typeof(BaboonAIPatch)); harmony.PatchAll(typeof(BlobAIPatch)); harmony.PatchAll(typeof(CentipedeAIPatch)); harmony.PatchAll(typeof(CrawlerAIPatch)); harmony.PatchAll(typeof(DocileLocustAIPatch)); harmony.PatchAll(typeof(DoubleWingPatch)); harmony.PatchAll(typeof(DressGirlAIPatch)); harmony.PatchAll(typeof(FlowerManAIPatch)); harmony.PatchAll(typeof(ForestGiantAIPatch)); harmony.PatchAll(typeof(HoarderBugAIPatch)); harmony.PatchAll(typeof(JesterAIPatch)); harmony.PatchAll(typeof(MouthDogAIPatch)); harmony.PatchAll(typeof(NutcrackerAIPatch)); harmony.PatchAll(typeof(PufferAIPatch)); harmony.PatchAll(typeof(RedLocustBeesPatch)); harmony.PatchAll(typeof(SandSpiderAIPatch)); harmony.PatchAll(typeof(SandWormAIPatch)); harmony.PatchAll(typeof(SpringManAIPatch)); harmony.PatchAll(typeof(TurretAIPatch)); harmony.PatchAll(typeof(RoundManagerPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); } } } namespace ChaoticCompany.Patches { internal class HangerShipDoorPatch { } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { private static float sprintSpeed; private const string modGUID = "someRandomASSNameICantThinkOfButRando"; [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnStart(ref float ___sprintTime, ref float ___jumpForce, ref int ___health) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___sprintTime = random.Next(0, 15); ___jumpForce = (float)random.Next(50, 500) / 10f; ___health = random.Next(0, 200); sprintSpeed = random.Next(0, 21); if (sprintSpeed < 21f) { sprintSpeed /= 7f; } } [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref float ___sprintMultiplier) { Random random = new Random(); ___sprintMultiplier = sprintSpeed; } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("LoadNewLevel")] [HarmonyPrefix] private static void LoadNewLevelPatch(ref float ___scrapValueMultiplier, ref float ___scrapAmountMultiplier, ref float ___mapSizeMultiplier, ref int ___minEnemiesToSpawn) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___scrapValueMultiplier = (float)random.Next(1, 9) / 3f; ___scrapAmountMultiplier = (float)random.Next(1, 9) / 3f; ___mapSizeMultiplier = (float)random.Next(1, 15) / 5f; ___minEnemiesToSpawn = random.Next(1, 5); } [HarmonyPatch("Awake")] [HarmonyPrefix] private static void AwakePatch(ref int ___increasedMapHazardSpawnRateIndex, ref int ___increasedMapPropSpawnRateIndex, ref int ___increasedInsideEnemySpawnRateIndex, ref int ___increasedOutsideEnemySpawnRateIndex, ref int ___increasedScrapSpawnRateIndex, ref SelectableLevel ___currentLevel) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___increasedMapHazardSpawnRateIndex = random.Next(0, ___currentLevel.spawnableMapObjects.Length); ___increasedScrapSpawnRateIndex = random.Next(0, ___currentLevel.spawnableScrap.Count); ___increasedOutsideEnemySpawnRateIndex = random.Next(0, ___currentLevel.spawnableOutsideObjects.Length); ___increasedMapPropSpawnRateIndex = random.Next(0, ___currentLevel.spawnableOutsideObjects.Length); ___increasedInsideEnemySpawnRateIndex = random.Next(0, ___currentLevel.Enemies.Count); } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { private static int newLevelID; [HarmonyPatch("openingDoorsSequence")] [HarmonyPostfix] private static void LoadNewLevelPatch(ref SelectableLevel ___currentLevel) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(Guid.NewGuid().GetHashCode()); WeatherEffect val = TimeOfDay.Instance.effects[___currentLevel.currentWeather]; ___currentLevel.currentWeather = (LevelWeatherType)0; val = TimeOfDay.Instance.effects[___currentLevel.currentWeather]; val.effectEnabled = true; if ((Object)(object)val.effectPermanentObject != (Object)null) { val.effectPermanentObject.SetActive(true); } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref SelectableLevel ___currentLevel, ref int defaultPlanet) { Random random = new Random(Guid.NewGuid().GetHashCode()); TimeOfDay val = Object.FindObjectOfType<TimeOfDay>(); val.quotaVariables.deadlineDaysAmount = random.Next(1, 7); val.quotaVariables.baseIncrease = random.Next(-50, 50) * val.quotaVariables.deadlineDaysAmount; val.quotaVariables.increaseSteepness = random.Next(0, 10); val.quotaVariables.startingQuota = random.Next(0, 500); } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnStart(ref int ___groupCredits) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___groupCredits = random.Next(-100, 500); } } [HarmonyPatch(typeof(TimeOfDay))] internal class TimeOfDayPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnStart(ref SelectableLevel ___currentLevel, ref int ___numberOfHours) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(Guid.NewGuid().GetHashCode()); ___currentLevel.DaySpeedMultiplier = (float)random.Next(1, 6) / 2f; ___currentLevel.currentWeather = (LevelWeatherType)0; ___numberOfHours = random.Next(1, 15); } [HarmonyPatch("Awake")] [HarmonyPostfix] private static void ValueChangeOnAwake(ref QuotaSettings ___quotaVariables) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___quotaVariables.deadlineDaysAmount = random.Next(1, 7); ___quotaVariables.baseIncrease = random.Next(-50, 50) * ___quotaVariables.deadlineDaysAmount; ___quotaVariables.increaseSteepness = random.Next(0, 10); } } } namespace ChaoticCompany.Patches.Items { [HarmonyPatch(typeof(ExtensionLadderItem))] internal class ExtensionLadderItemPatch { [HarmonyPatch("LadderAnimation")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref float ___extendAmount) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___extendAmount = random.Next(1, 360); } } [HarmonyPatch(typeof(FlashlightItem))] internal class FlashlightItemPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref float ___initialIntensity) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___initialIntensity = random.Next(0, 180); } } [HarmonyPatch(typeof(GrabbableObject))] internal class GrabbableObjectPatch { [HarmonyPatch("SetScrapValue")] [HarmonyPostfix] private static void ValueChangeOnStart(ref int ___scrapValue, ref GameObject ___gameObject) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___scrapValue = random.Next(-100, 225); ScanNodeProperties componentInChildren = ___gameObject.GetComponentInChildren<ScanNodeProperties>(); componentInChildren.subText = $"Value: ${___scrapValue}"; componentInChildren.scrapValue = ___scrapValue; } } [HarmonyPatch(typeof(ItemDropship))] internal class ItemDropshipPatch { [HarmonyPatch("OpenShipDoorsOnServer")] [HarmonyPrefix] private static void OpenShipDoorsOnServer(ref bool ___shipLanded, ref bool ___shipDoorsOpened, ref List<int> ___itemsToDeliver, ref Terminal ___terminalScript, ref Transform[] ___itemSpawnPositions, ref StartOfRound ___playersManager) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(Guid.NewGuid().GetHashCode()); if (___shipLanded && !___shipDoorsOpened) { int num = 0; for (int i = 0; i < ___itemsToDeliver.Count; i++) { GameObject val = Object.Instantiate<GameObject>(___terminalScript.buyableItemsList[random.Next(0, ___terminalScript.buyableItemsList.Length)].spawnPrefab, ___itemSpawnPositions[num].position, Quaternion.identity, ___playersManager.propsContainer); val.GetComponent<GrabbableObject>().fallTime = 0f; val.GetComponent<NetworkObject>().Spawn(false); num = ((num < 3) ? (num + 1) : 0); } ___itemsToDeliver.Clear(); } } } [HarmonyPatch(typeof(JetpackItem))] internal class JetpackItemPatch { private static float jepPackPowerMult; [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnStart(ref Vector3 ___forces, ref PlayerControllerB ___playerHeldBy, ref float ___jetpackPower) { Random random = new Random(Guid.NewGuid().GetHashCode()); jepPackPowerMult = (float)random.Next(-10, 10) / 3f; } [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref Vector3 ___forces, ref PlayerControllerB ___playerHeldBy, ref float ___jetpackPower) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(Guid.NewGuid().GetHashCode()); ___forces = Vector3.Lerp(___forces, Vector3.ClampMagnitude(((Component)___playerHeldBy).transform.up * ___jetpackPower * jepPackPowerMult, 400f * jepPackPowerMult), Time.deltaTime); PlayerControllerB obj = ___playerHeldBy; obj.externalForces += ___forces; } } internal class PatcherToolPatch { } [HarmonyPatch(typeof(Shovel))] internal class ShovelPatch { [HarmonyPatch("ItemActivate")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref int ___shovelHitForce) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___shovelHitForce = random.Next(0, 10); } } [HarmonyPatch(typeof(StunGrenadeItem))] internal class StunGrenadeItemPatch { [HarmonyPatch("ItemActivate")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref float ___TimeToExplode) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___TimeToExplode = (float)random.Next(0, 1000) / 100f; } [HarmonyPatch("StunExplosion")] [HarmonyPostfix] private static void StunExplosionChange(ref float ___flashSeverityDistanceRolloff) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___flashSeverityDistanceRolloff = (float)random.Next(0, 200) / 100f; } } } namespace ChaoticCompany.Patches.AIPatch { [HarmonyPatch(typeof(BaboonBirdAI))] internal class BaboonAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0f) { ___agent.speed = random.Next(1, 20); } } } [HarmonyPatch(typeof(BlobAI))] internal class BlobAIPatch { private static float freq; private static float timeIncrease; private static float jiggleMaxxingDensity; private static float jiggleMaxxingAmp; private static float maxspeed; [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnStart() { Random random = new Random(Guid.NewGuid().GetHashCode()); freq = random.Next(0, 10); timeIncrease = random.Next(0, 20); jiggleMaxxingDensity = (float)random.Next(0, 40) / 10f; jiggleMaxxingAmp = (float)random.Next(0, 10) / 10f; maxspeed = (float)random.Next(0, 100) / 10f; } [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref float ___slimeJiggleAmplitude, ref float ___slimeJiggleDensity, ref Material ___thisSlimeMaterial, ref NavMeshAgent ___agent) { ___thisSlimeMaterial.SetFloat("_Frequency", freq); ___slimeJiggleDensity = Mathf.Lerp(___slimeJiggleDensity, jiggleMaxxingDensity, timeIncrease * Time.deltaTime); ___thisSlimeMaterial.SetFloat("_Ripple_Density", ___slimeJiggleDensity); ___slimeJiggleAmplitude = Mathf.Lerp(___slimeJiggleAmplitude, jiggleMaxxingAmp, timeIncrease * Time.deltaTime); ___thisSlimeMaterial.SetFloat("_Amplitude", ___slimeJiggleAmplitude); if (___agent.speed > 0.01f) { ___agent.stoppingDistance = 5f; ___agent.speed = Mathf.Lerp(___agent.speed, maxspeed, 0.7f * Time.deltaTime); } } } [HarmonyPatch(typeof(CentipedeAI))] internal class CentipedeAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref float ___BaseAcceleration, ref float ___SpeedAccelerationEffect, ref float ___SpeedIncreaseRate) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___BaseAcceleration = random.Next(1, 110); ___SpeedAccelerationEffect = random.Next(1, 4); ___SpeedIncreaseRate = random.Next(1, 10); } } [HarmonyPatch(typeof(CrawlerAI))] internal class CrawlerAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0f) { ___agent.speed = random.Next(1, 20); } } } [HarmonyPatch(typeof(DocileLocustBeesAI))] internal class DocileLocustAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnStart() { } } [HarmonyPatch(typeof(DoublewingAI))] internal class DoubleWingPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnStart(ref Animator ___creatureAnimator, ref float ___glideTime) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___creatureAnimator.SetFloat("speedMultiplier", Random.Range(20f, 50.3f)); ___glideTime = Random.Range(0f, 10.3f); } [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0.1f) { ___agent.speed = 20f; } } } [HarmonyPatch(typeof(DressGirlAI))] internal class DressGirlAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0f) { ___agent.speed = random.Next(1, 20); } } } [HarmonyPatch(typeof(FlowermanAI))] internal class FlowerManAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0f) { ___agent.speed = random.Next(1, 20); } } } [HarmonyPatch(typeof(ForestGiantAI))] internal class ForestGiantAIPatch { private static float newSpeed; [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnStart(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); newSpeed = random.Next(1, 10); } [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if ((double)___agent.speed < 0.1) { ___agent.speed = newSpeed; } } } [HarmonyPatch(typeof(JesterAI))] internal class JesterAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0f) { ___agent.speed = random.Next(1, 20); } } [HarmonyPatch("SetJesterInitialValues")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref float ___popUpTimer, ref float ___beginCrankingTimer, ref Animator ___creatureAnimator) { ___popUpTimer = Random.Range(2f, 50f); ___beginCrankingTimer = Random.Range(2f, 52f); ___creatureAnimator.SetFloat("CrankSpeedMultiplier", Random.Range(0.1f, 3f)); } } [HarmonyPatch(typeof(MouthDogAI))] internal class MouthDogAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0f) { ___agent.speed = random.Next(1, 20); } } [HarmonyPatch("SearchForPreviouslyHeardSound")] [HarmonyPostfix] private static void ValueChangeOnSearch(ref float ___noiseApproximation) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___noiseApproximation = random.Next(0, 42); } [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnStart(ref float ___suspicionThreshold, ref float ___alertThreshold, ref float ___maxSuspicionLevel) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___suspicionThreshold = random.Next(0, 42); ___alertThreshold = random.Next(0, 42); ___maxSuspicionLevel = random.Next(0, 42); } } [HarmonyPatch(typeof(NutcrackerEnemyAI))] internal class NutcrackerAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0f) { ___agent.speed = random.Next(1, 20); } } } [HarmonyPatch(typeof(PufferAI))] internal class PufferAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0f) { ___agent.speed = random.Next(1, 20); } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnStart(ref GameObject ___smokePrefab) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(Guid.NewGuid().GetHashCode()); ___smokePrefab.transform.localScale = new Vector3((float)random.Next(1, 40) / 10f, (float)random.Next(1, 40) / 10f, (float)random.Next(1, 40) / 10f); } } [HarmonyPatch(typeof(RedLocustBees))] internal class RedLocustBeesPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0f) { ___agent.speed = random.Next(1, 20); } } [HarmonyPatch("DoAIInterval")] [HarmonyPrefix] private static void ValueChangeOnEarlyUpdate(ref int ___defenseDistance) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___defenseDistance = random.Next(1, 100); } } [HarmonyPatch(typeof(SandSpiderAI))] internal class SandSpiderAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0f) { ___agent.speed = random.Next(1, 20); } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnStart(ref int ___maxWebTrapsToPlace) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___maxWebTrapsToPlace = random.Next(1, 11); if (___maxWebTrapsToPlace >= 10) { ___maxWebTrapsToPlace = 50; } } } [HarmonyPatch(typeof(SandWormAI))] internal class SandWormAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0f) { ___agent.speed = random.Next(1, 20); } } } [HarmonyPatch(typeof(SpringManAI))] internal class SpringManAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0f) { ___agent.speed = random.Next(1, 20); } } } [HarmonyPatch(typeof(Turret))] internal class TurretAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref float ___rotationRange, ref float ___rotationSpeed) { Random random = new Random(Guid.NewGuid().GetHashCode()); ___rotationRange = random.Next(1, 360); ___rotationSpeed = random.Next(1, 40); } } [HarmonyPatch(typeof(HoarderBugAI))] internal class HoarderBugAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void ValueChangeOnUpdate(ref NavMeshAgent ___agent) { Random random = new Random(Guid.NewGuid().GetHashCode()); if (___agent.speed > 0f) { ___agent.speed = random.Next(1, 20); } } } }