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 VerityMod v1.0.0
plugins/VerityMod.dll
Decompiled 35 minutes agousing 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 BepInEx.Logging; using GameNetcodeStuff; using LethalLib.Modules; 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("VerityMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("VerityMod")] [assembly: AssemblyTitle("VerityMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace VerityMod; [BepInPlugin("com.yourname.veritymod", "VerityMod", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string ModGUID = "com.yourname.veritymod"; public const string ModName = "VerityMod"; public const string ModVersion = "1.0.0"; public static ManualLogSource Log; public static Item VerityItemData; public static EnemyType VerityEnemyData; public static AudioClip[] LoadedSounds; public static ConfigEntry<int> ConfigSpawnRarity; public static ConfigEntry<float> ConfigSoundVolume; public static ConfigEntry<float> ConfigMinDelay; public static ConfigEntry<float> ConfigMaxDelay; private void Awake() { //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ConfigSpawnRarity = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SpawnRarity", 75, "Шанс спавна Verity на планетах (0 = отключить, 75 = средне, 200+ = очень часто)"); ConfigSoundVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "Volume", 0.45f, "Громкость звуков преследующего Verity (от 0.1 до 1.0)"); ConfigMinDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "MinSoundDelay", 2f, "Минимальная пауза между звуками (в секундах)"); ConfigMaxDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "MaxSoundDelay", 4f, "Максимальная пауза между звуками (в секундах)"); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "veritybundle"); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { Log.LogError((object)"Не удалось загрузить veritybundle!"); return; } VerityItemData = val.LoadAsset<Item>("VerityItem"); VerityEnemyData = val.LoadAsset<EnemyType>("VerityEnemy"); LoadedSounds = val.LoadAllAssets<AudioClip>(); GameObject spawnPrefab = VerityItemData.spawnPrefab; spawnPrefab.tag = "PhysicsProp"; spawnPrefab.layer = 6; foreach (Transform item in spawnPrefab.transform) { Transform val2 = item; if (((Object)val2).name != "ScanNode" && ((Object)val2).name != "MapDot") { ((Component)val2).gameObject.tag = "PhysicsProp"; ((Component)val2).gameObject.layer = 6; } } VerityItemScript verityItemScript = spawnPrefab.AddComponent<VerityItemScript>(); ((GrabbableObject)verityItemScript).itemProperties = VerityItemData; ((GrabbableObject)verityItemScript).grabbable = true; ((GrabbableObject)verityItemScript).grabbableToEnemies = true; ((GrabbableObject)verityItemScript).mainObjectRenderer = spawnPrefab.GetComponentInChildren<MeshRenderer>(); VerityEnemyScript verityEnemyScript = VerityEnemyData.enemyPrefab.AddComponent<VerityEnemyScript>(); ((EnemyAI)verityEnemyScript).enemyType = VerityEnemyData; ((EnemyAI)verityEnemyScript).creatureVoice = VerityEnemyData.enemyPrefab.GetComponent<AudioSource>(); ((EnemyAI)verityEnemyScript).agent = VerityEnemyData.enemyPrefab.GetComponent<NavMeshAgent>(); verityEnemyScript.annoyingSounds = LoadedSounds; NetworkPrefabs.RegisterNetworkPrefab(spawnPrefab); Items.RegisterScrap(VerityItemData, ConfigSpawnRarity.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(VerityEnemyData.enemyPrefab); Enemies.RegisterEnemy(VerityEnemyData, 0, (LevelTypes)1, (SpawnType)0, (TerminalNode)null, (TerminalKeyword)null); Log.LogInfo((object)$"VerityMod загружен! Шанс спавна: {ConfigSpawnRarity.Value}, Звуков: {LoadedSounds.Length}"); } } public class VerityItemScript : GrabbableObject { public override void Start() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Start(); base.propColliders = ((Component)this).GetComponentsInChildren<Collider>(); Transform val = ((Component)this).transform.Find("ScanNode"); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } GameObject val2 = new GameObject("ScanNode"); val2.transform.SetParent(((Component)this).transform); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; val2.layer = 22; BoxCollider val3 = val2.AddComponent<BoxCollider>(); ((Collider)val3).isTrigger = true; val3.size = new Vector3(1.2f, 1.2f, 1.2f); ScanNodeProperties val4 = val2.AddComponent<ScanNodeProperties>(); val4.headerText = "Verity"; val4.subText = $"Value: ${base.scrapValue}"; val4.scrapValue = base.scrapValue; val4.nodeType = 2; val4.maxRange = 13; val4.minRange = 1; val4.requiresLineOfSight = true; if (!((Object)(object)((Component)this).transform.Find("MapDot") == (Object)null)) { return; } GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(); foreach (GrabbableObject val5 in array) { Transform val6 = ((Component)val5).transform.Find("MapDot"); if ((Object)(object)val6 != (Object)null) { GameObject val7 = Object.Instantiate<GameObject>(((Component)val6).gameObject, ((Component)this).transform); ((Object)val7).name = "MapDot"; val7.transform.localPosition = Vector3.zero; base.radarIcon = val7.transform; break; } } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0083: 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_00d9: 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_00e2: 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) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!buttonDown || (Object)(object)base.playerHeldBy == (Object)null || !base.playerHeldBy.isInsideFactory) { return; } GameObject[] insideAINodes = RoundManager.Instance.insideAINodes; if (insideAINodes == null || insideAINodes.Length == 0) { return; } GameObject val = null; float num = -1f; GameObject[] array = insideAINodes; foreach (GameObject val2 in array) { float num2 = Vector3.Distance(((Component)base.playerHeldBy).transform.position, val2.transform.position); if (num2 > num) { num = num2; val = val2; } } if ((Object)(object)val != (Object)null) { PlayerControllerB playerHeldBy = base.playerHeldBy; Vector3 position = val.transform.position; playerHeldBy.TeleportPlayer(position, false, 0f, false, true); ActivateVerityServerRpc(position, playerHeldBy.playerClientId); } } [ServerRpc(RequireOwnership = false)] private void ActivateVerityServerRpc(Vector3 spawnPos, ulong victimClientId) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Plugin.VerityEnemyData != (Object)null) { GameObject val = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(spawnPos, -1f, 0, Plugin.VerityEnemyData)); VerityEnemyScript verityEnemyScript = default(VerityEnemyScript); if ((Object)(object)val != (Object)null && val.TryGetComponent<VerityEnemyScript>(ref verityEnemyScript)) { verityEnemyScript.SetTargetClientRpc(victimClientId); } } if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.DespawnHeldObject(); } else if ((Object)(object)((NetworkBehaviour)this).NetworkObject != (Object)null && ((NetworkBehaviour)this).NetworkObject.IsSpawned) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } } public class VerityEnemyScript : EnemyAI { public AudioClip[] annoyingSounds; private float soundTimer = 1.5f; public override void Start() { ((EnemyAI)this).Start(); base.enemyType.canDie = false; if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.spatialBlend = 1f; base.creatureVoice.volume = Mathf.Clamp01(Plugin.ConfigSoundVolume.Value); base.creatureVoice.minDistance = 2f; base.creatureVoice.maxDistance = 25f; } } [ClientRpc] public void SetTargetClientRpc(ulong clientId) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.playerClientId == clientId) { base.targetPlayer = val; break; } } } public override void DoAIInterval() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if ((Object)(object)base.targetPlayer != (Object)null && !base.targetPlayer.isPlayerDead) { ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, true); } } public override void Update() { ((EnemyAI)this).Update(); if ((Object)(object)base.creatureVoice != (Object)null && !base.creatureVoice.isPlaying) { soundTimer -= Time.deltaTime; if (soundTimer <= 0f) { soundTimer = Random.Range(Plugin.ConfigMinDelay.Value, Plugin.ConfigMaxDelay.Value); PlayAnnoyingSound(); } } } private void PlayAnnoyingSound() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (annoyingSounds != null && annoyingSounds.Length != 0 && (Object)(object)base.creatureVoice != (Object)null) { AudioClip clip = annoyingSounds[Random.Range(0, annoyingSounds.Length)]; base.creatureVoice.clip = clip; base.creatureVoice.Play(); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 25f, 0.8f, 0, false, 0); } } public override void OnCollideWithPlayer(Collider other) { } }