idk man
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using CustomPlayerEffects;
|
||||
using Interactables.Interobjects.DoorUtils;
|
||||
using InventorySystem.Items;
|
||||
using InventorySystem.Items.Firearms.Modules;
|
||||
@@ -61,6 +63,11 @@ public sealed class CustomClasses : Plugin
|
||||
/// </summary>
|
||||
public GamblerConfig GamblerConfig { get; private set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Configuration for the ShadowStepper class.
|
||||
/// </summary>
|
||||
public ShadowStepperConfig ShadowStepperConfig { get; private set; } = new();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Enable()
|
||||
{
|
||||
@@ -68,6 +75,12 @@ public sealed class CustomClasses : Plugin
|
||||
ServerEvents.RoundEnded += OnRoundEnded;
|
||||
Scp914Events.ProcessingPickup += OnScp914ProcessingPickup;
|
||||
Scp914Events.ProcessingInventoryItem += OnScp914ProcessingInventoryItem;
|
||||
PlayerEvents.Escaped += OnEscaped;
|
||||
}
|
||||
|
||||
private void OnEscaped(PlayerEscapedEventArgs ev)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -77,6 +90,7 @@ public sealed class CustomClasses : Plugin
|
||||
ServerEvents.RoundEnded -= OnRoundEnded;
|
||||
Scp914Events.ProcessingPickup -= OnScp914ProcessingPickup;
|
||||
Scp914Events.ProcessingInventoryItem -= OnScp914ProcessingInventoryItem;
|
||||
PlayerEvents.Escaped -= OnEscaped;
|
||||
}
|
||||
|
||||
private void OnRoundEnded(RoundEndedEventArgs ev)
|
||||
@@ -84,6 +98,7 @@ public sealed class CustomClasses : Plugin
|
||||
_classManager.ResetSpawnStates();
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "RedundantJumpStatement")]
|
||||
private void OnPlayerSpawned(PlayerSpawnedEventArgs ev)
|
||||
{
|
||||
if (_classManager.TryHandleSpawn(ev.Player, JanitorConfig, typeof(JanitorConfig))) return;
|
||||
@@ -91,6 +106,7 @@ public sealed class CustomClasses : Plugin
|
||||
if (_classManager.TryHandleSpawn(ev.Player, HeadGuardConfig, typeof(HeadGuardConfig))) return;
|
||||
if (_classManager.TryHandleSpawn(ev.Player, MedicConfig, typeof(MedicConfig))) return;
|
||||
if (_classManager.TryHandleSpawn(ev.Player, GamblerConfig, typeof(GamblerConfig))) return;
|
||||
if (_classManager.TryHandleSpawn(ev.Player, ShadowStepperConfig, typeof(ShadowStepperConfig))) return;
|
||||
}
|
||||
|
||||
private static void OnScp914ProcessingPickup(Scp914ProcessingPickupEventArgs ev)
|
||||
@@ -133,6 +149,7 @@ public class CustomClassManager
|
||||
RegisterHandler<HeadGuardConfig>(new HeadGuardHandler());
|
||||
RegisterHandler<MedicConfig>(new MedicHandler());
|
||||
RegisterHandler<GamblerConfig>(new GamblerHandler());
|
||||
RegisterHandler<ShadowStepperConfig>(new ShadowStepperHandler());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -219,14 +236,26 @@ public interface ICustomClassHandler
|
||||
/// <param name="config">The configuration for the custom class.</param>
|
||||
/// <param name="random">A random number generator.</param>
|
||||
void HandleSpawn(Player player, CustomClassConfig config, Random random);
|
||||
|
||||
void HandleEscape(Player player, CustomClassConfig config);
|
||||
}
|
||||
|
||||
public abstract class CustomClassHandler: ICustomClassHandler
|
||||
{
|
||||
public abstract void HandleSpawn(Player player, CustomClassConfig config, Random random);
|
||||
|
||||
public virtual void HandleEscape(Player player, CustomClassConfig config)
|
||||
{
|
||||
//Intentionally left blank
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for the Janitor custom class.
|
||||
/// </summary>
|
||||
public class JanitorHandler(CustomClassManager manager) : ICustomClassHandler
|
||||
public class JanitorHandler(CustomClassManager manager) : CustomClassHandler
|
||||
{
|
||||
public void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||
{
|
||||
var scp914 = Map.Rooms.FirstOrDefault(r => r.Name == RoomName.Lcz914);
|
||||
if (scp914 == null)
|
||||
@@ -247,9 +276,9 @@ public class JanitorHandler(CustomClassManager manager) : ICustomClassHandler
|
||||
/// <summary>
|
||||
/// Handler for the Research Subject custom class.
|
||||
/// </summary>
|
||||
public class ResearchSubjectHandler(CustomClassManager manager) : ICustomClassHandler
|
||||
public class ResearchSubjectHandler(CustomClassManager manager) : CustomClassHandler
|
||||
{
|
||||
public void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||
{
|
||||
var scientist = Player.ReadyList.FirstOrDefault(p => p.Role == RoleTypeId.Scientist);
|
||||
if (scientist == null)
|
||||
@@ -270,9 +299,9 @@ public class ResearchSubjectHandler(CustomClassManager manager) : ICustomClassHa
|
||||
/// <summary>
|
||||
/// Handler for the Head Guard custom class.
|
||||
/// </summary>
|
||||
public class HeadGuardHandler : ICustomClassHandler
|
||||
public class HeadGuardHandler : CustomClassHandler
|
||||
{
|
||||
public void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||
{
|
||||
player.RemoveItem(ItemType.KeycardGuard);
|
||||
KeycardItem.CreateCustomKeycardTaskForce(player, "Head Guard Keycard", $"HG. {player.Nickname}", new KeycardLevels(1, 1, 2), Color.blue, Color.cyan, "1", 0);
|
||||
@@ -305,9 +334,9 @@ public class HeadGuardHandler : ICustomClassHandler
|
||||
/// <summary>
|
||||
/// Handler for the Medic custom class.
|
||||
/// </summary>
|
||||
public class MedicHandler : ICustomClassHandler
|
||||
public class MedicHandler : CustomClassHandler
|
||||
{
|
||||
public void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||
{
|
||||
foreach (var spawnItem in config.Items)
|
||||
{
|
||||
@@ -318,12 +347,38 @@ public class MedicHandler : ICustomClassHandler
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handler for ShadowStepper custom class.
|
||||
/// </summary>
|
||||
public class ShadowStepperHandler : CustomClassHandler
|
||||
{
|
||||
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||
{
|
||||
ApplyEffects(player);
|
||||
|
||||
player.SendBroadcast("You're a <color=#000000>ShadowStepper</color>!", 3);
|
||||
}
|
||||
|
||||
public override void HandleEscape(Player player, CustomClassConfig config)
|
||||
{
|
||||
base.HandleEscape(player, config);
|
||||
|
||||
ApplyEffects(player);
|
||||
}
|
||||
|
||||
private static void ApplyEffects(Player player)
|
||||
{
|
||||
player.ReferenceHub.playerEffectsController.ChangeState<SilentWalk>(100,float.MaxValue);
|
||||
player.ReferenceHub.playerEffectsController.ChangeState<Slowness>(20,float.MaxValue);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base handler for simple item-giving custom classes.
|
||||
/// </summary>
|
||||
public abstract class SimpleAddItemHandler : ICustomClassHandler
|
||||
public abstract class SimpleAddItemHandler : CustomClassHandler
|
||||
{
|
||||
public virtual void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||
public override void HandleSpawn(Player player, CustomClassConfig config, Random random)
|
||||
{
|
||||
foreach (var spawnItem in config.Items)
|
||||
{
|
||||
@@ -375,7 +430,7 @@ public abstract class CustomClassConfig
|
||||
/// <summary>
|
||||
/// Configuration for the Research Subject class.
|
||||
/// </summary>
|
||||
public sealed class ResearchSubjectConfig : CustomClassConfig { }
|
||||
public sealed class ResearchSubjectConfig : CustomClassConfig;
|
||||
|
||||
/// <summary>
|
||||
/// Configuration for the Janitor class.
|
||||
@@ -419,6 +474,14 @@ public sealed class GamblerConfig : CustomClassConfig
|
||||
public override ItemType[] Items { get; set; } = [ItemType.Coin, ItemType.Coin];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configuration for the Shadow Stepper class.
|
||||
/// </summary>
|
||||
public sealed class ShadowStepperConfig : CustomClassConfig
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tracks the spawn state for a custom class.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user