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 Truck Valuable Safety v1.0.3
EmpressTruckValuableSafety.dll
Decompiled 3 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [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("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EmpressTruckValuableSafety")] [assembly: AssemblyTitle("EmpressTruckValuableSafety")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace Empress.TruckIndestructible { [BepInPlugin("Empress.TruckIndestructible", "Empress Truck Indestructible", "2.0.0")] public class TruckIndestructiblePlugin : BaseUnityPlugin { public const string PluginGuid = "Empress.TruckIndestructible"; public const string PluginName = "Empress Truck Indestructible"; public const string PluginVersion = "2.0.0"; public static List<Collider> SafeZones = new List<Collider>(); private static float _cacheTimer = 0f; private void Awake() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Harmony val = new Harmony("Empress.TruckIndestructible"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Truck Indestructible Mod Loaded - Physics Patch Active"); } private void Update() { _cacheTimer += Time.deltaTime; if (_cacheTimer > 2f || SafeZones.Count == 0) { CacheSafeZones(); _cacheTimer = 0f; } } private void CacheSafeZones() { SafeZones.Clear(); RoomVolume[] array = Object.FindObjectsOfType<RoomVolume>(); RoomVolume[] array2 = array; foreach (RoomVolume val in array2) { if (!val.Truck && !val.Extraction) { continue; } Collider[] componentsInChildren = ((Component)val).GetComponentsInChildren<Collider>(); Collider[] array3 = componentsInChildren; foreach (Collider val2 in array3) { if (val2.isTrigger) { SafeZones.Add(val2); } } } } } [HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "FixedUpdate")] public static class ImpactDetectorPatch { private static void Prefix(PhysGrabObjectImpactDetector __instance) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || (Object)(object)((Component)__instance).transform == (Object)null) { return; } Vector3 position = ((Component)__instance).transform.position; bool flag = false; for (int i = 0; i < TruckIndestructiblePlugin.SafeZones.Count; i++) { Collider val = TruckIndestructiblePlugin.SafeZones[i]; if ((Object)(object)val != (Object)null && val.enabled) { Bounds bounds = val.bounds; ((Bounds)(ref bounds)).Expand(3f); if (((Bounds)(ref bounds)).Contains(position)) { flag = true; break; } } } if (flag) { __instance.inCart = true; } } } }