Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of TheIncident v1.0.0
TheIncident.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using FishNet.Connection; using FishNet.Object; using MelonLoader; using ScheduleOne.AvatarFramework.Equipping; using ScheduleOne.DevUtilities; using ScheduleOne.GameTime; using ScheduleOne.NPCs; using ScheduleOne.NPCs.Behaviour; using ScheduleOne.PlayerScripts; using ScheduleOne.Police; using TheIncident; using UnityEngine; [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.0", "XOWithSauce", null)] [assembly: MelonColor] [assembly: MelonOptionalDependencies(new string[] { "FishNet.Runtime" })] [assembly: MelonGame(null, null)] [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: AssemblyVersion("1.0.0.0")] 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.0"; public const string DownloadLink = null; } public class TheIncident : MelonMod { [CompilerGenerated] private sealed class <IncidentBegin>d__11 : 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 NPC[] <>s__11; private int <>s__12; private NPC <npc>5__13; private float <distanceToP>5__14; private PoliceOfficer <offc>5__15; private List<NPC>.Enumerator <>s__16; private NPC <npc>5__17; private Vector3 <pos>5__18; private Vector3 <pos>5__19; private int <roll>5__20; private int <i>5__21; private NPC[] <>s__22; private int <>s__23; private NPC <npc>5__24; private float <xInitOffset>5__25; private float <zInitOffset>5__26; private Vector3 <targetWarpPosition>5__27; private Vector3 <warpInit>5__28; private NPC[] <>s__29; private int <>s__30; private NPC <npc>5__31; private PoliceOfficer[] <>s__32; private int <>s__33; private PoliceOfficer <offc>5__34; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <IncidentBegin>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 7) <= 4u) { try { } finally { <>m__Finally1(); } } <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 = null; <npc>5__13 = null; <offc>5__15 = null; <>s__16 = default(List<NPC>.Enumerator); <npc>5__17 = null; <>s__22 = null; <npc>5__24 = null; <>s__29 = null; <npc>5__31 = null; <>s__32 = null; <offc>5__34 = null; <>1__state = -2; } private bool MoveNext() { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Expected O, but got Unknown //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Expected O, but got Unknown //IL_0691: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Expected O, but got Unknown //IL_090e: Unknown result type (might be due to invalid IL or missing references) //IL_091e: Unknown result type (might be due to invalid IL or missing references) //IL_0d4f: Unknown result type (might be due to invalid IL or missing references) //IL_0d59: Expected O, but got Unknown //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Expected O, but got Unknown //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_071f: Unknown result type (might be due to invalid IL or missing references) //IL_07cc: Unknown result type (might be due to invalid IL or missing references) //IL_07d6: Expected O, but got Unknown //IL_079d: Unknown result type (might be due to invalid IL or missing references) //IL_07ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected O, but got Unknown //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Expected O, but got Unknown //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Expected O, but got Unknown //IL_0c2f: Unknown result type (might be due to invalid IL or missing references) //IL_0c39: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Expected O, but got Unknown //IL_08e3: Unknown result type (might be due to invalid IL or missing references) //IL_08ed: Expected O, but got Unknown //IL_0aec: Unknown result type (might be due to invalid IL or missing references) //IL_0af6: Expected O, but got Unknown //IL_09df: Unknown result type (might be due to invalid IL or missing references) //IL_09f5: Unknown result type (might be due to invalid IL or missing references) //IL_09fa: Unknown result type (might be due to invalid IL or missing references) //IL_09ff: Unknown result type (might be due to invalid IL or missing references) //IL_0a10: Unknown result type (might be due to invalid IL or missing references) //IL_0a2d: Unknown result type (might be due to invalid IL or missing references) //IL_0d13: Unknown result type (might be due to invalid IL or missing references) //IL_0d1d: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <startTime>5__1 = 1855; goto IL_00c4; case 1: <>1__state = -1; <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) { MelonCoroutines.Start(<>4__this.LightsRed()); <players>5__4 = Object.FindObjectsOfType<Player>(true); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; } goto IL_00c4; case 2: <>1__state = -1; <offcs>5__5 = Object.FindObjectsOfType<PoliceOfficer>(true); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 3; return true; case 3: <>1__state = -1; <>s__7 = <offcs>5__5; <>s__8 = 0; goto IL_02f3; case 4: <>1__state = -1; 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.Revive(); <offc>5__9.ProxCircle.SetRadius(0.01f); <offc>5__9 = null; <>s__8++; goto IL_02f3; case 5: <>1__state = -1; <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)]; <>s__11 = <>4__this.npcs; <>s__12 = 0; goto IL_051d; case 6: { <>1__state = -1; <distanceToP>5__14 = Vector3.Distance(((Component)<npc>5__13).transform.position, ((Component)<randomPlayer>5__10).transform.position); if (<distanceToP>5__14 < 30f) { <nearbyNPCs>5__6.Add(<npc>5__13); <npc>5__13.Avatar.Effects.SetZombified(true, true); } if (<npc>5__13.Health.IsDead) { <npc>5__13.Health.Revive(); } if (<npc>5__13.Health.IsKnockedOut) { ((Behaviour)<npc>5__13.behaviour.UnconsciousBehaviour).SendEnd(); } ref PoliceOfficer reference = ref <offc>5__15; NPC obj = <npc>5__13; reference = (PoliceOfficer)(object)((obj is PoliceOfficer) ? obj : null); if (<offc>5__15 != null) { ((NPC)<offc>5__15).behaviour.CombatBehaviour.SetTarget((NetworkConnection)null, ((NetworkBehaviour)<randomPlayer>5__10).NetworkObject); } if (<nearbyNPCs>5__6.Count >= 12) { goto IL_0530; } <offc>5__15 = null; <npc>5__13 = null; <>s__12++; goto IL_051d; } case 7: <>1__state = -3; <npc>5__17.OverrideAggression(1f); <npc>5__17.Movement.RunSpeed = Random.Range(2f, 12f); <npc>5__17.behaviour.CombatBehaviour.VirtualPunchWeapon.Damage = Random.Range(0.01f, 0.08f); <>2__current = (object)new WaitForSeconds(0.02f); <>1__state = 8; return true; case 8: <>1__state = -3; <npc>5__17.Avatar.LoadNaked(); <npc>5__17.Avatar.Effects.SetZombified(true, true); <npc>5__17.Avatar.Effects.GurgleSound.Play(); <npc>5__17.Movement.Disoriented = true; <>2__current = (object)new WaitForSeconds(0.02f); <>1__state = 9; return true; case 9: <>1__state = -3; if (<npc>5__17.isInBuilding) { <npc>5__17.ExitBuilding(""); ((Behaviour)<npc>5__17.behaviour.CombatBehaviour).Enable_Networked((NetworkConnection)null); <npc>5__17.Movement.GetClosestReachablePoint(((Component)<randomPlayer>5__10).transform.position, ref <pos>5__18); <npc>5__17.Movement.SetDestination(<pos>5__18); } <>2__current = (object)new WaitForSeconds(0.02f); <>1__state = 10; return true; case 10: <>1__state = -3; if (<npc>5__17.IsInVehicle) { <npc>5__17.ExitVehicle(); ((Behaviour)<npc>5__17.behaviour.CombatBehaviour).Enable_Networked((NetworkConnection)null); <npc>5__17.Movement.GetClosestReachablePoint(((Component)<randomPlayer>5__10).transform.position, ref <pos>5__19); <npc>5__17.Movement.SetDestination(<pos>5__19); } <>2__current = (object)new WaitForSeconds(0.02f); <>1__state = 11; return true; case 11: <>1__state = -3; <npc>5__17.behaviour.CombatBehaviour.SetTarget((NetworkConnection)null, ((NetworkBehaviour)<randomPlayer>5__10).NetworkObject); ((Behaviour)<npc>5__17.behaviour.CombatBehaviour).Enable_Networked((NetworkConnection)null); <npc>5__17 = null; goto IL_082e; case 12: <>1__state = -1; if (Vector3.Distance(((Component)<npc>5__24).transform.position, ((Component)<randomPlayer>5__10).transform.position) < 100f) { <i>5__21++; <xInitOffset>5__25 = Random.Range(15f, 30f); <zInitOffset>5__26 = Random.Range(15f, 30f); <xInitOffset>5__25 *= ((Random.Range(0f, 1f) > 0.5f) ? 1f : (-1f)); <zInitOffset>5__26 *= ((Random.Range(0f, 1f) > 0.5f) ? 1f : (-1f)); <targetWarpPosition>5__27 = ((Component)<randomPlayer>5__10).transform.position + new Vector3(<xInitOffset>5__25, 0f, <zInitOffset>5__26); <npc>5__24.Movement.GetClosestReachablePoint(<targetWarpPosition>5__27, ref <warpInit>5__28); <npc>5__24.Movement.Warp(<warpInit>5__28); <npc>5__24.Movement.WarpToNavMesh(); } <npc>5__24 = null; <>s__23++; goto IL_0a60; case 13: <>1__state = -1; <npc>5__31.ResetAggression(); <npc>5__31.Movement.RunSpeed = 7f; <npc>5__31.behaviour.CombatBehaviour.VirtualPunchWeapon.Damage = 0.25f; ((Behaviour)<npc>5__31.behaviour.CombatBehaviour).SendEnd(); <npc>5__31.Movement.Disoriented = false; if (<npc>5__31.Health.IsDead) { ((Behaviour)<npc>5__31.behaviour.DeadBehaviour).SendEnd(); } if (<npc>5__31.Health.IsKnockedOut) { ((Behaviour)<npc>5__31.behaviour.UnconsciousBehaviour).SendEnd(); } <npc>5__31 = null; <>s__30++; goto IL_0be2; case 14: <>1__state = -1; <offc>5__34.GunPrefab = <>4__this.gunPref; <offc>5__34.TaserPrefab = <>4__this.taser; if ((Object)(object)<>4__this.gunPref != (Object)null && (Object)(object)<offc>5__34.GunPrefab == (Object)null) { <offc>5__34.GunPrefab = <>4__this.gunPref; } ((NPC)<offc>5__34).ResetAggression(); if ((Object)(object)<>4__this.taser != (Object)null && (Object)(object)<offc>5__34.TaserPrefab == (Object)null) { <offc>5__34.TaserPrefab = <>4__this.taser; } <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 15; return true; case 15: <>1__state = -1; <offc>5__34.ProxCircle.SetRadius(2f); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 16; return true; case 16: { <>1__state = -1; ((Behaviour)<offc>5__34.PursuitBehaviour).SendEnd(); ((Behaviour)((NPC)<offc>5__34).behaviour.CombatBehaviour).SendEnd(); <offc>5__34 = null; <>s__33++; goto IL_0dac; } IL_0a60: if (<>s__23 < <>s__22.Length) { <npc>5__24 = <>s__22[<>s__23]; if (<i>5__21 <= 3) { <>2__current = (object)new WaitForSeconds(<>4__this.sleepTime); <>1__state = 12; return true; } } <>s__22 = null; goto IL_0a7c; IL_02f3: if (<>s__8 < <>s__7.Length) { <offc>5__9 = <>s__7[<>s__8]; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 4; return true; } <>s__7 = null; <nearbyNPCs>5__6 = new List<NPC>(); goto IL_0a90; IL_0a7c: <nearbyNPCs>5__6.Clear(); <randomPlayer>5__10 = null; goto IL_0a90; IL_00c4: <>2__current = (object)new WaitForSeconds(30f); <>1__state = 1; return true; IL_0be2: if (<>s__30 < <>s__29.Length) { <npc>5__31 = <>s__29[<>s__30]; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 13; return true; } <>s__29 = null; <>s__32 = <offcs>5__5; <>s__33 = 0; goto IL_0dac; IL_0530: <>s__11 = null; if (<nearbyNPCs>5__6.Count > 0) { <>4__this.sleepTime = 0.05f; <>s__16 = <nearbyNPCs>5__6.GetEnumerator(); <>1__state = -3; goto IL_082e; } <>4__this.sleepTime = 0.5f; <roll>5__20 = Random.Range(1, 100); <i>5__21 = 0; if (<roll>5__20 > 95) { <>s__22 = <>4__this.npcs; <>s__23 = 0; goto IL_0a60; } goto IL_0a7c; IL_051d: if (<>s__12 < <>s__11.Length) { <npc>5__13 = <>s__11[<>s__12]; <>2__current = (object)new WaitForSeconds(<>4__this.sleepTime); <>1__state = 6; return true; } goto IL_0530; IL_0a90: if (((object)(EDay)(ref <currentDay>5__2)).ToString().Contains("Sunday")) { <>2__current = (object)new WaitForSeconds(<>4__this.sleepTime * 10f); <>1__state = 5; return true; } <>s__29 = <>4__this.npcs; <>s__30 = 0; goto IL_0be2; IL_0dac: if (<>s__33 < <>s__32.Length) { <offc>5__34 = <>s__32[<>s__33]; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 14; return true; } <>s__32 = null; MelonCoroutines.Start(<>4__this.LightsClear()); <players>5__4 = null; <offcs>5__5 = null; <nearbyNPCs>5__6 = null; goto IL_00c4; IL_082e: if (<>s__16.MoveNext()) { <npc>5__17 = <>s__16.Current; <>2__current = (object)new WaitForSeconds(0.02f); <>1__state = 7; return true; } <>m__Finally1(); <>s__16 = default(List<NPC>.Enumerator); goto IL_0a7c; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } 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__16).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LightsClear>d__10 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public TheIncident <>4__this; private int <i>5__1; private Exception <ex>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LightsClear>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <ex>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_006e: 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; try { <>4__this.lights[<i>5__1].color = <>4__this.lColors[<i>5__1]; } catch (Exception ex) { <ex>5__2 = ex; } <i>5__1++; break; } if (<i>5__1 < <>4__this.lights.Length) { <>2__current = (object)new WaitForSeconds(0.01f); <>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__9 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public TheIncident <>4__this; private Light[] <>s__1; private int <>s__2; private Light <l>5__3; private Exception <ex>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LightsRed>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = null; <l>5__3 = null; <ex>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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; try { <>4__this.lColors.Add(<l>5__3.color); <l>5__3.color = Color.red; } catch (Exception ex) { <ex>5__4 = ex; } <l>5__3 = null; <>s__2++; } else { <>1__state = -1; if (<>4__this.lights.Length == 0) { goto IL_00f7; } <>s__1 = <>4__this.lights; <>s__2 = 0; } if (<>s__2 < <>s__1.Length) { <l>5__3 = <>s__1[<>s__2]; <>2__current = (object)new WaitForSeconds(0.02f); <>1__state = 1; return true; } <>s__1 = null; goto IL_00f7; IL_00f7: 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 NPC[] npcs; private Light[] lights; private List<object> coros = new List<object>(); private AvatarEquippable taser; private AvatarEquippable gunPref; private List<Color> lColors = new List<Color>(); private float sleepTime = 0.05f; public override void OnApplicationStart() { } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { if (buildIndex == 1) { npcs = Object.FindObjectsOfType<NPC>(true); lights = Object.FindObjectsOfType<Light>(true); coros.Add(MelonCoroutines.Start(IncidentBegin())); return; } foreach (object coro in coros) { MelonCoroutines.Stop(coro); } coros.Clear(); } [IteratorStateMachine(typeof(<LightsRed>d__9))] private IEnumerator LightsRed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LightsRed>d__9(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<LightsClear>d__10))] private IEnumerator LightsClear() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LightsClear>d__10(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<IncidentBegin>d__11))] private IEnumerator IncidentBegin() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <IncidentBegin>d__11(0) { <>4__this = this }; } }