Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of The Incident MONO v1.1.0
TheIncident.dll
Decompiled 2 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 System.Security; using System.Security.Permissions; using FishNet.Connection; using FishNet.Object; using MelonLoader; using ScheduleOne.AvatarFramework.Equipping; using ScheduleOne.DevUtilities; using ScheduleOne.Employees; using ScheduleOne.GameTime; using ScheduleOne.NPCs; using ScheduleOne.NPCs.Behaviour; using ScheduleOne.Persistence; using ScheduleOne.PlayerScripts; using ScheduleOne.Police; using TheIncident; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(global::TheIncident.TheIncident), "TheIncident", "1.1", "XOWithSauce", null)] [assembly: MelonColor] [assembly: MelonOptionalDependencies(new string[] { "FishNet.Runtime" })] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("TheIncident")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TheIncident")] [assembly: AssemblyTitle("TheIncident")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace TheIncident { public static class BuildInfo { public const string Name = "TheIncident"; public const string Description = "A deadly disease hits the Hyland Point"; public const string Author = "XOWithSauce"; public const string Company = null; public const string Version = "1.1"; public const string DownloadLink = null; } public class TheIncident : MelonMod { [CompilerGenerated] private sealed class <IncidentBegin>d__17 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public TheIncident <>4__this; private int <startTime>5__1; private EDay <currentDay>5__2; private int <currentTime>5__3; private Player[] <players>5__4; private PoliceOfficer[] <offcs>5__5; private List<NPC> <nearbyNPCs>5__6; private PoliceOfficer[] <>s__7; private int <>s__8; private PoliceOfficer <offc>5__9; private Player <randomPlayer>5__10; private List<NPC>.Enumerator <>s__11; private NPC <npc>5__12; private float <distanceToP>5__13; private List<NPC>.Enumerator <>s__14; private NPC <npc>5__15; private Vector3 <pos>5__16; private Vector3 <pos>5__17; private int <roll>5__18; private int <i>5__19; private List<NPC>.Enumerator <>s__20; private NPC <npc>5__21; private float <xInitOffset>5__22; private float <zInitOffset>5__23; private Vector3 <targetWarpPosition>5__24; private Vector3 <closest>5__25; private List<NPC>.Enumerator <>s__26; private NPC <npc>5__27; private PoliceOfficer[] <>s__28; private int <>s__29; private PoliceOfficer <offc>5__30; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <IncidentBegin>d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { switch (<>1__state) { case -3: case 4: try { } finally { <>m__Finally1(); } break; case -4: case 5: try { } finally { <>m__Finally2(); } break; case -5: case 6: try { } finally { <>m__Finally3(); } break; case -6: case 7: try { } finally { <>m__Finally4(); } break; } <players>5__4 = null; <offcs>5__5 = null; <nearbyNPCs>5__6 = null; <>s__7 = null; <offc>5__9 = null; <randomPlayer>5__10 = null; <>s__11 = default(List<NPC>.Enumerator); <npc>5__12 = null; <>s__14 = default(List<NPC>.Enumerator); <npc>5__15 = null; <>s__20 = default(List<NPC>.Enumerator); <npc>5__21 = null; <>s__26 = default(List<NPC>.Enumerator); <npc>5__27 = null; <>s__28 = null; <offc>5__30 = null; <>1__state = -2; } private bool MoveNext() { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0881: Unknown result type (might be due to invalid IL or missing references) //IL_0891: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_06aa: Unknown result type (might be due to invalid IL or missing references) //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_0707: Unknown result type (might be due to invalid IL or missing references) //IL_0952: Unknown result type (might be due to invalid IL or missing references) //IL_0968: Unknown result type (might be due to invalid IL or missing references) //IL_096d: Unknown result type (might be due to invalid IL or missing references) //IL_0972: Unknown result type (might be due to invalid IL or missing references) //IL_0983: Unknown result type (might be due to invalid IL or missing references) //IL_0995: Unknown result type (might be due to invalid IL or missing references) //IL_099a: Unknown result type (might be due to invalid IL or missing references) //IL_09bb: Unknown result type (might be due to invalid IL or missing references) bool result; try { switch (<>1__state) { default: result = false; goto end_IL_0000; case 0: <>1__state = -1; <startTime>5__1 = 1730; goto IL_0079; case 1: <>1__state = -1; if (!<>4__this.registered) { result = false; } else { <currentDay>5__2 = NetworkSingleton<TimeManager>.Instance.CurrentDay; <currentTime>5__3 = NetworkSingleton<TimeManager>.Instance.CurrentTime; if (!((object)(EDay)(ref <currentDay>5__2)).ToString().Contains("Sunday") || <startTime>5__1 > <currentTime>5__3) { goto IL_0079; } <>4__this.coros.Add(MelonCoroutines.Start(<>4__this.LightsRed())); <players>5__4 = Object.FindObjectsOfType<Player>(true); <offcs>5__5 = Object.FindObjectsOfType<PoliceOfficer>(true); <>2__current = Wait01; <>1__state = 2; result = true; } goto end_IL_0000; case 2: <>1__state = -1; if (<>4__this.registered) { <>s__7 = <offcs>5__5; for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++) { <offc>5__9 = <>s__7[<>s__8]; if ((Object)(object)<>4__this.gunPref == (Object)null && (Object)(object)<offc>5__9.GunPrefab != (Object)null) { <>4__this.gunPref = <offc>5__9.GunPrefab; } if ((Object)(object)<>4__this.taser == (Object)null && (Object)(object)<offc>5__9.TaserPrefab != (Object)null) { <>4__this.taser = <offc>5__9.TaserPrefab; } <offc>5__9.GunPrefab = null; <offc>5__9.TaserPrefab = null; ((NPC)<offc>5__9).Health.MaxHealth = 300f; ((NPC)<offc>5__9).Health.Health = 300f; ((NPC)<offc>5__9).Health.Revive(); <offc>5__9.PursuitBehaviour.arrestingEnabled = false; ((NPC)<offc>5__9).Awareness.VisionCone.VisionEnabled = false; <offc>5__9 = null; } <>s__7 = null; <nearbyNPCs>5__6 = new List<NPC>(); goto IL_0aa8; } result = false; goto end_IL_0000; case 3: <>1__state = -1; if (<>4__this.registered) { <currentDay>5__2 = NetworkSingleton<TimeManager>.Instance.CurrentDay; <currentTime>5__3 = NetworkSingleton<TimeManager>.Instance.CurrentTime; <randomPlayer>5__10 = <players>5__4[Random.Range(0, <players>5__4.Length)]; if ((Object)(object)<randomPlayer>5__10.CurrentProperty != (Object)null) { goto IL_0aa8; } <>s__11 = <>4__this.npcs.GetEnumerator(); <>1__state = -3; goto IL_04da; } result = false; goto end_IL_0000; case 4: <>1__state = -3; if (<>4__this.registered) { <distanceToP>5__13 = Vector3.Distance(((Component)<npc>5__12).transform.position, ((Component)<randomPlayer>5__10).transform.position); if (<distanceToP>5__13 < 50f) { <nearbyNPCs>5__6.Add(<npc>5__12); <npc>5__12.Avatar.Effects.SetZombified(true, true); } if (<npc>5__12.Health.IsDead) { <npc>5__12.Health.Revive(); } if (<npc>5__12.Health.IsKnockedOut) { ((Behaviour)<npc>5__12.Behaviour.UnconsciousBehaviour).Disable_Networked((NetworkConnection)null); } if (<nearbyNPCs>5__6.Count >= 16) { goto IL_04ea; } <npc>5__12 = null; goto IL_04da; } result = false; <>m__Finally1(); goto end_IL_0000; case 5: <>1__state = -4; if (<>4__this.registered) { <npc>5__15.Movement.RunSpeed = Random.Range(6f, 13f); if ((Object)(object)<npc>5__15.Behaviour.CombatBehaviour.currentWeapon != (Object)null) { <npc>5__15.Behaviour.CombatBehaviour.currentWeapon = null; } <npc>5__15.Behaviour.CombatBehaviour.VirtualPunchWeapon.Damage = Random.Range(0.08f, 0.15f); <npc>5__15.Avatar.Effects.SetZombified(true, true); <npc>5__15.Avatar.Effects.GurgleSound.Play(); <npc>5__15.Movement.Disoriented = true; if (<npc>5__15.isInBuilding) { <npc>5__15.ExitBuilding(""); <npc>5__15.Movement.GetClosestReachablePoint(((Component)<randomPlayer>5__10).transform.position, ref <pos>5__16); <npc>5__15.Movement.SetDestination(<pos>5__16); } if (<npc>5__15.IsInVehicle) { <npc>5__15.ExitVehicle(); <npc>5__15.Movement.GetClosestReachablePoint(((Component)<randomPlayer>5__10).transform.position, ref <pos>5__17); <npc>5__15.Movement.SetDestination(<pos>5__17); } if (<npc>5__15.Behaviour.CombatBehaviour.Target == null) { <npc>5__15.Behaviour.CombatBehaviour.SetTarget(((NetworkBehaviour)<randomPlayer>5__10).NetworkObject); } if (!((Behaviour)<npc>5__15.Behaviour.CombatBehaviour).isActiveAndEnabled) { ((Behaviour)<npc>5__15.Behaviour.CombatBehaviour).Enable_Networked((NetworkConnection)null); } <npc>5__15 = null; goto IL_078f; } result = false; <>m__Finally2(); goto end_IL_0000; case 6: <>1__state = -5; if (<>4__this.registered) { if (Vector3.Distance(((Component)<npc>5__21).transform.position, ((Component)<randomPlayer>5__10).transform.position) < 100f) { <i>5__19++; <xInitOffset>5__22 = Random.Range(15f, 30f); <zInitOffset>5__23 = Random.Range(15f, 30f); <xInitOffset>5__22 *= ((Random.Range(0f, 1f) > 0.5f) ? 1f : (-1f)); <zInitOffset>5__23 *= ((Random.Range(0f, 1f) > 0.5f) ? 1f : (-1f)); <targetWarpPosition>5__24 = ((Component)<randomPlayer>5__10).transform.position + new Vector3(<xInitOffset>5__22, 0f, <zInitOffset>5__23); <npc>5__21.Movement.GetClosestReachablePoint(<targetWarpPosition>5__24, ref <closest>5__25); if (<closest>5__25 == Vector3.zero) { goto IL_0a61; } <npc>5__21.Movement.Warp(<closest>5__25); if (<npc>5__21.Health.IsDead || <npc>5__21.Health.IsKnockedOut) { <npc>5__21.Health.Revive(); } if (<npc>5__21.Behaviour.CombatBehaviour.Target == null) { <npc>5__21.Behaviour.CombatBehaviour.SetTarget(((NetworkBehaviour)<randomPlayer>5__10).NetworkObject); } ((Behaviour)<npc>5__21.Behaviour.CombatBehaviour).Enable_Networked((NetworkConnection)null); } <npc>5__21 = null; goto IL_0a61; } result = false; <>m__Finally3(); goto end_IL_0000; case 7: <>1__state = -6; if (<>4__this.registered) { <npc>5__27.ResetAggression(); <npc>5__27.Movement.RunSpeed = 7f; <npc>5__27.Behaviour.CombatBehaviour.VirtualPunchWeapon.Damage = 0.25f; ((Behaviour)<npc>5__27.Behaviour.CombatBehaviour).SendEnd(); ((Behaviour)<npc>5__27.Behaviour.CombatBehaviour).Disable_Networked((NetworkConnection)null); <npc>5__27.Movement.Disoriented = false; if (<npc>5__27.Health.IsDead || <npc>5__27.Health.IsKnockedOut) { <npc>5__27.Health.Revive(); } <npc>5__27 = null; goto IL_0c21; } result = false; <>m__Finally4(); goto end_IL_0000; case 8: { <>1__state = -1; if (<>4__this.registered) { <offc>5__30.GunPrefab = <>4__this.gunPref; <offc>5__30.TaserPrefab = <>4__this.taser; if ((Object)(object)<>4__this.gunPref != (Object)null && (Object)(object)<offc>5__30.GunPrefab == (Object)null) { <offc>5__30.GunPrefab = <>4__this.gunPref; } ((NPC)<offc>5__30).ResetAggression(); if ((Object)(object)<>4__this.taser != (Object)null && (Object)(object)<offc>5__30.TaserPrefab == (Object)null) { <offc>5__30.TaserPrefab = <>4__this.taser; } ((NPC)<offc>5__30).Awareness.VisionCone.VisionEnabled = true; <offc>5__30.PursuitBehaviour.arrestingEnabled = false; <offc>5__30 = null; <>s__29++; break; } result = false; goto end_IL_0000; } IL_0c21: if (!<>s__26.MoveNext()) { <>m__Finally4(); <>s__26 = default(List<NPC>.Enumerator); <>s__28 = <offcs>5__5; <>s__29 = 0; break; } <npc>5__27 = <>s__26.Current; <>2__current = eval; <>1__state = 7; result = true; goto end_IL_0000; IL_0a61: if (!<>s__20.MoveNext()) { goto IL_0a71; } <npc>5__21 = <>s__20.Current; if (<i>5__19 > 3) { goto IL_0a71; } <>2__current = eval; <>1__state = 6; result = true; goto end_IL_0000; IL_0aa8: if (!((object)(EDay)(ref <currentDay>5__2)).ToString().Contains("Sunday") && !((object)(EDay)(ref <currentDay>5__2)).ToString().Contains("Monday")) { <>s__26 = <>4__this.npcs.GetEnumerator(); <>1__state = -6; goto IL_0c21; } <>2__current = evalLong; <>1__state = 3; result = true; goto end_IL_0000; IL_0a71: <>m__Finally3(); <>s__20 = default(List<NPC>.Enumerator); goto IL_0a94; IL_0a94: <nearbyNPCs>5__6.Clear(); <randomPlayer>5__10 = null; goto IL_0aa8; IL_04da: if (!<>s__11.MoveNext()) { goto IL_04ea; } <npc>5__12 = <>s__11.Current; <>2__current = eval; <>1__state = 4; result = true; goto end_IL_0000; IL_078f: if (!<>s__14.MoveNext()) { <>m__Finally2(); <>s__14 = default(List<NPC>.Enumerator); goto IL_0a94; } <npc>5__15 = <>s__14.Current; <>2__current = eval; <>1__state = 5; result = true; goto end_IL_0000; IL_04ea: <>m__Finally1(); <>s__11 = default(List<NPC>.Enumerator); if (<nearbyNPCs>5__6.Count > 0) { <>s__14 = <nearbyNPCs>5__6.GetEnumerator(); <>1__state = -4; goto IL_078f; } <roll>5__18 = Random.Range(1, 100); <i>5__19 = 0; if (<roll>5__18 > 95) { <>s__20 = <>4__this.npcs.GetEnumerator(); <>1__state = -5; goto IL_0a61; } goto IL_0a94; IL_0079: <>2__current = Wait30; <>1__state = 1; result = true; goto end_IL_0000; } if (<>s__29 < <>s__28.Length) { <offc>5__30 = <>s__28[<>s__29]; <>2__current = eval; <>1__state = 8; result = true; } else { <>s__28 = null; <>4__this.coros.Add(MelonCoroutines.Start(<>4__this.LightsClear())); result = false; } end_IL_0000:; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__11).Dispose(); } private void <>m__Finally2() { <>1__state = -1; ((IDisposable)<>s__14).Dispose(); } private void <>m__Finally3() { <>1__state = -1; ((IDisposable)<>s__20).Dispose(); } private void <>m__Finally4() { <>1__state = -1; ((IDisposable)<>s__26).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LightsClear>d__16 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public TheIncident <>4__this; private int <i>5__1; private Light <l>5__2; private Exception <ex>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LightsClear>d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <l>5__2 = null; <ex>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <i>5__1 = 0; break; case 1: <>1__state = -1; if (!<>4__this.registered) { return false; } try { <l>5__2 = <>4__this.lightsColors.ElementAt(<i>5__1).Key; if ((Object)(object)<l>5__2 != (Object)null) { <l>5__2.color = <>4__this.lightsColors.ElementAt(<i>5__1).Value; } <l>5__2 = null; } catch (Exception ex) { <ex>5__3 = ex; } <i>5__1++; break; } if (<i>5__1 < <>4__this.lightsColors.Count) { <>2__current = Wait01; <>1__state = 1; return true; } 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 <LightsRed>d__15 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public TheIncident <>4__this; private int <i>5__1; private Light <l>5__2; private Exception <ex>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LightsRed>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <l>5__2 = null; <ex>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; if (!<>4__this.registered) { return false; } try { <l>5__2 = <>4__this.lightsColors.ElementAt(<i>5__1).Key; if ((Object)(object)<l>5__2 != (Object)null) { <l>5__2.color = Color.red; } <l>5__2 = null; } catch (Exception ex) { <ex>5__3 = ex; } <i>5__1++; } else { <>1__state = -1; if (<>4__this.lightsColors.Count <= 0) { goto IL_010d; } <i>5__1 = 0; } if (<i>5__1 < <>4__this.lightsColors.Count) { <>2__current = Wait01; <>1__state = 1; return true; } goto IL_010d; IL_010d: 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(); } } private List<NPC> npcs = new List<NPC>(); private List<object> coros = new List<object>(); private AvatarEquippable taser; private AvatarEquippable gunPref; private Dictionary<Light, Color> lightsColors = new Dictionary<Light, Color>(); public static float sleepTime = 0.05f; private bool registered = false; private bool firstTimeLoad = true; public static WaitForSeconds Wait01 = new WaitForSeconds(0.1f); public static WaitForSeconds Wait30 = new WaitForSeconds(30f); public static WaitForSeconds evalLong = new WaitForSeconds(sleepTime * 10f); public static WaitForSeconds eval = new WaitForSeconds(sleepTime); public override void OnInitializeMelon() { MelonLogger.Msg(ConsoleColor.Red, "An Unknown Incident looms over the Hyland Point..."); } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown if (buildIndex == 1) { if ((Object)(object)Singleton<LoadManager>.Instance != (Object)null && !registered && firstTimeLoad) { Singleton<LoadManager>.Instance.onLoadComplete.AddListener(new UnityAction(OnLoadCompleteCb)); registered = true; firstTimeLoad = false; } return; } registered = false; foreach (object coro in coros) { MelonCoroutines.Stop(coro); } coros.Clear(); } private void OnLoadCompleteCb() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) npcs = Object.FindObjectsOfType<NPC>(true).ToList(); Light[] array = Object.FindObjectsOfType<Light>(true); for (int i = 0; i < array.Length; i++) { lightsColors.Add(array[i], array[i].color); } List<NPC> list = new List<NPC>(); for (int j = 0; j < npcs.Count; j++) { if (!(npcs[j] is Employee)) { list.Add(npcs[j]); } } npcs = list; coros.Add(MelonCoroutines.Start(IncidentBegin())); } [IteratorStateMachine(typeof(<LightsRed>d__15))] private IEnumerator LightsRed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LightsRed>d__15(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<LightsClear>d__16))] private IEnumerator LightsClear() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LightsClear>d__16(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<IncidentBegin>d__17))] private IEnumerator IncidentBegin() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <IncidentBegin>d__17(0) { <>4__this = this }; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }