Skip to content

Commit

Permalink
Add 3114
Browse files Browse the repository at this point in the history
  • Loading branch information
Thundermaker300 committed Nov 13, 2023
1 parent 3aff9bf commit 8e46083
Show file tree
Hide file tree
Showing 11 changed files with 516 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Exiled.API/Extensions/RoleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static class RoleExtensions
RoleTypeId.ChaosConscript or RoleTypeId.ChaosMarauder or RoleTypeId.ChaosRepressor or RoleTypeId.ChaosRifleman => Team.ChaosInsurgency,
RoleTypeId.Scientist => Team.Scientists,
RoleTypeId.ClassD => Team.ClassD,
RoleTypeId.Scp049 or RoleTypeId.Scp939 or RoleTypeId.Scp0492 or RoleTypeId.Scp079 or RoleTypeId.Scp096 or RoleTypeId.Scp106 or RoleTypeId.Scp173 => Team.SCPs,
RoleTypeId.Scp049 or RoleTypeId.Scp939 or RoleTypeId.Scp0492 or RoleTypeId.Scp079 or RoleTypeId.Scp096 or RoleTypeId.Scp106 or RoleTypeId.Scp173 or RoleTypeId.Scp3114 => Team.SCPs,
RoleTypeId.FacilityGuard or RoleTypeId.NtfCaptain or RoleTypeId.NtfPrivate or RoleTypeId.NtfSergeant or RoleTypeId.NtfSpecialist => Team.FoundationForces,
RoleTypeId.Tutorial => Team.OtherAlive,
_ => Team.Dead,
Expand Down
22 changes: 22 additions & 0 deletions Exiled.Events/EventArgs/Interfaces/IScp3114Event.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// -----------------------------------------------------------------------
// <copyright file="IScp3114Event.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.EventArgs.Interfaces
{
using Exiled.API.Features.Roles;

/// <summary>
/// Event args used for all <see cref="Scp3114Role" /> related events.
/// </summary>
public interface IScp3114Event : IPlayerEvent
{
/// <summary>
/// Gets the <see cref="Scp3114Role" /> triggering the event.
/// </summary>
public Scp3114Role Scp3114 { get; }
}
}
46 changes: 46 additions & 0 deletions Exiled.Events/EventArgs/Scp3114/DisguisedEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// -----------------------------------------------------------------------
// <copyright file="DisguisedEventArgs.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.EventArgs.Scp3114
{
using API.Features;
using Exiled.API.Features.Roles;
using Interfaces;

using PlayerRoles.Ragdolls;

/// <summary>
/// Contains all information before SCP-3114 changes its target focus.
/// </summary>
public class DisguisedEventArgs : IScp3114Event, IRagdollEvent
{
/// <summary>
/// Initializes a new instance of the <see cref="DisguisedEventArgs" /> class.
/// </summary>
/// <param name="player">
/// <inheritdoc cref="Player" />
/// </param>
/// <param name="ragdoll">
/// <inheritdoc cref="Ragdoll" />
/// </param>
public DisguisedEventArgs(ReferenceHub player, DynamicRagdoll ragdoll)
{
Player = Player.Get(player);
Scp3114 = Player.Role.As<Scp3114Role>();
Ragdoll = Ragdoll.Get(ragdoll);
}

/// <inheritdoc/>
public Player Player { get; }

/// <inheritdoc/>
public Scp3114Role Scp3114 { get; }

/// <inheritdoc/>
public Ragdoll Ragdoll { get; }
}
}
49 changes: 49 additions & 0 deletions Exiled.Events/EventArgs/Scp3114/DisguisingEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// -----------------------------------------------------------------------
// <copyright file="DisguisingEventArgs.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.EventArgs.Scp3114
{
using API.Features;
using Exiled.API.Features.Roles;
using Interfaces;

using PlayerRoles.Ragdolls;

/// <summary>
/// Contains all information before SCP-3114 it's diguised to a new role.
/// </summary>
public class DisguisingEventArgs : IScp3114Event, IDeniableEvent, IRagdollEvent
{
/// <summary>
/// Initializes a new instance of the <see cref="DisguisingEventArgs" /> class.
/// </summary>
/// <param name="player">
/// <inheritdoc cref="Player" />
/// </param>
/// <param name="ragdoll">
/// <inheritdoc cref="Ragdoll" />
/// </param>
public DisguisingEventArgs(ReferenceHub player, DynamicRagdoll ragdoll)
{
Player = Player.Get(player);
Scp3114 = Player.Role.As<Scp3114Role>();
Ragdoll = Ragdoll.Get(ragdoll);
}

/// <inheritdoc/>
public bool IsAllowed { get; set; } = true;

/// <inheritdoc/>
public Player Player { get; }

/// <inheritdoc/>
public Scp3114Role Scp3114 { get; }

/// <inheritdoc/>
public Ragdoll Ragdoll { get; }
}
}
37 changes: 37 additions & 0 deletions Exiled.Events/EventArgs/Scp3114/RevealedEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// -----------------------------------------------------------------------
// <copyright file="RevealedEventArgs.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.EventArgs.Scp3114
{
using API.Features;
using Exiled.API.Features.Roles;
using Interfaces;

/// <summary>
/// Contains all information before SCP-3114 changes its target focus.
/// </summary>
public class RevealedEventArgs : IScp3114Event
{
/// <summary>
/// Initializes a new instance of the <see cref="RevealedEventArgs" /> class.
/// </summary>
/// <param name="player">
/// <inheritdoc cref="Player" />
/// </param>
public RevealedEventArgs(ReferenceHub player)
{
Player = Player.Get(player);
Scp3114 = Player.Role.As<Scp3114Role>();
}

/// <inheritdoc/>
public Player Player { get; }

/// <inheritdoc/>
public Scp3114Role Scp3114 { get; }
}
}
44 changes: 44 additions & 0 deletions Exiled.Events/EventArgs/Scp3114/RevealingEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// -----------------------------------------------------------------------
// <copyright file="RevealingEventArgs.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.EventArgs.Scp3114
{
using API.Features;
using Exiled.API.Features.Roles;
using Interfaces;

/// <summary>
/// Contains all information before SCP-3114 changes its target focus.
/// </summary>
public class RevealingEventArgs : IScp3114Event, IDeniableEvent
{
/// <summary>
/// Initializes a new instance of the <see cref="RevealingEventArgs" /> class.
/// </summary>
/// <param name="player">
/// <inheritdoc cref="Player" />
/// </param>
/// <param name="isAllowed">
/// <inheritdoc cref="IsAllowed" />
/// </param>
public RevealingEventArgs(ReferenceHub player, bool isAllowed = true)
{
Player = Player.Get(player);
Scp3114 = Player.Role.As<Scp3114Role>();
IsAllowed = isAllowed;
}

/// <inheritdoc/>
public bool IsAllowed { get; set; }

/// <inheritdoc/>
public Player Player { get; }

/// <inheritdoc/>
public Scp3114Role Scp3114 { get; }
}
}
52 changes: 52 additions & 0 deletions Exiled.Events/EventArgs/Scp3114/TryUseBodyEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// -----------------------------------------------------------------------
// <copyright file="TryUseBodyEventArgs.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.EventArgs.Scp3114
{
using API.Features;
using Exiled.API.Features.Roles;
using Interfaces;
using PlayerRoles.Ragdolls;

/// <summary>
/// Contains all information before SCP-3114 changes its target focus.
/// </summary>
public class TryUseBodyEventArgs : IScp3114Event, IDeniableEvent, IRagdollEvent
{
/// <summary>
/// Initializes a new instance of the <see cref="TryUseBodyEventArgs" /> class.
/// </summary>
/// <param name="player">
/// <inheritdoc cref="Player" />
/// </param>
/// <param name="ragdoll">
/// <inheritdoc cref="Ragdoll" />
/// </param>
/// <param name="isAllowed">
/// <inheritdoc cref="IsAllowed" />
/// </param>
public TryUseBodyEventArgs(ReferenceHub player, BasicRagdoll ragdoll, bool isAllowed = true)
{
Player = Player.Get(player);
Scp3114 = Player.Role.As<Scp3114Role>();
Ragdoll = Ragdoll.Get(ragdoll);
IsAllowed = isAllowed;
}

/// <inheritdoc/>
public bool IsAllowed { get; set; }

/// <inheritdoc/>
public Player Player { get; }

/// <inheritdoc/>
public Ragdoll Ragdoll { get; }

/// <inheritdoc/>
public Scp3114Role Scp3114 { get; }
}
}
76 changes: 76 additions & 0 deletions Exiled.Events/Handlers/Scp3114.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// -----------------------------------------------------------------------
// <copyright file="Scp3114.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.Handlers
{
#pragma warning disable SA1623 // Property summary documentation should match accessors

using Exiled.Events.EventArgs.Scp244;
using Exiled.Events.EventArgs.Scp3114;
using Exiled.Events.Features;

/// <summary>
/// Scp3114 related events.
/// </summary>
public static class Scp3114
{
/// <summary>
/// Invoked before Disguising.
/// </summary>
public static Event<DisguisingEventArgs> Disguising { get; set; } = new();

/// <summary>
/// Invoked before Disguising.
/// </summary>
public static Event<DisguisedEventArgs> Disguised { get; set; } = new();

/// <summary>
/// Invoked before Disguising.
/// </summary>
public static Event<TryUseBodyEventArgs> TryUseBody { get; set; } = new();

/// <summary>
/// Invoked before Disguising.
/// </summary>
public static Event<RevealedEventArgs> Revealed { get; set; } = new();

/// <summary>
/// Invoked before Disguising.
/// </summary>
public static Event<RevealingEventArgs> Revealing { get; set; } = new();

/// <summary>
/// Called before diguising to a new Roles.
/// </summary>
/// <param name="ev">The <see cref="DisguisingEventArgs" /> instance.</param>
public static void OnDisguising(DisguisingEventArgs ev) => Disguising.InvokeSafely(ev);

/// <summary>
/// Called before diguising to a new Roles.
/// </summary>
/// <param name="ev">The <see cref="DisguisedEventArgs" /> instance.</param>
public static void OnDisguised(DisguisedEventArgs ev) => Disguised.InvokeSafely(ev);

/// <summary>
/// Called before diguising to a new Roles.
/// </summary>
/// <param name="ev">The <see cref="TryUseBodyEventArgs" /> instance.</param>
public static void OnTryUseBody(TryUseBodyEventArgs ev) => TryUseBody.InvokeSafely(ev);

/// <summary>
/// Called before diguising to a new Roles.
/// </summary>
/// <param name="ev">The <see cref="RevealedEventArgs" /> instance.</param>
public static void OnRevealed(RevealedEventArgs ev) => Revealed.InvokeSafely(ev);

/// <summary>
/// Called before diguising to a new Roles.
/// </summary>
/// <param name="ev">The <see cref="RevealingEventArgs" /> instance.</param>
public static void OnRevealing(RevealingEventArgs ev) => Revealing.InvokeSafely(ev);
}
}
Loading

0 comments on commit 8e46083

Please sign in to comment.