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 MicBird v1.0.1
Micbird.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.Configuration; using GameNetcodeStuff; using LethalLib.Modules; using Micbird.NetcodePatcher; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Micbird")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Your mod description.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Micbird")] [assembly: AssemblyTitle("Micbird")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); } } namespace Micbird { [BepInPlugin("com.Micbird", "Micbird", "0.0.0")] public class Micbird : BaseUnityPlugin { public static Micbird instance; public static string RoleCompanyFolder = "Assets/MicBird/"; public static AssetBundle bundle; public static ConfigEntry<int> SpawnChanceModifier; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ConfigFile val = new ConfigFile(Path.Combine(Paths.ConfigPath, "MicBird.cfg"), true); SpawnChanceModifier = val.Bind<int>("MicBird", "Spawn Weight Modifier", 1, new ConfigDescription("The Chance to spawn Micbird outside ", (AcceptableValueBase)null, Array.Empty<object>())); 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); } } } instance = this; bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "micbird")); EnemyType val2 = bundle.LoadAsset<EnemyType>(RoleCompanyFolder + "MicBird.asset"); Enemies.RegisterEnemy(val2, 5 * SpawnChanceModifier.Value, (LevelTypes)4, bundle.LoadAsset<TerminalNode>(RoleCompanyFolder + "MicBirdNode.asset"), bundle.LoadAsset<TerminalKeyword>(RoleCompanyFolder + "MicBirdKey.asset")); Enemies.RegisterEnemy(val2, 10 * SpawnChanceModifier.Value, (LevelTypes)8, bundle.LoadAsset<TerminalNode>(RoleCompanyFolder + "MicBirdNode.asset"), bundle.LoadAsset<TerminalKeyword>(RoleCompanyFolder + "MicBirdKey.asset")); Enemies.RegisterEnemy(val2, 25 * SpawnChanceModifier.Value, (LevelTypes)16, bundle.LoadAsset<TerminalNode>(RoleCompanyFolder + "MicBirdNode.asset"), bundle.LoadAsset<TerminalKeyword>(RoleCompanyFolder + "MicBirdKey.asset")); Enemies.RegisterEnemy(val2, 25 * SpawnChanceModifier.Value, (LevelTypes)64, bundle.LoadAsset<TerminalNode>(RoleCompanyFolder + "MicBirdNode.asset"), bundle.LoadAsset<TerminalKeyword>(RoleCompanyFolder + "MicBirdKey.asset")); Enemies.RegisterEnemy(val2, 15 * SpawnChanceModifier.Value, (LevelTypes)32, bundle.LoadAsset<TerminalNode>(RoleCompanyFolder + "MicBirdNode.asset"), bundle.LoadAsset<TerminalKeyword>(RoleCompanyFolder + "MicBirdKey.asset")); NetworkPrefabs.RegisterNetworkPrefab(val2.enemyPrefab); Utilities.FixMixerGroups(val2.enemyPrefab); } public void AddScrap(string Name, int Rare, LevelTypes level) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) Item val = bundle.LoadAsset<Item>(RoleCompanyFolder + Name + ".asset"); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); Items.RegisterScrap(val, Rare, level); } } public class MicbirdAI : EnemyAI { public NetworkVariable<bool> GlobalCD; public NetworkVariable<bool> IsDying = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private Animator animator; private Vector3 Node; private NavMeshPath path; private AudioClip MainSound; public AudioClip[] SFXS; private AudioSource AS; private HangarShipDoor ShipDoor; private void Awake() { AS = ((Component)this).GetComponent<AudioSource>(); ShipDoor = Object.FindAnyObjectByType<HangarShipDoor>(); } public override void Start() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); AS.maxDistance = 30f; MainSound = AS.clip; path = new NavMeshPath(); GlobalCD.Value = false; animator = ((Component)this).GetComponent<Animator>(); WonderVectorServerRpc(1f); ((EnemyAI)this).SetDestinationToPosition(Node, false); } public override void DoAIInterval() { //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); ((EnemyAI)this).TargetClosestPlayer(1.5f, false, 100f); if (!GlobalCD.Value && !IsDying.Value) { if ((Object)(object)AS.clip != (Object)(object)MainSound) { AS.clip = MainSound; AS.Play(); } if (base.enemyHP <= 0) { ((MonoBehaviour)this).StartCoroutine(Dying()); } if (!Object.op_Implicit((Object)(object)base.targetPlayer)) { base.agent.speed = 1.5f; if (base.agent.remainingDistance <= 11f) { animator.SetInteger("State", 0); WonderVectorServerRpc(30f); ((EnemyAI)this).SetDestinationToPosition(Node, false); if (Random.Range(0, 10) <= 1) { StartCooldown(3f); } } else if (base.agent.remainingDistance > 11f) { animator.SetInteger("State", 1); } } else if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) <= 20f) { if ((Object)(object)AS.clip != (Object)(object)SFXS[0]) { AS.clip = SFXS[0]; AS.Play(); } animator.SetInteger("State", 2); ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false); if (!base.targetPlayer.isInHangarShipRoom) { base.agent.speed = 0.1f; } else { ShipDoor.PlayDoorAnimation(false); base.agent.speed = 0.1f; } if (Object.op_Implicit((Object)(object)base.targetPlayer.currentlyHeldObjectServer)) { GrabbableObject currentlyHeldObjectServer = base.targetPlayer.currentlyHeldObjectServer; WalkieTalkie component = ((Component)currentlyHeldObjectServer).gameObject.GetComponent<WalkieTalkie>(); if (Object.op_Implicit((Object)(object)component) && ((Behaviour)component.walkieTalkieLight).enabled) { component.SwitchWalkieTalkieOn(false); } } } else { base.targetPlayer = null; } } ((EnemyAI)this).SyncPositionToClients(); } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); base.enemyHP--; } public void StartCooldown(float time) { ((MonoBehaviour)this).StartCoroutine(Cooldown(time)); } public IEnumerator Cooldown(float time) { GlobalCD.Value = true; base.agent.isStopped = true; animator.SetInteger("State", 0); yield return (object)new WaitForSeconds(time); base.agent.isStopped = false; GlobalCD.Value = false; } [ServerRpc(RequireOwnership = false)] public void WonderVectorServerRpc(float Range) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3358529258u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref Range, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3358529258u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Vector3 val3 = ((Component)this).transform.position + new Vector3(Random.Range(0f - Range, Range), 0f, Random.Range(0f - Range, Range)); if (base.agent.CalculatePath(val3, path)) { Node = val3; } else { Node = ((Component)this).transform.position; } } } public IEnumerator Dying() { IsDying.Value = true; yield return (object)new WaitForSeconds(1f); animator.SetInteger("State", -1); yield return (object)new WaitForSeconds(3f); Object.Destroy((Object)(object)((Component)this).gameObject); IsDying.Value = false; } protected override void __initializeVariables() { if (GlobalCD == null) { throw new Exception("MicbirdAI.GlobalCD cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)GlobalCD).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)GlobalCD, "GlobalCD"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)GlobalCD); if (IsDying == null) { throw new Exception("MicbirdAI.IsDying cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)IsDying).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)IsDying, "IsDying"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)IsDying); ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_MicbirdAI() { //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(3358529258u, new RpcReceiveHandler(__rpc_handler_3358529258)); } private static void __rpc_handler_3358529258(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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float range = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref range, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((MicbirdAI)(object)target).WonderVectorServerRpc(range); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "MicbirdAI"; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Micbird"; public const string PLUGIN_NAME = "Micbird"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace Micbird.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }