Skip to content

Commit 1daa7f8

Browse files
committed
1.0.8
* The initial delay can now be random (by default it is deactivated so as not to break the configuration of the servers, you can activate it from the configuration). * You can now change SCP-575's RoleType from the config.
1 parent 4bdb6c3 commit 1daa7f8

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
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.7</Version>
19+
<Version Condition="$(Version) == ''">1.0.8</Version>
2020
<!-- Enables public beta warning via the PUBLIC_BETA constant -->
2121
<PublicBeta>false</PublicBeta>
2222

SCP575/Config.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Collections.Generic;
22
using System.ComponentModel;
33
using MapGeneration;
4+
using PlayerRoles;
45

56
namespace SCP575
67
{
@@ -38,6 +39,15 @@ public class BlackoutConfig
3839
{
3940
[Description("After this time, the constant blackouts will begin to be executed.")]
4041
public float InitialDelay { get; set; } = 300f;
42+
43+
[Description("If this value is true initial_delay will be ignored and a calculation will be made between initial_max_delay and initial_min_delay which will result in the delay")]
44+
public bool RandomInitialDelay { get; set; } = false;
45+
46+
[Description("The maximum time that the main delay can have")]
47+
public float InitialMaxDelay { get; set; } = 250f;
48+
49+
[Description("The minimun time that the main delay can have")]
50+
public float InitialMinDelay { get; set; } = 190f;
4151

4252
[Description("The minimum duration of a blackout")]
4353
public float MinDuration { get; set; } = 30f;
@@ -83,6 +93,9 @@ public class Scp575Config
8393
[Description("The distance at which players can see the name of the SCP-575 | The game default value is 10")]
8494
public int ViewRange { get; set; } = 12;
8595

96+
[Description("Set the SCP-575 role, by default is SCP-106")]
97+
public RoleTypeId RoleType { get; set; } = RoleTypeId.Scp106;
98+
8699
[Description("The death message that will appear when players are killed by SCP-575")]
87100
public string KillFeed { get; set; } = "Devoured by SCP-575";
88101

SCP575/Scp575.cs

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

5757
[PluginEntryPoint("SCP-575", Version, "Add SCP-575 to SCP:SL", "SrLicht")]
5858
private void OnLoadPlugin()
@@ -117,16 +117,25 @@ private void OnWaitingForPlayers()
117117
/// <returns></returns>
118118
private IEnumerator<float> Blackout()
119119
{
120-
yield return Timing.WaitForSeconds(Config.BlackOut.InitialDelay);
120+
if (Config.BlackOut.RandomInitialDelay)
121+
{
122+
yield return Timing.WaitForSeconds(_rng.Next((int)Config.BlackOut.InitialMinDelay, (int)Config.BlackOut.InitialMaxDelay));
123+
}
124+
else
125+
{
126+
yield return Timing.WaitForSeconds(Config.BlackOut.InitialDelay);
127+
}
121128

122129
while (Round.IsRoundStarted)
123130
{
124131
// Obtains the blackout duration by calculating between the minimum and maximum duration.
125132
var blackoutDuration =
126133
(float)_rng.NextDouble() * (Config.BlackOut.MaxDuration - Config.BlackOut.MinDuration) +
127134
Config.BlackOut.MinDuration;
135+
128136
// Send Cassie's message to everyone
129137
RespawnEffectsController.PlayCassieAnnouncement(Config.BlackOut.CassieMessage, false, true);
138+
130139
// Wait for Cassie to finish speaking
131140
yield return Timing.WaitForSeconds(Config.BlackOut.DelayAfterCassie);
132141

@@ -194,8 +203,17 @@ private void Spawn575(float duration)
194203
// ignored
195204
}
196205

197-
Log.Debug("Changing role of dummy to SCP-106", Config.Debug);
198-
hubPlayer.roleManager.ServerSetRole(RoleTypeId.Scp106, RoleChangeReason.RemoteAdmin);
206+
Log.Debug($"Changing role of dummy to {Config.Scp575.RoleType}", Config.Debug);
207+
208+
try
209+
{
210+
hubPlayer.roleManager.ServerSetRole(Config.Scp575.RoleType, RoleChangeReason.RemoteAdmin);
211+
}
212+
catch (Exception e)
213+
{
214+
Log.Error($"Error on {nameof(Spawn575)}: Error on set dummy role {e}");
215+
}
216+
199217
hubPlayer.characterClassManager.GodMode = true;
200218

201219
Timing.CallDelayed(0.3f, () =>

0 commit comments

Comments
 (0)