using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Landfall.TABS;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Tabs Poof Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tabs Poof Mod")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8aad4f38-2ad4-4206-bf0b-7d28fb6d5c2e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace hidetheevidencezzz;
[BepInPlugin("bayturtleking.tabs.hidetheevidence", "Hide the Evidence", "1.0.0")]
public class fixempoofersmod : BaseUnityPlugin
{
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
poofconfiggg.bindddd(((BaseUnityPlugin)this).Config);
new Harmony("bayturtleking.tabs.hidetheevidence").PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Hide the Evidence mod loaded");
}
}
internal static class poofconfiggg
{
public static ConfigEntry<float> corpsechillzzz;
public static void bindddd(ConfigFile config)
{
corpsechillzzz = config.Bind<float>("Poofing", "Disappear Delay", 2f, "Delays the disappearing of units. Default is 2");
}
}
[HarmonyPatch(typeof(HealthHandler), "Die", new Type[] { typeof(Unit) })]
public class paththedeath
{
private static void Postfix(HealthHandler __instance)
{
GameObject gameObject = ((Component)((Component)__instance).transform.root).gameObject;
if ((Object)(object)gameObject.GetComponent<corpsepoofzzz>() == (Object)null)
{
gameObject.AddComponent<corpsepoofzzz>();
}
}
}
public class corpsepoofzzz : MonoBehaviour
{
private GameObject corpseroottt;
private void Start()
{
corpseroottt = ((Component)((Component)this).transform.root).gameObject;
((MonoBehaviour)this).StartCoroutine(poofnapzzz());
}
private IEnumerator poofnapzzz()
{
yield return (object)new WaitForSeconds(poofconfiggg.corpsechillzzz.Value);
if ((Object)(object)corpseroottt == (Object)null)
{
yield break;
}
Unit componentInChildren = corpseroottt.GetComponentInChildren<Unit>();
if ((Object)(object)componentInChildren != (Object)null)
{
((Behaviour)componentInChildren).enabled = false;
}
Rigidbody[] componentsInChildren = corpseroottt.GetComponentsInChildren<Rigidbody>();
Vector3 position;
if (componentsInChildren.Length != 0)
{
Vector3 val = Vector3.zero;
Rigidbody[] array = componentsInChildren;
foreach (Rigidbody val2 in array)
{
val += val2.position;
}
position = val / (float)componentsInChildren.Length;
}
else
{
position = corpseroottt.transform.position + Vector3.up;
}
GameObject val3 = new GameObject("SmokeEffect");
val3.transform.position = position;
ParticleSystem val4 = val3.AddComponent<ParticleSystem>();
((Renderer)((Component)val4).GetComponent<ParticleSystemRenderer>()).material = new Material(Shader.Find("Particles/Standard Unlit"));
MainModule main = val4.main;
((MainModule)(ref main)).duration = 0.3f;
((MainModule)(ref main)).loop = false;
((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.8f, 1.4f);
((MainModule)(ref main)).startSpeed = new MinMaxCurve(1f, 4f);
((MainModule)(ref main)).startSize = new MinMaxCurve(0.1f, 0.4f);
((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.05f);
((MainModule)(ref main)).maxParticles = 40;
EmissionModule emission = val4.emission;
((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1]
{
new Burst(0f, (short)30)
});
ShapeModule shape = val4.shape;
((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
((ShapeModule)(ref shape)).radius = 0.5f;
ColorOverLifetimeModule colorOverLifetime = val4.colorOverLifetime;
((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
Gradient val5 = new Gradient();
val5.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
{
new GradientColorKey(new Color(0.9f, 0.9f, 0.9f), 0f),
new GradientColorKey(new Color(0.4f, 0.4f, 0.4f), 1f)
}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
{
new GradientAlphaKey(1f, 0f),
new GradientAlphaKey(0.5f, 0.5f),
new GradientAlphaKey(0f, 1f)
});
((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val5);
val4.Play();
Object.Destroy((Object)(object)val3, 3f);
Object.Destroy((Object)(object)corpseroottt);
}
}