Please disclose if any significant portion of your mod was created 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 HotbarRD v1.0.1
GiantSpecimens.dll
Decompiled 2 years agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using GiantSpecimens.NetcodePatcher; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GiantSpecimens")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Giant Enemies for Lethal Company.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6fbbe8a9d51f259ae87ff7c0988e3d9fe92d5189")] [assembly: AssemblyProduct("GiantSpecimens")] [assembly: AssemblyTitle("GiantSpecimens")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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 GiantSpecimens { internal class PinkGiantAI : EnemyAI { private enum State { IdleAnimation, SearchingForForestKeeper, RunningToForestKeeper, EatingForestKeeper } public Transform attackArea; private float timer = 0f; private bool eatingEnemy = false; private EnemyAI targetEnemy; [SerializeField] private GameObject rightBone; [SerializeField] private GameObject leftBone; [SerializeField] private GameObject eatingArea; private Vector3 midpoint; private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); LogIfDebugBuild("Pink Giant Enemy Spawned"); base.currentBehaviourStateIndex = 0; rightBone = GameObject.Find("Bone.005.R_end"); leftBone = GameObject.Find("Bone.005.L_end"); eatingArea = GameObject.Find("Bone.002"); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } public override void Update() { //IL_0046: 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) //IL_005b: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); timer += Time.deltaTime; if (base.currentBehaviourStateIndex == 3 && (Object)(object)targetEnemy != (Object)null) { midpoint = (rightBone.transform.position + leftBone.transform.position) / 2f; ((Component)targetEnemy).transform.position = midpoint + new Vector3(0f, -7f, 0f); ((Component)targetEnemy).transform.LookAt(eatingArea.transform); Transform transform = ((Component)targetEnemy).transform; Quaternion rotation = ((Component)targetEnemy).transform.rotation; transform.rotation = Quaternion.Euler(new Vector3(0f, ((Quaternion)(ref rotation)).eulerAngles.y + 65f, 0f)); } } public override void DoAIInterval() { //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } switch (base.currentBehaviourStateIndex) { case 0: base.agent.speed = 0f; if (timer > 3f) { ((MonoBehaviour)this).StartCoroutine(PauseDuringIdle()); } if (FoundForestKeeperInRange(50f)) { DoAnimationClientRpc("startChase"); LogIfDebugBuild("Start Target ForestKeeper"); ((EnemyAI)this).StopSearch(base.currentSearch, true); ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } else if (timer > 14f) { DoAnimationClientRpc("startWalk"); LogIfDebugBuild("Start Walking Around"); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } break; case 1: base.agent.speed = 1.5f; if (FoundForestKeeperInRange(50f)) { DoAnimationClientRpc("startChase"); LogIfDebugBuild("Start Target ForestKeeper"); ((EnemyAI)this).StopSearch(base.currentSearch, true); ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } break; case 2: base.agent.speed = 6f; if (Vector3.Distance(((Component)this).transform.position, ((Component)targetEnemy).transform.position) > 100f && !((EnemyAI)this).HasLineOfSightToPosition(((Component)targetEnemy).transform.position, 45f, 60, -1f)) { LogIfDebugBuild("Stop Target ForestKeeper"); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } else { ((EnemyAI)this).SetDestinationToPosition(((Component)targetEnemy).transform.position, false); } break; case 3: base.agent.speed = 0f; break; default: LogIfDebugBuild("This Behavior State doesn't exist!"); break; } } private bool FoundForestKeeperInRange(float range) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < RoundManager.Instance.SpawnedEnemies.Count; i++) { if (RoundManager.Instance.SpawnedEnemies[i].enemyType.enemyName == "ForestGiant" && Vector3.Distance(((Component)this).transform.position, ((Component)RoundManager.Instance.SpawnedEnemies[i]).transform.position) < range) { targetEnemy = RoundManager.Instance.SpawnedEnemies[i]; return true; } } return false; } private IEnumerator PauseDuringIdle() { yield return (object)new WaitForSeconds(3f); ((MonoBehaviour)this).StopCoroutine(PauseDuringIdle()); } private IEnumerator EatForestKeeper() { DoAnimationClientRpc("eatForestKeeper"); targetEnemy.CancelSpecialAnimationWithPlayer(); ((Behaviour)targetEnemy).enabled = false; LogIfDebugBuild($"{targetEnemy}"); yield return (object)new WaitForSeconds(10f); targetEnemy.KillEnemyOnOwnerClient(true); yield return (object)new WaitForSeconds(5f); ((MonoBehaviour)this).StopCoroutine(EatForestKeeper()); eatingEnemy = false; ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy) { if ((Object)(object)collidedEnemy == (Object)(object)targetEnemy && !eatingEnemy) { LogIfDebugBuild("Pink Giant hitting this guy:" + (object)targetEnemy); ((EnemyAI)this).SwitchToBehaviourClientRpc(3); eatingEnemy = true; if (eatingEnemy) { ((MonoBehaviour)this).StartCoroutine(EatForestKeeper()); } } } public override void OnCollideWithPlayer(Collider other) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null) { LogIfDebugBuild("Pink Giant Feet Collision with Player!"); val.DamagePlayer(100, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } [ClientRpc] public void DoAnimationClientRpc(string animationName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3728082186u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3728082186u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LogIfDebugBuild("Animation: " + animationName); base.creatureAnimator.SetTrigger(animationName); } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PinkGiantAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3728082186u, new RpcReceiveHandler(__rpc_handler_3728082186)); } private static void __rpc_handler_3728082186(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((PinkGiantAI)(object)target).DoAnimationClientRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PinkGiantAI"; } } [BepInPlugin("GiantSpecimens", "GiantSpecimens", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static Harmony _harmony; public static EnemyType PinkGiant; internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Assets.PopulateAssets(); PinkGiant = Assets.MainAssetBundle.LoadAsset<EnemyType>("PinkGiantObj"); TerminalNode val = Assets.MainAssetBundle.LoadAsset<TerminalNode>("PinkGiantTN"); TerminalKeyword val2 = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("PinkGiantTK"); NetworkPrefabs.RegisterNetworkPrefab(PinkGiant.enemyPrefab); Enemies.RegisterEnemy(PinkGiant, 500, (LevelTypes)(-1), (SpawnType)2, val, val2); Logger.LogInfo((object)"Plugin GiantSpecimens is loaded!"); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } public static class Assets { public static AssetBundle MainAssetBundle; public static void PopulateAssets() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "modassets")); if ((Object)(object)MainAssetBundle == (Object)null) { Plugin.Logger.LogError((object)"Failed to load custom assets."); } } } public static class PluginInfo { public const string PLUGIN_GUID = "GiantSpecimens"; public const string PLUGIN_NAME = "GiantSpecimens"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace GiantSpecimens.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }