Skip to content

Commit 7467948

Browse files
committed
1.0.9
* Fixed a bug with SCPSLAudioApi dependencies * Added two settings to deal with SCP-173 * now you can enable or disable CASSIE announcement bells. (and other things) see configuration for more info
1 parent e2353e8 commit 7467948

File tree

4 files changed

+78
-13
lines changed

4 files changed

+78
-13
lines changed

Cerberus.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<PropertyGroup>
1818
<!-- This is the global version and is used for all projects that don't have a version -->
19-
<Version Condition="$(Version) == ''">1.0.8</Version>
19+
<Version Condition="$(Version) == ''">1.0.9</Version>
2020
<!-- Enables public beta warning via the PUBLIC_BETA constant -->
2121
<PublicBeta>false</PublicBeta>
2222

SCP575/Config.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ public class Config
2828
[Description("The per-round probability of SCP-575 appearing")]
2929
public int SpawnChance { get; set; } = 40;
3030

31+
[Description("If there is an SCP-173 in the round, SCP-575 will deactivate for that round.")]
32+
public bool DisableForScp173 { get; set; } = false;
33+
34+
[Description("An alternative to the above configuration, if there is a SCP-173 in the light contaiment zone round it will never suffer a blackout. DO NOT ACTIVATE BOTH AT THE SAME TIME")]
35+
public bool DisableBlackoutForScp173 { get; set; } = false;
36+
3137
[Description("All blackout related configuration")]
3238
public BlackoutConfig BlackOut { get; set; } = new BlackoutConfig();
3339

@@ -65,6 +71,12 @@ public class BlackoutConfig
6571
public string CassieMessage { get; set; } =
6672
"facility power system failure in 3 . pitch_.80 2 . pitch_.60 1 . pitch_.49 . .g1 pitch_.42 .g2 pitch_.31 .g5";
6773

74+
[Description("I have no idea what it does")]
75+
public bool CassieIsHold { get; set; } = false;
76+
77+
[Description("Enable o disable bells in cassie announcement")]
78+
public bool CassieIsNoise { get; set; } = true;
79+
6880
[Description(
6981
"After making Cassie's announcement the blackout will start after these seconds, perfect to turn off the lights just when the announcement ends.")]
7082
public float DelayAfterCassie { get; set; } = 8.5f;

SCP575/Resources/Extensions.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static bool IsDummy(ReferenceHub hub)
6767
/// Turns off the lights in the specified zone, for a period of time.
6868
/// </summary>
6969
/// <param name="duration">The duration in seconds of the blackout</param>
70-
public static void FlickerLights(float duration)
70+
public static void FlickerLights(float duration, bool antiScp173 = false)
7171
{
7272
var flickerControllerInstances = FlickerableLightController.Instances;
7373

@@ -84,12 +84,15 @@ public static void FlickerLights(float duration)
8484

8585
if (SCP575.Scp575.Instance.Config.ActiveInLight)
8686
{
87-
foreach (var controller in flickerControllerInstances)
87+
if (!antiScp173)
8888
{
89-
if (controller.Room.Zone != FacilityZone.LightContainment ||
90-
Scp575.Instance.Config.BlackOut.BlackListRooms.Count > 0 &&
91-
Scp575.Instance.Config.BlackOut.BlackListRooms.Contains(controller.Room.Name)) continue;
92-
controller.ServerFlickerLights(duration);
89+
foreach (var controller in flickerControllerInstances)
90+
{
91+
if (controller.Room.Zone != FacilityZone.LightContainment ||
92+
Scp575.Instance.Config.BlackOut.BlackListRooms.Count > 0 &&
93+
Scp575.Instance.Config.BlackOut.BlackListRooms.Contains(controller.Room.Name)) continue;
94+
controller.ServerFlickerLights(duration);
95+
}
9396
}
9497
}
9598

@@ -105,6 +108,11 @@ public static void FlickerLights(float duration)
105108
}
106109
}
107110

