using System;
using System.Diagnostics;
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 LethalCompanyInputUtils.Api;
using LethalNetworkAPI;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
[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("SelfDestruct")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A mod for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4cecba3ba9028ea374ff80e23f0a792583c38961")]
[assembly: AssemblyProduct("SelfDestruct")]
[assembly: AssemblyTitle("SelfDestruct")]
[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 SelfDestruct
{
public class Config
{
public ConfigEntry<float> LethalRadius;
public ConfigEntry<float> DamageRadius;
public ConfigEntry<int> NonLethalDamage;
public ConfigEntry<float> BodyLaunchForce;
public Config(ConfigFile cfg)
{
LethalRadius = cfg.Bind<float>("Technical", "LethalRadius", 6.5f, "The radius of the self destruct explosion that kills players.");
DamageRadius = cfg.Bind<float>("Technical", "DamageRadius", 7.5f, "The radius of the self destruct explosion that damages entities.");
NonLethalDamage = cfg.Bind<int>("Technical", "NonLethalDamage", 50, "How much damage the damage radius deals to players.");
BodyLaunchForce = cfg.Bind<float>("Technical", "BodyLaunchForce", 30f, "How fast your body gets launched after self destructing.");
}
}
[BepInPlugin("moe.sylvi.SelfDestruct", "SelfDestruct", "1.0.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private static LethalClientMessage<Vector3> SelfDestructMessage = new LethalClientMessage<Vector3>("SelfDestruct", (Action<Vector3>)null, (Action<Vector3, ulong>)ReceiveSelfDestruct);
public static Config Config { get; private set; }
public static ManualLogSource Logger { get; private set; }
public static PluginInput Input { get; private set; }
private void Awake()
{
Config = new Config(((BaseUnityPlugin)this).Config);
Logger = ((BaseUnityPlugin)this).Logger;
Input = new PluginInput();
Harmony.CreateAndPatchAll(typeof(Plugin), "moe.sylvi.SelfDestruct");
Logger.LogInfo((object)"Plugin moe.sylvi.SelfDestruct is loaded!");
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
[HarmonyPostfix]
private static void PlayerControllerB_Update(PlayerControllerB __instance)
{
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: 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_00d8: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject) && Input.SelfDestruct.triggered && __instance.AllowPlayerDeath() && !__instance.isTypingChat && !__instance.inSpecialInteractAnimation && !__instance.inTerminalMenu)
{
Vector3 position = ((Component)__instance).transform.position;
Vector3 val = new Vector3(Random.Range(-1f, 1f), 1f, Random.Range(-1f, 1f));
Vector3 val2 = ((Vector3)(ref val)).normalized * Config.BodyLaunchForce.Value;
val = default(Vector3);
__instance.KillPlayer(val2, true, (CauseOfDeath)3, 0, val);
SelfDestructMessage.SendAllClients(position, true, false);
}
}
private static void ReceiveSelfDestruct(Vector3 position, ulong clientId)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
Landmine.SpawnExplosion(position, true, Config.LethalRadius.Value, Config.DamageRadius.Value, Config.NonLethalDamage.Value, 0f, (GameObject)null, false);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "moe.sylvi.SelfDestruct";
public const string PLUGIN_NAME = "SelfDestruct";
public const string PLUGIN_VERSION = "1.0.2";
}
public class PluginInput : LcInputActions
{
[InputAction(/*Could not decode attribute arguments.*/)]
public InputAction SelfDestruct { get; set; }
}
}