Skip to content

Commit 91c02f6

Browse files
committed
BSOD gamemode tweaks
1 parent ce19a2c commit 91c02f6

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
- All SCPs are switched to SCP-079, everyone else is switched to Scientist
1414
- SCP-079 starts off at level 3, scientists start with nothing
1515
- Scientists need to work together to obtain keycards and access heavy containment to kill SCP-079, before 079 can kill them
16-
- Generators take 5 minutes to activate instead of the default 3 minutes
1716
- All lights on the map will turn blue
17+
- The round will end after 15 minutes if 079 isn't killed in time
1818

1919
## Night of the Living Nerd
2020
- All SCPs are switched to Scientist, everyone else is switched to Class D

RandomGamemode/EventHandlers.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class EventHandlers
4040

4141
public EventHandlers( Plugin plugin ) => this.plugin = plugin;
4242

43-
public string GetGamemodeName()
43+
private string GetGamemodeName()
4444
{
4545
switch ( CurrentGamemode )
4646
{
@@ -57,6 +57,12 @@ public string GetGamemodeName()
5757
}
5858
}
5959

60+
private IEnumerator<float> DelayedRoundEnd( float delay )
61+
{
62+
yield return Timing.WaitForSeconds( delay );
63+
Round.EndRound( true );
64+
}
65+
6066
#region Gamemodes
6167
public IEnumerator<float> DodgeBall()
6268
{
@@ -271,6 +277,10 @@ public void OnRoundStart()
271277
}
272278
Map.Broadcast( 6, "<color=red>The " + GetGamemodeName() + " round has started!</color>" );
273279
}
280+
if ( CurrentGamemode == Gamemode.BlueScreenOfDeath )
281+
{
282+
Timing.RunCoroutine( DelayedRoundEnd( 900 ), "DelayedRoundEnd" );
283+
}
274284
}
275285

276286
public void OnRoundEnding( EndingRoundEventArgs ev )
@@ -297,6 +307,7 @@ public void OnRoundEnd( RoundEndedEventArgs ev )
297307
Map.Broadcast( 6, "<color=red>The " + GetGamemodeName() + " round has ended.</color>" );
298308
CurrentGamemode = 0;
299309
ServerConsole.FriendlyFire = FriendlyFireDefault;
310+
Timing.KillCoroutines( "DelayedRoundEnd" );
300311
}
301312
}
302313

@@ -320,15 +331,6 @@ public void OnItemDropped( DroppingItemEventArgs ev )
320331
}
321332
}
322333

323-
public void OnGeneratorActivate( ActivatingGeneratorEventArgs ev )
324-
{
325-
// Set generator activation time to 5 minutes
326-
if ( CurrentGamemode == Gamemode.BlueScreenOfDeath )
327-
{
328-
ev.Generator.ActivationTime = 300;
329-
}
330-
}
331-
332334
public void OnGeneratorDeactivate( StoppingGeneratorEventArgs ev )
333335
{
334336
// Prevent generators from being deactivated once they're active

RandomGamemode/Plugin.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace RandomGamemode
99
public class Plugin : Plugin<Config>
1010
{
1111
private EventHandlers EventHandlers;
12-
public override Version Version { get; } = new Version( 2, 2, 0 );
12+
public override Version Version { get; } = new Version( 2, 3, 0 );
1313
public override Version RequiredExiledVersion { get; } = new Version( 8, 3, 0 );
1414
public override PluginPriority Priority { get; } = PluginPriority.Medium;
1515
internal static List<Gamemode> EnabledList = new List<Gamemode>();
@@ -23,7 +23,6 @@ public override void OnEnabled()
2323
events.Player.ThrownProjectile += EventHandlers.OnGrenadeThrown;
2424
events.Player.DroppingItem += EventHandlers.OnItemDropped;
2525
events.Server.EndingRound += EventHandlers.OnRoundEnding;
26-
events.Player.ActivatingGenerator += EventHandlers.OnGeneratorActivate;
2726
events.Player.StoppingGenerator += EventHandlers.OnGeneratorDeactivate;
2827
events.Server.RespawningTeam += EventHandlers.OnRespawn;
2928
events.Player.Died += EventHandlers.OnPlayerDied;
@@ -60,7 +59,6 @@ public override void OnDisabled()
6059
events.Player.ThrownProjectile -= EventHandlers.OnGrenadeThrown;
6160
events.Player.DroppingItem -= EventHandlers.OnItemDropped;
6261
events.Server.EndingRound -= EventHandlers.OnRoundEnding;
63-
events.Player.ActivatingGenerator -= EventHandlers.OnGeneratorActivate;
6462
events.Player.StoppingGenerator -= EventHandlers.OnGeneratorDeactivate;
6563
events.Server.RespawningTeam -= EventHandlers.OnRespawn;
6664
events.Player.Died -= EventHandlers.OnPlayerDied;

0 commit comments

Comments
 (0)