Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of DrivablePolice v1.1.0
DrivablePolice.dll
Decompiled 3 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using DrivablePolice; using Il2CppScheduleOne.Lighting; using Il2CppScheduleOne.Vehicles; using MelonLoader; using MelonLoader.Preferences; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(DrivablePoliceMod), "DrivablePolice", "1.0", "Jumble", null)] [assembly: MelonColor] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("DrivablePolice")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DrivablePolice")] [assembly: AssemblyTitle("DrivablePolice")] [assembly: AssemblyVersion("1.0.0.0")] namespace DrivablePolice; public static class BuildInfo { public const string Name = "DrivablePolice"; public const string Description = "Replaces player owned SUVs & Shitboxes with the police variants."; public const string Author = "Jumble"; public const string Company = null; public const string Version = "1.0"; public const string DownloadLink = null; } public static class Config { private static MelonPreferences_Category configCategory; private static MelonPreferences_Entry<KeyCode> lightKeyEntry; private static MelonPreferences_Entry<bool> holdEntry; public static KeyCode LightKey => (KeyCode)(((??)lightKeyEntry?.Value) ?? 112); public static bool Hold => holdEntry?.Value ?? true; public static void Load() { configCategory = MelonPreferences.CreateCategory("DrivablePolice"); lightKeyEntry = configCategory.CreateEntry<KeyCode>("ActivatePoliceLightKey", (KeyCode)112, "Activate Lights & Sirens", (string)null, false, false, (ValueValidator)null, (string)null); holdEntry = configCategory.CreateEntry<bool>("HoldKey", true, "Hold Key", (string)null, false, false, (ValueValidator)null, (string)null); } } public static class VehicleTracker { internal static List<LandVehicle> Vehicles = new List<LandVehicle>(); internal static List<PoliceLight> Lights = new List<PoliceLight>(); } public class DrivablePoliceMod : MelonMod { [CompilerGenerated] private sealed class <>c__DisplayClass5_0 { public string rootPrefabName; public string cloneName; public Func<GameObject, bool> <>9__1; internal bool <ConvertPoliceVariant>b__0(GameObject go) { if (((Object)go).name == rootPrefabName) { return (Object)(object)go.transform.parent == (Object)null; } return false; } internal bool <ConvertPoliceVariant>b__1(GameObject o) { return ((Object)o).name.Contains(cloneName); } } [CompilerGenerated] private sealed class <ConvertPoliceVariant>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string rootPrefabName; public string cloneName; public string rootChildName; public bool combinedUnderRoot; public string combinedName; public bool disableTrunkLid; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ConvertPoliceVariant>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; <>c__DisplayClass5_0 CS$<>8__locals0 = new <>c__DisplayClass5_0 { rootPrefabName = rootPrefabName, cloneName = cloneName }; GameObject val = ((IEnumerable<GameObject>)Resources.FindObjectsOfTypeAll<GameObject>()).FirstOrDefault((Func<GameObject, bool>)((GameObject go) => ((Object)go).name == CS$<>8__locals0.rootPrefabName && (Object)(object)go.transform.parent == (Object)null)); if ((Object)(object)val == (Object)null) { MelonLogger.Warning(CS$<>8__locals0.rootPrefabName + " not found!"); return false; } Transform obj = val.transform.Find(rootChildName); GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null); object obj2; if (!combinedUnderRoot) { if (val2 == null) { obj2 = null; } else { Transform obj3 = val2.transform.Find(combinedName); obj2 = ((obj3 != null) ? ((Component)obj3).gameObject : null); } } else { Transform obj4 = val.transform.Find(combinedName); obj2 = ((obj4 != null) ? ((Component)obj4).gameObject : null); } GameObject val3 = (GameObject)obj2; object obj5; if (val2 == null) { obj5 = null; } else { Transform obj6 = val2.transform.Find("Lightbar"); obj5 = ((obj6 != null) ? ((Component)obj6).gameObject : null); } GameObject val4 = (GameObject)obj5; if ((Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null) { MelonLogger.Warning($"{combinedName} or {rootChildName} missing under {CS$<>8__locals0.rootPrefabName}!"); return false; } foreach (GameObject item in ((IEnumerable<GameObject>)Object.FindObjectsOfType<GameObject>()).Where((GameObject o) => ((Object)o).name.Contains(CS$<>8__locals0.cloneName))) { LandVehicle component = item.GetComponent<LandVehicle>(); if ((Object)(object)component == (Object)null || !component.IsPlayerOwned || VehicleTracker.Vehicles.Contains(component)) { continue; } VehicleTracker.Vehicles.Add(component); object obj8; if (!combinedUnderRoot) { Transform obj7 = item.transform.Find(rootChildName); obj8 = ((obj7 != null) ? obj7.Find(combinedName) : null); } else { obj8 = item.transform.Find(combinedName); } Transform val5 = (Transform)obj8; if ((Object)(object)val5 == (Object)null) { continue; } Object.Destroy((Object)(object)((Component)val5).gameObject); Transform val6 = (combinedUnderRoot ? item.transform : item.transform.Find(rootChildName)); GameObject val7 = Object.Instantiate<GameObject>(val3, val6); ((Object)val7).name = combinedName; if (disableTrunkLid) { Transform obj9 = val7.transform.Find("TrunkLid"); MeshCollider val8 = ((obj9 != null) ? ((Component)obj9).GetComponent<MeshCollider>() : null); if ((Object)(object)val8 != (Object)null) { ((Collider)val8).enabled = false; } } if ((Object)(object)val4 != (Object)null) { Transform val9 = item.transform.Find(rootChildName); GameObject obj10 = Object.Instantiate<GameObject>(val4, val9); ((Object)obj10).name = "Lightbar"; PoliceLight component2 = obj10.GetComponent<PoliceLight>(); if ((Object)(object)component2 != (Object)null) { VehicleTracker.Lights.Add(component2); } } } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ConvertVehicles>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public bool first; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ConvertVehicles>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (first) { <>2__current = (object)new WaitForSeconds(4f); <>1__state = 1; return true; } goto IL_004e; case 1: <>1__state = -1; goto IL_004e; case 2: <>1__state = -1; <>2__current = ConvertPoliceVariant("SUV_Police", "SUV", "suv combined", "SUV(Clone)", combinedUnderRoot: false, disableTrunkLid: false); <>1__state = 3; return true; case 3: { <>1__state = -1; return false; } IL_004e: <>2__current = ConvertPoliceVariant("Shitbox_Police", "shitbox", "shitbox_combined", "Shitbox(Clone)", combinedUnderRoot: true, disableTrunkLid: true); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static bool lightsActive; public override void OnSceneWasLoaded(int buildIndex, string sceneName) { ((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName); MelonCoroutines.Start(ConvertVehicles()); } public override void OnInitializeMelon() { Config.Load(); } public override void OnUpdate() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) bool flag = lightsActive; if (Config.Hold) { flag = Input.GetKey(Config.LightKey); } else if (Input.GetKeyDown(Config.LightKey)) { flag = !lightsActive; } if (flag == lightsActive) { return; } lightsActive = flag; for (int i = 0; i < VehicleTracker.Vehicles.Count; i++) { if (VehicleTracker.Vehicles[i].localPlayerIsDriver && (Object)(object)VehicleTracker.Lights[i] != (Object)null) { VehicleTracker.Lights[i].IsOn = lightsActive; } } } [IteratorStateMachine(typeof(<ConvertVehicles>d__4))] private static IEnumerator ConvertVehicles(bool first = true) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ConvertVehicles>d__4(0) { first = first }; } [IteratorStateMachine(typeof(<ConvertPoliceVariant>d__5))] private static IEnumerator ConvertPoliceVariant(string rootPrefabName, string rootChildName, string combinedName, string cloneName, bool combinedUnderRoot, bool disableTrunkLid) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ConvertPoliceVariant>d__5(0) { rootPrefabName = rootPrefabName, rootChildName = rootChildName, combinedName = combinedName, cloneName = cloneName, combinedUnderRoot = combinedUnderRoot, disableTrunkLid = disableTrunkLid }; } }