Skip to content

Commit

Permalink
Bump
Browse files Browse the repository at this point in the history
  • Loading branch information
SebasCapo committed Dec 24, 2020
1 parent cbe708e commit cd365dd
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
34 changes: 22 additions & 12 deletions LightsPlugin/LightsPlugin/EventHandlers.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -87,25 +88,25 @@ public void OnCommand( SendingRemoteAdminCommandEventArgs ev ) {
#endregion

public IEnumerator<float> 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<float> 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);

Expand Down Expand Up @@ -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) {

}
}
}
36 changes: 19 additions & 17 deletions LightsPlugin/LightsPlugin/Lights.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,36 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\..\..\..\AppData\Roaming\EXILED-PTB\Plugins\dependencies\0Harmony.dll</HintPath>
<HintPath>..\..\..\..\..\..\AppData\Roaming\EXILED\Plugins\dependencies\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\References\Assembly-CSharp-firstpass.dll</HintPath>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Desktop\2020\Servidores\SCP 2.0\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp_public">
<HintPath>..\..\..\..\..\References\Publicizer\Assembly-CSharp_public.dll</HintPath>
<Reference Include="Assembly-CSharp-Publicized, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\References\Assembly-CSharp-Publicized.dll</HintPath>
</Reference>
<Reference Include="CommandSystem.Core">
<HintPath>..\..\..\..\..\..\Desktop\2020\Servidores\SCP 2.0\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\CommandSystem.Core.dll</HintPath>
</Reference>
<Reference Include="Exiled.API, Version=2.1.6.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.1.6\lib\net472\Exiled.API.dll</HintPath>
<Reference Include="Exiled.API, Version=2.1.19.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.1.19\lib\net472\Exiled.API.dll</HintPath>
</Reference>
<Reference Include="Exiled.Bootstrap, Version=2.1.6.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.1.6\lib\net472\Exiled.Bootstrap.dll</HintPath>
<Reference Include="Exiled.Bootstrap, Version=2.1.19.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.1.19\lib\net472\Exiled.Bootstrap.dll</HintPath>
</Reference>
<Reference Include="Exiled.Events, Version=2.1.6.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.1.6\lib\net472\Exiled.Events.dll</HintPath>
<Reference Include="Exiled.Events, Version=2.1.19.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.1.19\lib\net472\Exiled.Events.dll</HintPath>
</Reference>
<Reference Include="Exiled.Loader, Version=2.1.6.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.1.6\lib\net472\Exiled.Loader.dll</HintPath>
<Reference Include="Exiled.Loader, Version=2.1.19.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.1.19\lib\net472\Exiled.Loader.dll</HintPath>
</Reference>
<Reference Include="Exiled.Permissions, Version=2.1.6.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.1.6\lib\net472\Exiled.Permissions.dll</HintPath>
<Reference Include="Exiled.Permissions, Version=2.1.19.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.1.19\lib\net472\Exiled.Permissions.dll</HintPath>
</Reference>
<Reference Include="Exiled.Updater, Version=3.0.2.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.1.6\lib\net472\Exiled.Updater.dll</HintPath>
<Reference Include="Exiled.Updater, Version=3.0.3.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.1.19\lib\net472\Exiled.Updater.dll</HintPath>
</Reference>
<Reference Include="Mirror">
<HintPath>..\..\..\..\..\..\Desktop\2020\Servidores\SCP\SCPSL_Data\Managed\Mirror.dll</HintPath>
Expand Down
63 changes: 46 additions & 17 deletions LightsPlugin/LightsPlugin/LightsConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Exiled.API.Enums;
using Exiled.API.Interfaces;

namespace Lights {
Expand Down Expand Up @@ -41,39 +42,67 @@ 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<ZoneType, int> ZoneChance { get; set; } = new Dictionary<ZoneType, int>() {
{
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<ZoneType, int> ZoneBroadcast { get; set; } = new Dictionary<ZoneType, int>() {
{
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?")]
public bool DoBroadcastMessage { get; set; } = false;
[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; } = "<color=aqua>Lights have been turned off for %ss! SpooOOOOoooky!</color>";
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; } = "<color=aqua>Lights have been turned off for %ss! SpooOOOOoooky!</color>";
public ushort broadcastMessageBothDuration { get; set; } = 5;
public string BroadcastMessageBoth { get; set; } = "<color=aqua>Lights have been turned off for %ss! SpooOOOOoooky!</color>";
public ushort BroadcastMessageBothDuration { get; set; } = 5;
#endregion

#region Cassie
Expand All @@ -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

}
Expand Down

0 comments on commit cd365dd

Please sign in to comment.