using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("TurtleGun2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TurtleGun2")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f56b0edb-16ba-486a-87a8-ec93fd07a996")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TurtleGun2;
[BepInPlugin("com.yourname.turtlegun", "TurtleGun", "1.0.0")]
public class TurtleGunPlugin : BaseUnityPlugin
{
internal static ManualLogSource log;
private void Awake()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
log = ((BaseUnityPlugin)this).Logger;
new Harmony("com.yourname.turtlegun").PatchAll();
log.LogInfo((object)"TurtleGun loaded!");
}
}
[HarmonyPatch(typeof(Weapon), "ActuallyShoot")]
public class turtleshootpatch
{
private static bool Prefix(Weapon __instance)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)__instance).name.Contains("Pistol"))
{
return true;
}
if ((Object)(object)__instance.projectile == (Object)null)
{
return true;
}
Transform val = (Transform)typeof(Weapon).GetField("shootPosition", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).GetValue(__instance);
if ((Object)(object)val == (Object)null)
{
return true;
}
maketurtle(val.position + val.forward * 0.5f, val.rotation);
TurtleGunPlugin.log.LogInfo((object)"turtle fired!");
return false;
}
private static GameObject maketurtle(Vector3 pos, Quaternion rot)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("turtle");
val.transform.position = pos;
val.transform.rotation = rot;
GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)0);
val2.transform.parent = val.transform;
val2.transform.localPosition = Vector3.zero;
val2.transform.localScale = new Vector3(1f, 0.5f, 1f);
val2.GetComponent<Renderer>().material.color = new Color(0.4f, 0.2f, 0.05f);
Object.Destroy((Object)(object)val2.GetComponent<Collider>());
GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0);
val3.transform.parent = val.transform;
val3.transform.localPosition = new Vector3(0f, 0f, 0.6f);
val3.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f);
val3.GetComponent<Renderer>().material.color = new Color(0.3f, 0.6f, 0.2f);
Object.Destroy((Object)(object)val3.GetComponent<Collider>());
Vector3[] array = (Vector3[])(object)new Vector3[4]
{
new Vector3(-0.5f, -0.1f, 0.3f),
new Vector3(0.5f, -0.1f, 0.3f),
new Vector3(-0.5f, -0.1f, -0.3f),
new Vector3(0.5f, -0.1f, -0.3f)
};
Vector3[] array2 = array;
foreach (Vector3 localPosition in array2)
{
GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)1);
val4.transform.parent = val.transform;
val4.transform.localPosition = localPosition;
val4.transform.localScale = new Vector3(0.2f, 0.3f, 0.2f);
val4.GetComponent<Renderer>().material.color = new Color(0.3f, 0.6f, 0.2f);
Object.Destroy((Object)(object)val4.GetComponent<Collider>());
}
val.AddComponent<SphereCollider>();
Rigidbody val5 = val.AddComponent<Rigidbody>();
val5.velocity = rot * Vector3.forward * 11f;
val.AddComponent<turtlebehavior>();
return val;
}
}
public class turtlebehavior : MonoBehaviour
{
private float lifetime = 4f;
private bool canhit = false;
private void Start()
{
Object.Destroy((Object)(object)((Component)this).gameObject, lifetime);
((MonoBehaviour)this).Invoke("enablehit", 0.4f);
}
private void enablehit()
{
canhit = true;
}
private void OnCollisionEnter(Collision col)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
if (canhit)
{
BodyPart component = col.gameObject.GetComponent<BodyPart>();
if ((Object)(object)component != (Object)null)
{
typeof(BodyPart).GetMethod("GetHit", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(component, new object[3]
{
30f,
Vector3.zero,
0
});
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
}