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 DM; using HarmonyLib; using Landfall.TABS; using SLMA; 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("ProjectileForce")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ProjectileForce")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ef947e69-ec1b-498b-bfb5-42023f21f231")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ProjectileForce; public class DeathPhysics : MonoBehaviour { private Unit unit; private HealthHandler healthHandler; private bool deathPhysicsTriggered; public float minimumUpwardVelocity = 3.5f; public float maximumUpwardVelocity = 5.5f; public float minimumBackwardVelocity = 1.5f; public float maximumBackwardVelocity = 3f; public float maximumSideVelocity = 1f; public float minimumSpin = 1f; public float maximumSpin = 3f; private void Start() { unit = ((Component)this).GetComponent(); if (!((Object)(object)unit == (Object)null)) { healthHandler = ((Component)unit).GetComponentInChildren(); if ((Object)(object)healthHandler != (Object)null) { healthHandler.AddDieAction((Action)OnUnitDeath); } } } private void OnDestroy() { if ((Object)(object)healthHandler != (Object)null) { healthHandler.RemoveDieAction((Action)OnUnitDeath); } } private void OnUnitDeath() { if (!deathPhysicsTriggered) { deathPhysicsTriggered = true; ((MonoBehaviour)this).StartCoroutine(ApplyDeathPhysics()); } } private IEnumerator ApplyDeathPhysics() { yield return null; yield return (object)new WaitForFixedUpdate(); if ((Object)(object)unit == (Object)null || (Object)(object)unit.data == (Object)null) { yield break; } RigidbodyHolder rigidbodyHolder = ((Component)unit).GetComponentInChildren(); if ((Object)(object)rigidbodyHolder == (Object)null || rigidbodyHolder.AllRigs == null) { yield break; } Rigidbody[] rigs = rigidbodyHolder.AllRigs; if (rigs.Length == 0) { yield break; } Vector3 backwardDirection = -((Component)unit).transform.forward; backwardDirection.y = 0f; if (((Vector3)(ref backwardDirection)).sqrMagnitude < 0.01f) { backwardDirection = Vector3.back; } ((Vector3)(ref backwardDirection)).Normalize(); Vector3 sidewaysDirection = ((Component)unit).transform.right * Random.Range(0f - maximumSideVelocity, maximumSideVelocity); float upwardVelocity = Random.Range(minimumUpwardVelocity, maximumUpwardVelocity); float backwardVelocity = Random.Range(minimumBackwardVelocity, maximumBackwardVelocity); Vector3 launchVelocity = Vector3.up * upwardVelocity + backwardDirection * backwardVelocity + sidewaysDirection; foreach (Rigidbody rig in rigs) { if (!((Object)(object)rig == (Object)null)) { rig.velocity += launchVelocity; } } float spin = Random.Range(minimumSpin, maximumSpin); foreach (Rigidbody rig2 in rigs) { if (!((Object)(object)rig2 == (Object)null)) { Vector3 randomSpin = new Vector3(Random.Range(0f - spin, spin), Random.Range(0f - spin, spin), Random.Range(0f - spin, spin)); rig2.angularVelocity += randomSpin; } } } } [BepInPlugin("ProjectileForce", "ProjectileForce", "1.0.0")] internal class Loader : BaseUnityPlugin { private void Awake() { ((MonoBehaviour)this).StartCoroutine("Call"); } private IEnumerator Call() { yield return (object)new WaitUntil((Func)(() => (Object)(object)Object.FindObjectOfType() != (Object)null)); yield return (object)new WaitUntil((Func)(() => ServiceLocator.GetService() != null)); yield return (object)new WaitForSecondsRealtime(0.3f); SLMALoader.GetInstance(); LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase; UManager.Init(landfallContentDatabase); new Harmony(UManager.modname).PatchAll(); GOSLMA.EditWeapons = ((GOSLMA.EditWeapons == null) ? new Action(UManager.EditWeapons) : ((Action)Delegate.Combine(new Action(UManager.EditWeapons), GOSLMA.EditWeapons))); GOSLMA.EditClothes = ((GOSLMA.EditClothes == null) ? new Action(UManager.EditClothes) : ((Action)Delegate.Combine(new Action(UManager.EditClothes), GOSLMA.EditClothes))); GOSLMA.EditCombatMoves = ((GOSLMA.EditCombatMoves == null) ? new Action(UManager.EditCombatMoves) : ((Action)Delegate.Combine(new Action(UManager.EditCombatMoves), GOSLMA.EditCombatMoves))); GOSLMA.CodeAfterSpawn = ((GOSLMA.CodeAfterSpawn == null) ? new Action(UManager.CodeAfterSpawn) : ((Action)Delegate.Combine(new Action(UManager.CodeAfterSpawn), GOSLMA.CodeAfterSpawn))); GOSLMA.EditProjectiles = ((GOSLMA.EditProjectiles == null) ? new Action(UManager.EditProjectiles) : ((Action)Delegate.Combine(new Action(UManager.EditProjectiles), GOSLMA.EditProjectiles))); UnitBlueprint[] blueprints = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < blueprints.Length; i++) { UManager.EditBlueprint(blueprints[i], landfallContentDatabase); } Debug.Log((object)("Loaded " + UManager.modname + " Successfully")); Debug.Log((object)(UManager.modname + " is made in SFT by FhpSlime")); Debug.Log((object)(UManager.modder + " wished you a pleasant trip")); } } public static class UManager { public static string modname = "ProjectileForce"; public static string modder = "FhpSlime"; public static void SetRiders(UnitBlueprint me, UnitBlueprint[] riders) { s.SetField(me, "Riders", (object)riders); } public static void EditBlueprint(UnitBlueprint unit, LandfallContentDatabase db) { } public static void EditClothes(GameObject cloth, CharacterItem item, PropItemData data, Unit unit, int index, LandfallContentDatabase db) { } public static void EditProjectiles(GameObject proj, ProjectileHit projhit, Unit unit, LandfallContentDatabase db) { } public static void EditCombatMoves(GameObject move, int index, Unit unit, LandfallContentDatabase db) { } public static void CodeAfterSpawn(Unit unit, LandfallContentDatabase db) { if (!((Object)(object)unit == (Object)null) && (Object)(object)((Component)unit).GetComponent() == (Object)null) { ((Component)unit).gameObject.AddComponent(); } } public static void Init(LandfallContentDatabase db) { } public static void EditWeapons(GameObject weapon, Team team, Unit unit, MeleeWeapon melee, RangeWeapon range, LandfallContentDatabase db) { } }