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 HoloPlatform v0.4.0
HoloPlatform.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; 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 BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using HoloPlatform.NetcodePatcher; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("HoloPlatform")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Adds a new item, the Holo-Platform. Never fail a skill jump again!")] [assembly: AssemblyFileVersion("0.4.0.0")] [assembly: AssemblyInformationalVersion("0.4.0+0fd8b2245ec4e440480eb982edfc462a2966c152")] [assembly: AssemblyProduct("HoloPlatform")] [assembly: AssemblyTitle("HoloPlatform")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.4.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] 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 HoloPlatform { public class Config { public static ConfigEntry<int> storePrice; public static ConfigEntry<bool> platformStyle; public Config(ConfigFile cfg) { cfg.SaveOnConfigSet = false; storePrice = cfg.Bind<int>("Item", "Store Price", 250, "The price of the item in the terminal store"); platformStyle = cfg.Bind<bool>("Platform", "Platform Movement", true, "Set to True to enable Tracking Mode. Tracking Mode has the platform follow the player's movement.\nSet to False to enable Static Mode. Static Mode has the platform remain in place where it is created.\nNOTE: Tracking is currently broken in multiplayer. You can try using it, but expect a lot of bugs if you do."); ClearOrphanedEntries(cfg); cfg.Save(); cfg.SaveOnConfigSet = true; static void ClearOrphanedEntries(ConfigFile cfg) { ((Dictionary<ConfigDefinition, string>)AccessTools.Property(typeof(ConfigFile), "OrphanedEntries").GetValue(cfg)).Clear(); } } } internal class PlatformEnemAI : EnemyAI { private const float MoveSpeed = 30f; public PlayerControllerB ownerPlayer; public override void Update() { //IL_00af: 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) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if ((Object)(object)ownerPlayer == (Object)null) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.actualClientId == ((NetworkBehaviour)this).OwnerClientId && val.isPlayerControlled) { ownerPlayer = val; } } } if (!Config.platformStyle.Value) { return; } if ((Object)(object)base.targetPlayer == (Object)null) { if ((Object)(object)ownerPlayer != (Object)null) { base.targetPlayer = ownerPlayer; } } else if ((Object)(object)base.targetPlayer != (Object)null && !base.targetPlayer.isPlayerDead) { Vector3 val2 = base.targetPlayer.playerGlobalHead.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(normalized.x * (Time.deltaTime * 30f), 0f, normalized.z * (Time.deltaTime * 30f)); Transform transform = ((Component)this).transform; transform.position += val3; } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { ((EnemyAI)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "PlatformEnemAI"; } } public class PlatformItemBehaviour : PhysicsProp { private NetworkObject netPlatObject; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); ((GrabbableObject)this).insertedBattery.charge = 1f; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!((NetworkBehaviour)this).IsOwner) { return; } if (((GrabbableObject)this).isBeingUsed) { if (((NetworkBehaviour)this).IsHost) { SpawnPlatform(); } else { SpawnPlatformRpc(); } } else if (!((GrabbableObject)this).isBeingUsed) { if (((NetworkBehaviour)this).IsHost) { DespawnPlatform(); } else { DespawnPlatformRpc(); } } } public override void UseUpBatteries() { ((GrabbableObject)this).UseUpBatteries(); if (((NetworkBehaviour)this).IsOwner) { if (((NetworkBehaviour)this).IsHost) { DespawnPlatform(); } else { DespawnPlatformRpc(); } } } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); if (((GrabbableObject)this).isBeingUsed) { ((GrabbableObject)this).isBeingUsed = false; if (((NetworkBehaviour)this).IsHost) { DespawnPlatform(); } else { DespawnPlatformRpc(); } } } private void SpawnPlatform() { //IL_000d: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((GrabbableObject)this).playerHeldBy.playerGlobalHead.position.x, ((GrabbableObject)this).playerHeldBy.playerGlobalHead.position.y - 2.75f, ((GrabbableObject)this).playerHeldBy.playerGlobalHead.position.z); netPlatObject = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(val, 0f, -1, Plugin.holoPlat)); netPlatObject.ChangeOwnership(((GrabbableObject)this).playerHeldBy.actualClientId); Plugin.Logger.LogInfo((object)"Successfully spawned platform game object"); } [Rpc(/*Could not decode attribute arguments.*/)] private void SpawnPlatformRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_0108: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val2 = default(RpcParams); FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(4165744462u, val2, val, (SendTo)2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val3, 4165744462u, val2, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(((GrabbableObject)this).playerHeldBy.playerGlobalHead.position.x, ((GrabbableObject)this).playerHeldBy.playerGlobalHead.position.y - 2.75f, ((GrabbableObject)this).playerHeldBy.playerGlobalHead.position.z); netPlatObject = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(val4, 0f, -1, Plugin.holoPlat)); netPlatObject.ChangeOwnership(((GrabbableObject)this).playerHeldBy.actualClientId); Plugin.Logger.LogInfo((object)"Successfully spawned platform game object"); } } } private void DespawnPlatform() { RoundManager.Instance.DespawnEnemyOnServer(netPlatObject); Plugin.Logger.LogInfo((object)"Despawned platform game object"); } [Rpc(/*Could not decode attribute arguments.*/)] private void DespawnPlatformRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val2 = default(RpcParams); FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1222317508u, val2, val, (SendTo)2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val3, 1222317508u, val2, val, (SendTo)2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; RoundManager.Instance.DespawnEnemyOnServer(netPlatObject); Plugin.Logger.LogInfo((object)"Despawned platform game object"); } } } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(4165744462u, new RpcReceiveHandler(__rpc_handler_4165744462), "SpawnPlatformRpc"); ((NetworkBehaviour)this).__registerRpc(1222317508u, new RpcReceiveHandler(__rpc_handler_1222317508), "DespawnPlatformRpc"); ((PhysicsProp)this).__initializeRpcs(); } private static void __rpc_handler_4165744462(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((PlatformItemBehaviour)(object)target).SpawnPlatformRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1222317508(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((PlatformItemBehaviour)(object)target).DespawnPlatformRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PlatformItemBehaviour"; } } [BepInPlugin("poiuygfd.HoloPlatform", "HoloPlatform", "0.4.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string ModGUID = "poiuygfd.HoloPlatform"; public static Plugin instance; public static ManualLogSource Logger; public static EnemyType holoPlat; public static Item holoPlatItem; public static Config Config { get; internal set; } private void Awake() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } instance = this; Logger = ((BaseUnityPlugin)this).Logger; Config = new Config(((BaseUnityPlugin)this).Config); AssetBundle obj = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "holoplatassets")); EnemyType val = obj.LoadAsset<EnemyType>("Assets/PlatformItem/HoloPlatEnem.asset"); TerminalNode val2 = obj.LoadAsset<TerminalNode>("Assets/PlatformItem/terminal/HoloPlatTerminalNode.asset"); TerminalKeyword val3 = obj.LoadAsset<TerminalKeyword>("Assets/PlatformItem/terminal/HoloPlatTerminalKey.asset"); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Enemies.RegisterEnemy(val, 0, (LevelTypes)1, (SpawnType)0, val2, val3); holoPlat = val; Item val4 = obj.LoadAsset<Item>("Assets/PlatformItem/HoloPlatItem.asset"); PlatformItemBehaviour platformItemBehaviour = val4.spawnPrefab.AddComponent<PlatformItemBehaviour>(); ((GrabbableObject)platformItemBehaviour).grabbable = true; ((GrabbableObject)platformItemBehaviour).grabbableToEnemies = true; ((GrabbableObject)platformItemBehaviour).itemProperties = val4; NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab); Utilities.FixMixerGroups(val4.spawnPrefab); TerminalNode val5 = ScriptableObject.CreateInstance<TerminalNode>(); val5.clearPreviousText = true; val5.displayText = "The company is sick of seeing new recruits plummet to their death over the simplest of jumps, so they created this piece of tech to prevent that from happening.\n\nThe revolutionary Holo-Platform creates a holographic platform underneath your feet to stand on and easily walk across treacherous falls.\n\nBe careful though, such powerful and advanced technology in such a small package means battery life is very short. Try not to let the battery run out while crossing a gap, or you may fall to an untimely demise.\n\n"; Items.RegisterShopItem(val4, (TerminalNode)null, (TerminalNode)null, val5, Config.storePrice.Value); Logger.LogInfo((object)"Loaded Holo-Platform"); } } public static class PluginInfo { public const string PLUGIN_GUID = "HoloPlatform"; public const string PLUGIN_NAME = "HoloPlatform"; public const string PLUGIN_VERSION = "0.4.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace HoloPlatform.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }