diff --git a/Scp575-Exiled8/Config.cs b/Scp575-Exiled8/Config.cs new file mode 100644 index 0000000..e67bd42 --- /dev/null +++ b/Scp575-Exiled8/Config.cs @@ -0,0 +1,27 @@ +using Exiled.API.Interfaces; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.ComponentModel; +using UserSettings.AudioSettings; + +namespace Scp575_Exiled8 +{ + public class Config : IConfig + { + public bool IsEnabled { get; set; } = true; + public bool Debug { get; set; } = false; + public int spawnChance { get; set; } = 100; + public int minSpawnTime { get; set; } = 120; + public int maxSpawnTime { get; set; } = 180; + public int minBlackoutTime { get; set; } = 60; + public int maxBlackoutTime { get; set; } = 90; + [Description("The breach message used for C.A.S.S.I.E announcement")] + public string breachCassie { get; set; } = "Attention . All personnel . SCP 5 7 5 has breached containment"; + [Description("The recontainment message used for C.A.S.S.I.E announcement")] + public string recontainCassie { get; set; } = "SCP 5 7 5 has been recontained"; + } +} diff --git a/Scp575-Exiled8/Events/ServerHandler.cs b/Scp575-Exiled8/Events/ServerHandler.cs new file mode 100644 index 0000000..0c90c28 --- /dev/null +++ b/Scp575-Exiled8/Events/ServerHandler.cs @@ -0,0 +1,73 @@ + +using Exiled.API.Features; +using PluginAPI.Events; +using System; +using System.Collections; +using System.Threading; +using MEC; +using System.Collections.Generic; +using Exiled.Events.EventArgs.Server; +using UnityEngine; +using Random = UnityEngine.Random; +using Exiled.Events.EventArgs.Player; +using PlayerRoles; +using System.Linq; +using System.Diagnostics.Eventing.Reader; + +namespace Scp575_Exiled8.Events +{ + public class ServerHandler + { + private static Config config = Scp575.Instance.Config; + private static bool scpsAlive = true; + private static MEC.CoroutineHandle yes; + private static bool breached = false; + + public static void OnRoundStarted() + { + yes = Timing.RunCoroutine(iHaveNoIdeaWhatToNameThis()); + } + + public static void OnRoundEnded(RoundEndedEventArgs ev) + { + Timing.KillCoroutines(yes); + } + + + + public static IEnumerator iHaveNoIdeaWhatToNameThis() + { + for (; ; ) + { + + yield return Timing.WaitForSeconds(Random.Range(config.minSpawnTime, config.maxSpawnTime)); + if (Player.List.Count(x => x.IsScp) == 0) scpsAlive = false; else scpsAlive = true; + if (Random.Range(config.spawnChance, 101) == 100 && scpsAlive) + { + Log.Info("Spawn condition met"); + if (scpsAlive) + { + Map.TurnOffAllLights(Random.Range(config.minBlackoutTime, config.maxSpawnTime)); + if (!breached) Cassie.Message(config.breachCassie); Log.Info("Breached"); + if (breached) Log.Info("Breach already happened"); + breached = true; + } else + { + if (breached) + { + Cassie.Message(config.recontainCassie); + Log.Info("No More SCPs are left"); + break; + } + else Log.Info("Breach never happened"); + break; + + } + } else + { + Log.Info("Spawn condition not met"); + } + } + } + } +} diff --git a/Scp575-Exiled8/Properties/AssemblyInfo.cs b/Scp575-Exiled8/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..94578e9 --- /dev/null +++ b/Scp575-Exiled8/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Scp939MaxHealth-Exiled880")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Scp939MaxHealth-Exiled880")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("0efba00c-a84f-4ca1-8714-8390e9ce993b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Scp575-Exiled8/Scp575-Exiled8.csproj b/Scp575-Exiled8/Scp575-Exiled8.csproj new file mode 100644 index 0000000..a75c9c6 --- /dev/null +++ b/Scp575-Exiled8/Scp575-Exiled8.csproj @@ -0,0 +1,64 @@ + + + + + Debug + AnyCPU + {0EFBA00C-A84F-4CA1-8714-8390E9CE993B} + Library + Properties + Scp939MaxHealth_Exiled880 + Scp575-Exiled8 + v4.8 + 512 + true + + + false + none + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll + + + + + + + + + + + ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll + + + + + + + + + + + 8.8.0 + + + + + + + \ No newline at end of file diff --git a/Scp575-Exiled8/Scp575.cs b/Scp575-Exiled8/Scp575.cs new file mode 100644 index 0000000..8b18c9a --- /dev/null +++ b/Scp575-Exiled8/Scp575.cs @@ -0,0 +1,41 @@ +using Exiled.API.Features; +using Exiled; +using Exiled.Events.EventArgs.Player; +using Scp575_Exiled8.Events; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Policy; +using System.Text; +using System.Threading.Tasks; + +namespace Scp575_Exiled8 +{ + public class Scp575 : Plugin + { + public override string Author => "6hundred9"; + public override string Name => "SCP575"; + + public override string Prefix => "575"; + + public override Version Version => new Version(2, 1, 0); + + public static Scp575 Instance { get; set; } = null; + + + + public override void OnEnabled() + { + Instance = this; + Exiled.Events.Handlers.Server.RoundStarted += ServerHandler.OnRoundStarted; + Exiled.Events.Handlers.Server.RoundEnded += ServerHandler.OnRoundEnded; + } + + public override void OnDisabled() + { + Exiled.Events.Handlers.Server.RoundStarted -= ServerHandler.OnRoundStarted; + Exiled.Events.Handlers.Server.RoundEnded -= ServerHandler.OnRoundEnded; + + } + } +}