111+
/// <summary>
112+
/// Check if the current room is with the lights on.
113+
/// </summary>
114+
/// <param name="roomId"></param>
115+
/// <returns></returns>
108116
public static bool IsRoomIlluminated(RoomIdentifier roomId)
109117
{
110118
var lightController = roomId.GetComponentInChildren<FlickerableLightController>();

SCP575/Scp575.cs

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@ public class Scp575
5252
/// <summary>
5353
/// Plugin version
5454
/// </summary>
55-
private const string Version = "1.0.8";
55+
private const string Version = "1.0.9";
5656

5757
[PluginEntryPoint("SCP-575", Version, "Add SCP-575 to SCP:SL", "SrLicht")]
5858
private void OnLoadPlugin()
5959
{
6060
try
6161
{
62-
SCPSLAudioApi.Startup.SetupDependencies();
6362
Instance = this;
6463
if (!Config.IsEnabled) return;
6564
Extensions.CreateDirectory();
@@ -102,6 +101,20 @@ private void OnRoundStart()
102101
Log.Info($"SCP-575 will spawn in this round");
103102

104103
_blackoutHandler = Timing.RunCoroutine(Blackout());
104+
105+
if (Config.DisableForScp173)
106+
{
107+
Timing.CallDelayed(10, () =>
108+
{
109+
foreach (var player in Player.GetPlayers())
110+
{
111+
if (player.Role == RoleTypeId.Scp173)
112+
{
113+
Timing.KillCoroutines(_blackoutHandler);
114+
}
115+
}
116+
});
117+
}
105118
}
106119

107120
[PluginEvent(ServerEventType.WaitingForPlayers)]
@@ -134,16 +147,29 @@ private IEnumerator<float> Blackout()
134147
Config.BlackOut.MinDuration;
135148

136149
// Send Cassie's message to everyone
137-
RespawnEffectsController.PlayCassieAnnouncement(Config.BlackOut.CassieMessage, false, true);
150+
RespawnEffectsController.PlayCassieAnnouncement(Config.BlackOut.CassieMessage, Config.BlackOut.CassieIsHold, Config.BlackOut.CassieIsNoise);
138151

139152
// Wait for Cassie to finish speaking
140153
yield return Timing.WaitForSeconds(Config.BlackOut.DelayAfterCassie);
141154

142-
// Spawn SCP-575
143-
Spawn575(blackoutDuration);
155+
try
156+
{
157+
// Spawn SCP-575
158+
Spawn575(blackoutDuration);
159+
}
160+
catch (Exception e)
161+
{
162+
Log.Error($"Error on {nameof(Spawn575)}: {e}");
163+
}
164+
165+
var antiScp173 = false;
166+
if (Config.DisableBlackoutForScp173)
167+
{
168+
antiScp173 = GetScp173();
169+
}
144170

145171
// Turn off the lights in the area
146-
Extensions.FlickerLights(blackoutDuration);
172+
Extensions.FlickerLights(blackoutDuration, antiScp173);
147173

148174
// Decide the delay by calculating between the minimum and the maximum value.
149175
yield return Timing.WaitForSeconds(_rng.Next(Config.BlackOut.MinDelay, Config.BlackOut.MaxDelay) +
@@ -344,5 +370,24 @@ private void DestroyAllDummies()
344370
NetworkServer.Destroy(dummy.gameObject);
345371
}
346372
}
373+
374+
/// <summary>
375+
/// Get if in the round exist a SCP-173
376+
/// </summary>
377+
/// <returns>boolean indicating if exist a SCP-173 in the round</returns>
378+
private bool GetScp173()
379+
{
380+
var value = false;
381+
382+
foreach (var player in Player.GetPlayers())
383+
{
384+
if (player.Role == RoleTypeId.Scp173)
385+
{
386+
value = true;
387+
}
388+
}
389+
390+
return value;
391+
}
347392
}
348393
}

0 commit comments

Comments
 (0)