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 ItemTeleporter v1.0.0
TeleportItemMod.dll
Decompiled 2 years agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyTemplate.Patches; using Microsoft.CodeAnalysis; 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: AssemblyCompany("LethalCompanyTemplate")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LethalCompanyTemplate")] [assembly: AssemblyTitle("LethalCompanyTemplate")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 LethalCompanyTemplate { [BepInPlugin("Abhiram.TeleporterMod", "teleportItemMod", "1.0.0.0")] public class TeleporterMod : BaseUnityPlugin { private const string modGuid = "Abhiram.TeleporterMod"; private readonly Harmony harmony = new Harmony("Abhiram.TeleporterMod"); private void Awake() { harmony.PatchAll(typeof(ShipTeleporterPatch)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin is loaded!"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Author: abhiram"); } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalCompanyTemplate"; public const string PLUGIN_NAME = "LethalCompanyTemplate"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace LethalCompanyTemplate.Patches { [HarmonyPatch(typeof(ShipTeleporter))] internal class ShipTeleporterPatch { private static void SetPlayerTeleporterId(ShipTeleporter instance, PlayerControllerB playerScript, int teleporterId) { AccessTools.Method(typeof(ShipTeleporter), "SetPlayerTeleporterId", (Type[])null, (Type[])null).Invoke(instance, new object[2] { playerScript, teleporterId }); } [HarmonyPatch("beamUpPlayer")] [HarmonyPrefix] private static bool beamUpPlayerPatch(ShipTeleporter __instance, ref IEnumerator __result) { __result = enumFunc(__instance); return false; } private static IEnumerator enumFunc(ShipTeleporter __instance) { __instance.shipTeleporterAudio.PlayOneShot(__instance.teleporterSpinSFX); PlayerControllerB playerToBeamUp = StartOfRound.Instance.mapScreen.targetedPlayer; if ((Object)(object)playerToBeamUp == (Object)null) { Debug.Log((object)"Targeted player is null | Abhi patch"); yield break; } if ((Object)(object)playerToBeamUp.redirectToEnemy != (Object)null) { Debug.Log((object)$"Attemping to teleport enemy '{((Object)((Component)playerToBeamUp.redirectToEnemy).gameObject).name}' (tied to player #{playerToBeamUp.playerClientId}) to ship. | Abhi patch"); if (StartOfRound.Instance.shipIsLeaving) { Debug.Log((object)$"Ship could not teleport enemy '{((Object)((Component)playerToBeamUp.redirectToEnemy).gameObject).name}' (tied to player #{playerToBeamUp.playerClientId}) because the ship is leaving the nav mesh."); } playerToBeamUp.redirectToEnemy.ShipTeleportEnemy(); yield return (object)new WaitForSeconds(3f); __instance.shipTeleporterAudio.PlayOneShot(__instance.teleporterBeamUpSFX); if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } } SetPlayerTeleporterId(__instance, playerToBeamUp, 1); if ((Object)(object)playerToBeamUp.deadBody != (Object)null) { if ((Object)(object)playerToBeamUp.deadBody.beamUpParticle == (Object)null) { yield break; } playerToBeamUp.deadBody.beamUpParticle.Play(); playerToBeamUp.deadBody.bodyAudio.PlayOneShot(__instance.teleporterSpinSFX); } else { playerToBeamUp.beamUpParticle.Play(); playerToBeamUp.movementAudio.PlayOneShot(__instance.teleporterSpinSFX); } Debug.Log((object)"Teleport A | Abhi patch"); yield return (object)new WaitForSeconds(3f); bool flag = false; if ((Object)(object)playerToBeamUp.deadBody != (Object)null) { if ((Object)(object)playerToBeamUp.deadBody.grabBodyObject == (Object)null || !playerToBeamUp.deadBody.grabBodyObject.isHeldByEnemy) { flag = true; playerToBeamUp.deadBody.attachedTo = null; playerToBeamUp.deadBody.attachedLimb = null; playerToBeamUp.deadBody.secondaryAttachedLimb = null; playerToBeamUp.deadBody.secondaryAttachedTo = null; playerToBeamUp.deadBody.SetRagdollPositionSafely(__instance.teleporterPosition.position, true); ((Component)playerToBeamUp.deadBody).transform.SetParent(StartOfRound.Instance.elevatorTransform, true); } } else { flag = true; if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>())) { Object.FindObjectOfType<AudioReverbPresets>().audioPresets[3].ChangeAudioReverbForPlayer(playerToBeamUp); } playerToBeamUp.isInElevator = true; playerToBeamUp.isInHangarShipRoom = true; playerToBeamUp.isInsideFactory = false; playerToBeamUp.averageVelocity = 0f; playerToBeamUp.velocityLastFrame = Vector3.zero; playerToBeamUp.TeleportPlayer(__instance.teleporterPosition.position, true, 160f, false, true); } Debug.Log((object)"Teleport B | Abhi patch"); SetPlayerTeleporterId(__instance, playerToBeamUp, -1); if (flag) { __instance.shipTeleporterAudio.PlayOneShot(__instance.teleporterBeamUpSFX); if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } } Debug.Log((object)"Teleport C | Abhi patch"); } } }