From cd365dd718a2338d098c084b02e63657fc8a121e Mon Sep 17 00:00:00 2001 From: SebasCapo Date: Thu, 24 Dec 2020 17:27:17 -0300 Subject: [PATCH] Bump --- .gitignore | 2 + LightsPlugin/LightsPlugin/EventHandlers.cs | 34 +++++++----- LightsPlugin/LightsPlugin/Lights.csproj | 36 +++++++------ LightsPlugin/LightsPlugin/LightsConfig.cs | 63 ++++++++++++++++------ 4 files changed, 89 insertions(+), 46 deletions(-) diff --git a/.gitignore b/.gitignore index e12c6e3..4bd0c8d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ /LightsPlugin/packages/EXILED.2.1.6 /LightsPlugin/LightsPlugin/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache /LightsPlugin/LightsPlugin/obj/Release/Lights.csprojAssemblyReference.cache +/LightsPlugin/packages/EXILED.2.1.19 +/LightsPlugin/LightsPlugin/obj/Release diff --git a/LightsPlugin/LightsPlugin/EventHandlers.cs b/LightsPlugin/LightsPlugin/EventHandlers.cs index 6ce3d66..2ac2a9e 100644 --- a/LightsPlugin/LightsPlugin/EventHandlers.cs +++ b/LightsPlugin/LightsPlugin/EventHandlers.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Exiled.API.Enums; using Exiled.API.Features; using Exiled.Events.EventArgs; using Exiled.Permissions.Extensions; @@ -87,25 +88,25 @@ public void OnCommand( SendingRemoteAdminCommandEventArgs ev ) { #endregion public IEnumerator MultipleBlackouts() { - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(Config.startTimerMin, Config.startTimerMax)); + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(Config.StartTimerMin, Config.StartTimerMax)); while(Config.doMultipleBlackouts && Round.IsStarted) { - float duration = UnityEngine.Random.Range(Config.blackoutDurationMin, Config.blackoutDurationMax); - bool HczOnly = UnityEngine.Random.Range(1, 101) <= Config.hczOnlyChance; + float duration = UnityEngine.Random.Range(Config.BlackoutDurationMin, Config.BlackoutDurationMax); + bool HczOnly = UnityEngine.Random.Range(1, 101) <= Config.HczOnlyChance; TurnOffLights(duration, HczOnly); - float timeBetween = Config.addDuration ? UnityEngine.Random.Range(Config.timeBetweenMin, Config.timeBetweenMax) + duration : UnityEngine.Random.Range(Config.timeBetweenMin, Config.timeBetweenMax); + float timeBetween = Config.AddDuration ? UnityEngine.Random.Range(Config.TimeBetweenMin, Config.TimeBetweenMax) + duration : UnityEngine.Random.Range(Config.TimeBetweenMin, Config.TimeBetweenMax); yield return Timing.WaitForSeconds(timeBetween); } } public IEnumerator SingleBlackout() { - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(Config.startTimerMin, Config.startTimerMax)); - float duration = UnityEngine.Random.Range(Config.blackoutDurationMin, Config.blackoutDurationMax); - bool HczOnly = UnityEngine.Random.Range(1, 101) <= Config.hczOnlyChance; + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(Config.StartTimerMin, Config.StartTimerMax)); + float duration = UnityEngine.Random.Range(Config.BlackoutDurationMin, Config.BlackoutDurationMax); + bool HczOnly = UnityEngine.Random.Range(1, 101) <= Config.HczOnlyChance; TurnOffLights(duration, HczOnly); } - public void TurnOffLights(float duration, bool HczOnly) { + public void TurnOffLights(float duration, bool hczOnly) { if(plugin.Config.DisableTeslas) { Timing.KillCoroutines(lightsBack); @@ -136,19 +137,28 @@ public void TurnOffLights(float duration, bool HczOnly) { } if(Config.DoBroadcastMessage) { - ushort dur = HczOnly ? Config.broadcastMessageHczOnlyDuration : Config.broadcastMessageBothDuration; - string msg = HczOnly ? Config.broadcastMessageHczOnly.Replace("%ss", $"{duration}") : Config.broadcastMessageBoth.Replace("%ss", $"{duration}"); + ushort dur = hczOnly ? Config.BroadcastMessageHczOnlyDuration : Config.BroadcastMessageBothDuration; + string msg = hczOnly ? Config.BroadcastMessageHczOnly.Replace("%ss", $"{duration}") : Config.BroadcastMessageBoth.Replace("%ss", $"{duration}"); if(Config.ClearBroadcasts) Map.ClearBroadcasts(); Map.Broadcast(dur, msg); } if(Config.DoCassieMessages) { - string msg = HczOnly ? Config.cassieMessageHczOnly.Replace("%ss", $"{duration}") : Config.cassieMessageBoth.Replace("%ss", $"{duration}"); + string msg = hczOnly ? Config.CassieMessageHczOnly.Replace("%ss", $"{duration}") : Config.CassieMessageBoth.Replace("%ss", $"{duration}"); Cassie.Message(msg, Config.MakeHold, Config.MakeNoise); } - Map.TurnOffAllLights(duration, HczOnly); + + + foreach(Room r in Map.Rooms) { + if(hczOnly && r.Zone == ZoneType.HeavyContainment) + r.TurnOffLights(duration); + } + } + + private bool ToggleLights(float duration, bool hczOnly) { + } } } \ No newline at end of file diff --git a/LightsPlugin/LightsPlugin/Lights.csproj b/LightsPlugin/LightsPlugin/Lights.csproj index 5b2a87d..01fb2bf 100644 --- a/LightsPlugin/LightsPlugin/Lights.csproj +++ b/LightsPlugin/LightsPlugin/Lights.csproj @@ -33,34 +33,36 @@ - ..\..\..\..\..\..\AppData\Roaming\EXILED-PTB\Plugins\dependencies\0Harmony.dll + ..\..\..\..\..\..\AppData\Roaming\EXILED\Plugins\dependencies\0Harmony.dll - - ..\..\..\..\..\References\Assembly-CSharp-firstpass.dll + + False + ..\..\..\..\..\..\Desktop\2020\Servidores\SCP 2.0\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll - - ..\..\..\..\..\References\Publicizer\Assembly-CSharp_public.dll + + False + ..\..\..\..\..\References\Assembly-CSharp-Publicized.dll ..\..\..\..\..\..\Desktop\2020\Servidores\SCP 2.0\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\CommandSystem.Core.dll - - ..\packages\EXILED.2.1.6\lib\net472\Exiled.API.dll + + ..\packages\EXILED.2.1.19\lib\net472\Exiled.API.dll - - ..\packages\EXILED.2.1.6\lib\net472\Exiled.Bootstrap.dll + + ..\packages\EXILED.2.1.19\lib\net472\Exiled.Bootstrap.dll - - ..\packages\EXILED.2.1.6\lib\net472\Exiled.Events.dll + + ..\packages\EXILED.2.1.19\lib\net472\Exiled.Events.dll - - ..\packages\EXILED.2.1.6\lib\net472\Exiled.Loader.dll + + ..\packages\EXILED.2.1.19\lib\net472\Exiled.Loader.dll - - ..\packages\EXILED.2.1.6\lib\net472\Exiled.Permissions.dll + + ..\packages\EXILED.2.1.19\lib\net472\Exiled.Permissions.dll - - ..\packages\EXILED.2.1.6\lib\net472\Exiled.Updater.dll + + ..\packages\EXILED.2.1.19\lib\net472\Exiled.Updater.dll ..\..\..\..\..\..\Desktop\2020\Servidores\SCP\SCPSL_Data\Managed\Mirror.dll diff --git a/LightsPlugin/LightsPlugin/LightsConfig.cs b/LightsPlugin/LightsPlugin/LightsConfig.cs index 21ae8b6..8a8b54f 100644 --- a/LightsPlugin/LightsPlugin/LightsConfig.cs +++ b/LightsPlugin/LightsPlugin/LightsConfig.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using Exiled.API.Enums; using Exiled.API.Interfaces; namespace Lights { @@ -41,25 +42,57 @@ public class LightsConfig : IConfig { }; [Description("How many seconds should this wait before shutting off the lights for the first time.")] - public float startTimerMin { get; set; } = 30f; - public float startTimerMax { get; set; } = 45f; + public float StartTimerMin { get; set; } = 30f; + public float StartTimerMax { get; set; } = 45f; [Description("Should the lights be turned off automatically repeatedly after the first one.")] public bool doMultipleBlackouts { get; set; } = true; [Description("How many seconds should this wait between each \"blackout\".")] - public float timeBetweenMin { get; set; } = 45f; - public float timeBetweenMax { get; set; } = 60f; + public float TimeBetweenMin { get; set; } = 45f; + public float TimeBetweenMax { get; set; } = 60f; [Description("For how long will the lights be turned off?")] - public float blackoutDurationMin { get; set; } = 15f; - public float blackoutDurationMax { get; set; } = 20f; + public float BlackoutDurationMin { get; set; } = 15f; + public float BlackoutDurationMax { get; set; } = 20f; [Description("Should the blackout duration be added to the delay between each automatic blackout?")] - public bool addDuration { get; set; } = true; + public bool AddDuration { get; set; } = true; - [Description("Chance for the automatic blackout to happen in Heavy Containment Only.")] - public int hczOnlyChance { get; set; } = 50; + [Description("Should teslas be disabled during a blackout.")] + public float LightIntensity { get; set; } = 1; + + [Description("Chance for the automatic blackout to happen on each zone. (Set to 0 to disable)")] + public Dictionary ZoneChance { get; set; } = new Dictionary() { + { + ZoneType.Entrance, 25 + }, + { + ZoneType.HeavyContainment, 25 + }, + { + ZoneType.LightContainment, 25 + }, + { + ZoneType.Surface, 25 + } + }; + + [Description("Broadcast displayed when lights are turned off on specified zone. (Leave empty to disable)")] + public Dictionary ZoneBroadcast { get; set; } = new Dictionary() { + { + ZoneType.Entrance, 25 + }, + { + ZoneType.HeavyContainment, 25 + }, + { + ZoneType.LightContainment, 25 + }, + { + ZoneType.Surface, 25 + } + }; #region Broadcasts [Description("Should a broadcast be shown when the lights are turned off?")] @@ -67,13 +100,9 @@ public class LightsConfig : IConfig { [Description("Should Broadcasts be cleared when this one's shown.")] public bool ClearBroadcasts { get; set; } = true; - [Description("This is the broadcast shown when the lights are turned off in Heavy Containment Zone only. (%ss = blackout duration)")] - public string broadcastMessageHczOnly { get; set; } = "Lights have been turned off for %ss! SpooOOOOoooky!"; - public ushort broadcastMessageHczOnlyDuration { get; set; } = 5; - [Description("This is the broadcast shown when the lights are turned off in the entire facility. (%ss = blackout duration)")] - public string broadcastMessageBoth { get; set; } = "Lights have been turned off for %ss! SpooOOOOoooky!"; - public ushort broadcastMessageBothDuration { get; set; } = 5; + public string BroadcastMessageBoth { get; set; } = "Lights have been turned off for %ss! SpooOOOOoooky!"; + public ushort BroadcastMessageBothDuration { get; set; } = 5; #endregion #region Cassie @@ -84,9 +113,9 @@ public class LightsConfig : IConfig { public bool MakeNoise { get; set; } = false; [Description("This is what Cassie says if the lights are turned off in Heavy Containment Zone only. (%ss = blackout duration)")] - public string cassieMessageHczOnly { get; set; } = "heavy containment zone generator .g3 malfunction detected .g4 .g3 .g3 .g4"; + public string CassieMessageHczOnly { get; set; } = "heavy containment zone generator .g3 malfunction detected .g4 .g3 .g3 .g4"; [Description("This is what Cassie says if the lights are turned off in the entire facility. (%ss = blackout duration)")] - public string cassieMessageBoth { get; set; } = "generator .g3 malfunction detected .g4 .g3 .g3 .g4"; + public string CassieMessageBoth { get; set; } = "generator .g3 malfunction detected .g4 .g3 .g3 .g4"; #endregion }