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 31Arcadia v1.4.1
ArcadiaMoonPlugin.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using ArcadiaMoonPlugin.NetcodePatcher; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ArcadiaMoonPlugin")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A plugin for the LC Arcadia Moon mod")] [assembly: AssemblyFileVersion("1.4.0.0")] [assembly: AssemblyInformationalVersion("1.4.0+8faa2f5e59c480f6c5c80095c065afdd200b746b")] [assembly: AssemblyProduct("ArcadiaMoonPlugin")] [assembly: AssemblyTitle("ArcadiaMoonPlugin")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ArcadiaMoonPlugin { [BepInPlugin("ArcadiaMoonPlugin", "ArcadiaMoonPlugin", "1.4.0")] public class ArcadiaMoonPlugin : BaseUnityPlugin { private Harmony harmony; public static ArcadiaMoonPlugin instance; public static ConfigEntry<bool> ForceSpawnFlowerman { get; private set; } public static ConfigEntry<bool> ForceSpawnBaboon { get; private set; } public static ConfigEntry<bool> ForceSpawnRadMech { get; private set; } private void Awake() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown instance = this; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ArcadiaMoonPlugin is loaded!"); ForceSpawnFlowerman = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawning", "ForceSpawnFlowerman", true, "Enable custom deterministic spawner for Bracken"); ForceSpawnBaboon = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawning", "ForceSpawnBaboon", true, "Enable custom deterministic spawner for Baboon hawk"); ForceSpawnRadMech = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawning", "ForceSpawnRadMech", true, "Enable custom deterministic spawner for Old Bird"); harmony = new Harmony("ArcadiaMoonPlugin"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ArcadiaMoonPlugin patched PlayerControllerB!"); } } public class TimeAnimSyncronizer : MonoBehaviour { private Animator timeSyncAnimator; private void Start() { timeSyncAnimator = ((Component)this).GetComponent<Animator>(); if ((Object)(object)timeSyncAnimator == (Object)null) { Debug.LogError((object)"There is no Animator component attached to this object!"); } } private void FixedUpdate() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)timeSyncAnimator != (Object)null && TimeOfDay.Instance.timeHasStarted) { timeSyncAnimator.SetFloat("timeOfDay", Mathf.Clamp(TimeOfDay.Instance.normalizedTimeOfDay, 0f, 0.99f)); if ((int)TimeOfDay.Instance.currentLevelWeather == 0) { timeSyncAnimator.SetBool("dusty", true); } } } } internal class HeatwaveZoneInteract : MonoBehaviour { [SerializeField] private float timeInHeatZoneMax = 10f; [SerializeField] private Volume exhaustionFilter; public bool CheckConditionsForHeatingPause(PlayerControllerB playerController) { if (!playerController.inSpecialInteractAnimation && !Object.op_Implicit((Object)(object)playerController.inAnimationWithEnemy) && !playerController.isClimbingLadder) { return (Object)(object)playerController.physicsParent != (Object)null; } return true; } public bool CheckConditionsForHeatingStop(PlayerControllerB playerController) { if (!playerController.beamUpParticle.isPlaying && !playerController.isInElevator) { return playerController.isInHangarShipRoom; } return true; } private void OnTriggerEnter(Collider other) { if (((Component)other).CompareTag("Player")) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if (!((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { PlayerHeatManager.SetEffectsVolume(exhaustionFilter); } } } private void OnTriggerStay(Collider other) { if (!((Component)other).CompareTag("Player")) { return; } PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController) { return; } if (component.isPlayerDead) { PlayerHeatManager.heatSeverityMultiplier = 1f; PlayerHeatManager.isInHeatZone = false; PlayerHeatManager.SetHeatSeverity(0f - PlayerHeatManager.heatSeverity); return; } if (CheckConditionsForHeatingStop(component)) { PlayerHeatManager.heatSeverityMultiplier = 1f; PlayerHeatManager.isInHeatZone = false; return; } if (CheckConditionsForHeatingPause(component)) { PlayerHeatManager.heatSeverityMultiplier = 0.33f; } else { PlayerHeatManager.heatSeverityMultiplier = 1f; } if (PlayerHeatManager.isInHeatZone) { PlayerHeatManager.SetHeatSeverity(Time.deltaTime / timeInHeatZoneMax); } else { PlayerHeatManager.isInHeatZone = true; } } private void OnTriggerExit(Collider other) { if (((Component)other).CompareTag("Player")) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if (!((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { PlayerHeatManager.heatSeverityMultiplier = 1f; PlayerHeatManager.isInHeatZone = false; } } } private void OnDestroy() { PlayerHeatManager.heatSeverityMultiplier = 1f; PlayerHeatManager.isInHeatZone = false; PlayerHeatManager.SetEffectsVolume(null); } } internal class PlayerHeatManager : MonoBehaviour { public static bool isInHeatZone = false; public static float heatSeverityMultiplier = 1f; public static float heatSeverity = 0f; private static Volume heatEffectVolume; public static void SetEffectsVolume(Volume volume) { if ((Object)(object)volume != (Object)null) { heatEffectVolume = volume; } } internal static void SetHeatSeverity(float heatSeverityDelta) { heatSeverity = Mathf.Clamp01(heatSeverity + heatSeverityDelta * heatSeverityMultiplier); if ((Object)(object)heatEffectVolume != (Object)null) { heatEffectVolume.weight = heatSeverity; } } } public class EnemySpawner : MonoBehaviour { [SerializeField] private string enemyName = "RadMech"; [SerializeField] private float timer = 0.5f; private EnemyType enemyType; private GameObject nestPrefab; private List<GameObject> spawnedNests = new List<GameObject>(); private Random random = new Random(StartOfRound.Instance.randomMapSeed + 42); private void LoadResources(string enemyName) { IEnumerable<EnemyType> source = Resources.FindObjectsOfTypeAll<EnemyType>().Distinct(); enemyType = source.FirstOrDefault((Func<EnemyType, bool>)((EnemyType e) => e.enemyName == enemyName)); if ((Object)(object)enemyType != (Object)null) { nestPrefab = enemyType.nestSpawnPrefab; Debug.Log((object)(enemyType.enemyName + " and its prefab loaded successfully!")); } else { Debug.LogError((object)"Failed to load EnemyType!"); } } private void Start() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) if (!GameNetworkManager.Instance.isHostingGame) { return; } LoadResources(enemyName); if (!IsSpawningEnabled()) { Debug.Log((object)("Forced spawning for " + enemyName + " is disabled in the config.")); ((Behaviour)this).enabled = false; return; } foreach (Transform item in ((Component)this).transform) { Transform val = item; if ((Object)(object)nestPrefab != (Object)null) { Debug.Log((object)"Started nest prefab spawning routine!"); Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(val.position, 10f, default(NavMeshHit), random, RoundManager.Instance.GetLayermaskForEnemySizeLimit(enemyType)); randomNavMeshPositionInBoxPredictable = RoundManager.Instance.PositionEdgeCheck(randomNavMeshPositionInBoxPredictable, enemyType.nestSpawnPrefabWidth); GameObject val2 = Object.Instantiate<GameObject>(nestPrefab, randomNavMeshPositionInBoxPredictable, Quaternion.identity); val2.transform.Rotate(Vector3.up, (float)random.Next(-180, 180), (Space)0); spawnedNests.Add(val2); if (Object.op_Implicit((Object)(object)val2.GetComponentInChildren<NetworkObject>())) { val2.GetComponentInChildren<NetworkObject>().Spawn(true); Debug.Log((object)("Spawned an " + enemyName + " nest prefab!")); } else { Debug.LogError((object)("Nest prefab of " + enemyName + " does not have a NetworkObject component. Desync possible!")); } } } } private void Update() { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_010d: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (!(TimeOfDay.Instance.normalizedTimeOfDay > timer) || !TimeOfDay.Instance.timeHasStarted || !GameNetworkManager.Instance.isHostingGame) { return; } if ((Object)(object)nestPrefab != (Object)null) { foreach (GameObject spawnedNest in spawnedNests) { Vector3 position = spawnedNest.transform.position; Quaternion rotation = spawnedNest.transform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; Object.Destroy((Object)(object)spawnedNest); SpawnEnemyAtPosition(position, y); Debug.Log((object)("Spawned enemy " + enemyName + " in place of a nest prefab!")); } spawnedNests.Clear(); Debug.Log((object)("Destroyed all spawned enemy nest prefabs of " + enemyType.enemyName + "!")); } else { foreach (Transform item in ((Component)this).transform) { Transform val = item; SpawnEnemyAtPosition(val.position); Debug.Log((object)"Force spawned an enemy!"); } } ((Behaviour)this).enabled = false; } private void SpawnEnemyAtPosition(Vector3 position, float yRot = 0f) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)("Current enemy type for force spawn is " + enemyType.enemyName)); if ((Object)(object)enemyType.enemyPrefab == (Object)null) { Debug.LogError((object)(enemyType.enemyName + " does not have a valid enemy prefab to spawn.")); } else { RoundManager.Instance.SpawnEnemyGameObject(position, yRot, -1, enemyType); } } private bool IsSpawningEnabled() { return enemyName.ToLower() switch { "flowerman" => ArcadiaMoonPlugin.ForceSpawnFlowerman.Value, "baboon hawk" => ArcadiaMoonPlugin.ForceSpawnBaboon.Value, "radmech" => ArcadiaMoonPlugin.ForceSpawnRadMech.Value, _ => true, }; } } public static class PluginInfo { public const string PLUGIN_GUID = "ArcadiaMoonPlugin"; public const string PLUGIN_NAME = "ArcadiaMoonPlugin"; public const string PLUGIN_VERSION = "1.4.0"; } } namespace ArcadiaMoonPlugin.Patches { [HarmonyPatch] internal class PlayerControllerBHeatStrokePatch { private static float prevSprintMeter; private static float severityInfluenceMultiplier = 1.25f; private static float timeToCool = 17f; [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPrefix] [HarmonyPriority(600)] private static void HeatStrokePatchPrefix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled) { prevSprintMeter = __instance.sprintMeter; } } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPostfix] [HarmonyPriority(200)] private static void HeatStrokePatchLatePostfix(PlayerControllerB __instance) { if (!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled) { return; } if (__instance.isInsideFactory) { PlayerHeatManager.heatSeverityMultiplier = 1f; PlayerHeatManager.isInHeatZone = false; } if (!PlayerHeatManager.isInHeatZone) { PlayerHeatManager.SetHeatSeverity((0f - Time.deltaTime) / timeToCool); } float heatSeverity = PlayerHeatManager.heatSeverity; if (heatSeverity > 0f) { float num = __instance.sprintMeter - prevSprintMeter; if ((double)num < 0.0) { __instance.sprintMeter = Mathf.Max(prevSprintMeter + num * (1f + heatSeverity * severityInfluenceMultiplier), 0f); } else if ((double)num > 0.0) { __instance.sprintMeter = Mathf.Min(prevSprintMeter + num / (1f + heatSeverity * severityInfluenceMultiplier), 1f); } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace ArcadiaMoonPlugin.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }