Skip to content

Commit

Permalink
the skeleton lives on (#2233)
Browse files Browse the repository at this point in the history
* Add 3114

* Add 3114

* Add 3114

* Squashed commit of the following:

commit ef803b0
Author: VALERA771 <72030575+VALERA771@users.noreply.github.com>
Date:   Mon Nov 13 05:57:25 2023 +0300

    New effects (#2224)

    * new effect

    * same as flashlight?

    * Revert "same as flashlight?"

    This reverts commit ffa76c7.

    * new effects

    * typo fix

    * xml update

    * fix

    * forgor

    * Update Exiled.API/Enums/EffectType.cs

    Co-authored-by: Thunder <thundermaker300@gmail.com>

    * Update Exiled.API/Extensions/EffectTypeExtension.cs

    Co-authored-by: Thunder <thundermaker300@gmail.com>

    * Update Exiled.API/Enums/EffectType.cs

    Co-authored-by: Thunder <thundermaker300@gmail.com>

    * basically what Yamato is saying is

    * Update Exiled.API/Enums/EffectType.cs

    * Update Exiled.API/Enums/EffectType.cs

    * Add using statement

    ---------

    Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com>
    Co-authored-by: Thunder <thundermaker300@gmail.com>
    Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com>

* Squashed commit of the following:

commit f35fdf9
Author: Thunder <thundermaker300@gmail.com>
Date:   Sun Nov 12 22:00:20 2023 -0500

    stop complaining

commit ef803b0
Author: VALERA771 <72030575+VALERA771@users.noreply.github.com>
Date:   Mon Nov 13 05:57:25 2023 +0300

    New effects (#2224)

    * new effect

    * same as flashlight?

    * Revert "same as flashlight?"

    This reverts commit ffa76c7.

    * new effects

    * typo fix

    * xml update

    * fix

    * forgor

    * Update Exiled.API/Enums/EffectType.cs

    Co-authored-by: Thunder <thundermaker300@gmail.com>

    * Update Exiled.API/Extensions/EffectTypeExtension.cs

    Co-authored-by: Thunder <thundermaker300@gmail.com>

    * Update Exiled.API/Enums/EffectType.cs

    Co-authored-by: Thunder <thundermaker300@gmail.com>

    * basically what Yamato is saying is

    * Update Exiled.API/Enums/EffectType.cs

    * Update Exiled.API/Enums/EffectType.cs

    * Add using statement

    ---------

    Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com>
    Co-authored-by: Thunder <thundermaker300@gmail.com>
    Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com>

* Fixes

* Add 3114
  • Loading branch information
Thundermaker300 authored Nov 13, 2023
1 parent f35fdf9 commit ff41d64
Show file tree
Hide file tree
Showing 17 changed files with 797 additions and 5 deletions.
15 changes: 15 additions & 0 deletions Exiled.API/Enums/DamageType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,5 +234,20 @@ public enum DamageType
/// Damage caused by <see cref="ItemType.GunA7"/>.
/// </summary>
A7,

/// <summary>
/// Damage caused by <see cref="RoleTypeId.Scp3114"/>
/// </summary>
Scp3114,

/// <summary>
/// Damage caused by Scp3114's strangling ability.
/// </summary>
Strangled,

/// <summary>
/// Damage caused by the marshmallow man.
/// </summary>
Marshmallow,
}
}
18 changes: 15 additions & 3 deletions Exiled.API/Extensions/DamageTypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Exiled.API.Extensions
using Enums;

using Features;

using PlayerRoles.PlayableScps.Scp3114;
using PlayerStatsSystem;

/// <summary>
Expand All @@ -36,6 +36,7 @@ public static class DamageTypeExtensions
{ DeathTranslations.Scp207.Id, DamageType.Scp207 },
{ DeathTranslations.Scp939Lunge.Id, DamageType.Scp939 },
{ DeathTranslations.Scp939Other.Id, DamageType.Scp939 },
{ DeathTranslations.Scp3114Slap.Id, DamageType.Scp3114 },
{ DeathTranslations.Tesla.Id, DamageType.Tesla },
{ DeathTranslations.Unknown.Id, DamageType.Unknown },
{ DeathTranslations.Warhead.Id, DamageType.Warhead },
Expand All @@ -47,6 +48,7 @@ public static class DamageTypeExtensions
{ DeathTranslations.UsedAs106Bait.Id, DamageType.FemurBreaker },
{ DeathTranslations.MicroHID.Id, DamageType.MicroHid },
{ DeathTranslations.Hypothermia.Id, DamageType.Hypothermia },
{ DeathTranslations.MarshmallowMan.Id, DamageType.Marshmallow },
};

private static readonly Dictionary<DeathTranslation, DamageType> TranslationConversionInternal = new()
Expand All @@ -65,6 +67,7 @@ public static class DamageTypeExtensions
{ DeathTranslations.Scp207, DamageType.Scp207 },
{ DeathTranslations.Scp939Lunge, DamageType.Scp939 },
{ DeathTranslations.Scp939Other, DamageType.Scp939 },
{ DeathTranslations.Scp3114Slap, DamageType.Scp3114 },
{ DeathTranslations.Tesla, DamageType.Tesla },
{ DeathTranslations.Unknown, DamageType.Unknown },
{ DeathTranslations.Warhead, DamageType.Warhead },
Expand All @@ -76,6 +79,7 @@ public static class DamageTypeExtensions
{ DeathTranslations.UsedAs106Bait, DamageType.FemurBreaker },
{ DeathTranslations.MicroHID, DamageType.MicroHid },
{ DeathTranslations.Hypothermia, DamageType.Hypothermia },
{ DeathTranslations.MarshmallowMan, DamageType.Marshmallow },
};

private static readonly Dictionary<ItemType, DamageType> ItemConversionInternal = new()
Expand Down Expand Up @@ -133,7 +137,7 @@ public static class DamageTypeExtensions
/// <returns>Returns whether or not the <see cref="DamageType"/> is caused by SCP.</returns>
public static bool IsScp(this DamageType type, bool checkItems = true) => type switch
{
DamageType.Scp or DamageType.Scp049 or DamageType.Scp096 or DamageType.Scp106 or DamageType.Scp173 or DamageType.Scp939 or DamageType.Scp0492 => true,
DamageType.Scp or DamageType.Scp049 or DamageType.Scp096 or DamageType.Scp106 or DamageType.Scp173 or DamageType.Scp939 or DamageType.Scp0492 or DamageType.Scp3114 => true,
DamageType.Scp018 or DamageType.Scp207 when checkItems => true,
_ => false,
};
Expand All @@ -145,7 +149,7 @@ public static class DamageTypeExtensions
/// <returns>Returns whether or not the <see cref="DamageType"/> is caused by status effect.</returns>
public static bool IsStatusEffect(this DamageType type) => type switch
{
DamageType.Asphyxiation or DamageType.Poison or DamageType.Bleeding or DamageType.Scp207 or DamageType.Hypothermia => true,
DamageType.Asphyxiation or DamageType.Poison or DamageType.Bleeding or DamageType.Scp207 or DamageType.Hypothermia or DamageType.Strangled => true,
_ => false,
};

Expand Down Expand Up @@ -182,6 +186,14 @@ public static DamageType GetDamageType(DamageHandlerBase damageHandlerBase)
Scp049DamageHandler.AttackType.Scp0492 => DamageType.Scp0492,
_ => DamageType.Unknown,
};
case Scp3114DamageHandler scp3114DamageHandler:
return scp3114DamageHandler.Subtype switch
{
Scp3114DamageHandler.HandlerType.Strangulation => DamageType.Strangled,
Scp3114DamageHandler.HandlerType.SkinSteal => DamageType.Scp3114,
Scp3114DamageHandler.HandlerType.Slap => DamageType.Scp3114,
_ => DamageType.Unknown,
};
case FirearmDamageHandler firearmDamageHandler:
return ItemConversion.ContainsKey(firearmDamageHandler.WeaponType) ? ItemConversion[firearmDamageHandler.WeaponType] : DamageType.Firearm;

Expand Down
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
10 changes: 9 additions & 1 deletion Exiled.API/Features/DamageHandlers/DamageHandlerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Exiled.API.Features.DamageHandlers
using Enums;

using Extensions;

using PlayerRoles.PlayableScps.Scp3114;
using PlayerRoles.PlayableScps.Scp939;

using PlayerStatsSystem;
Expand Down Expand Up @@ -116,6 +116,14 @@ public virtual DamageType Type
return DamageType.Scp939;
case JailbirdDamageHandler:
return DamageType.Jailbird;
case Scp3114DamageHandler scp3114DamageHandler:
return scp3114DamageHandler.Subtype switch
{
Scp3114DamageHandler.HandlerType.Strangulation => DamageType.Strangled,
Scp3114DamageHandler.HandlerType.SkinSteal => DamageType.Scp3114,
Scp3114DamageHandler.HandlerType.Slap => DamageType.Scp3114,
_ => DamageType.Unknown,
};
case Scp049DamageHandler scp049DamageHandler:
return scp049DamageHandler.DamageSubType switch
{
Expand Down
1 change: 1 addition & 0 deletions Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ public PlayerPermissions RemoteAdminPermissions
/// <br /><see cref="RoleTypeId.Scp096"/> = <see cref="Scp096Role"/>.
/// <br /><see cref="RoleTypeId.Scp106"/> = <see cref="Scp106Role"/>.
/// <br /><see cref="RoleTypeId.Scp173"/> = <see cref="Scp173Role"/>.
/// <br /><see cref="RoleTypeId.Scp3114"/> = <see cref="Scp3114Role"/>.
/// <br /><see cref="RoleTypeId.Scp939"/> = <see cref="Scp939Role"/>.
/// <br />If not listed above, the type of Role will be <see cref="HumanRole"/>.
/// </para>
Expand Down
2 changes: 2 additions & 0 deletions Exiled.API/Features/Roles/Role.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace Exiled.API.Features.Roles
using Scp096GameRole = PlayerRoles.PlayableScps.Scp096.Scp096Role;
using Scp106GameRole = PlayerRoles.PlayableScps.Scp106.Scp106Role;
using Scp173GameRole = PlayerRoles.PlayableScps.Scp173.Scp173Role;
using Scp3114GameRole = PlayerRoles.PlayableScps.Scp3114.Scp3114Role;
using Scp939GameRole = PlayerRoles.PlayableScps.Scp939.Scp939Role;
using SpectatorGameRole = PlayerRoles.Spectating.SpectatorRole;

Expand Down Expand Up @@ -222,6 +223,7 @@ public virtual void Set(RoleTypeId newRole, SpawnReason reason, RoleSpawnFlags s
Scp096GameRole scp096Role => new Scp096Role(scp096Role),
Scp106GameRole scp106Role => new Scp106Role(scp106Role),
Scp173GameRole scp173Role => new Scp173Role(scp173Role),
Scp3114GameRole scp3114Role => new Scp3114Role(scp3114Role),
Scp939GameRole scp939Role => new Scp939Role(scp939Role),
OverwatchGameRole overwatchRole => new OverwatchRole(overwatchRole),
SpectatorGameRole spectatorRole => new SpectatorRole(spectatorRole),
Expand Down
239 changes: 239 additions & 0 deletions Exiled.API/Features/Roles/Scp3114Role.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
// -----------------------------------------------------------------------
// <copyright file="Scp3114Role.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Features.Roles
{
using System.Collections.Generic;

using PlayerRoles;
using PlayerRoles.PlayableScps;
using PlayerRoles.PlayableScps.HumeShield;
using PlayerRoles.PlayableScps.Scp3114;
using PlayerRoles.Subroutines;

using static PlayerRoles.PlayableScps.Scp3114.Scp3114Identity;

using Scp3114GameRole = PlayerRoles.PlayableScps.Scp3114.Scp3114Role;

/// <summary>
/// Defines a role that represents SCP-3114.
/// </summary>
public class Scp3114Role : FpcRole, ISubroutinedScpRole, IHumeShieldRole
{
/// <summary>
/// Initializes a new instance of the <see cref="Scp3114Role"/> class.
/// </summary>
/// <param name="baseRole">the base <see cref="Scp3114GameRole"/>.</param>
internal Scp3114Role(Scp3114GameRole baseRole)
: base(baseRole)
{
Base = baseRole;
SubroutineModule = baseRole.SubroutineModule;
HumeShieldModule = baseRole.HumeShieldModule;

if (!SubroutineModule.TryGetSubroutine(out Scp3114Slap scp3114Slap))
Log.Error("Scp3114Slap not found in Scp3114Role::ctor");

Slap = scp3114Slap;

if (!SubroutineModule.TryGetSubroutine(out Scp3114Dance scp3114Dance))
Log.Error("Scp3114Dance not found in Scp3114Role::ctor");

Dance = scp3114Dance;

if (!SubroutineModule.TryGetSubroutine(out Scp3114Reveal scp3114Reveal))
Log.Error("Scp3114Reveal not found in Scp3114Role::ctor");

Reveal = scp3114Reveal;

if (!SubroutineModule.TryGetSubroutine(out Scp3114Identity scp3114Identity))
Log.Error("Scp3114Identity not found in Scp3114Role::ctor");

Identity = scp3114Identity;

if (!SubroutineModule.TryGetSubroutine(out Scp3114History scp3114History))
Log.Error("Scp3114History not found in Scp3114Role::ctor");

History = scp3114History;

if (!SubroutineModule.TryGetSubroutine(out Scp3114FakeModelManager scp3114FakeModelManager))
Log.Error("Scp3114FakeModelManager not found in Scp3114Role::ctor");

FakeModelManager = scp3114FakeModelManager;

if (!SubroutineModule.TryGetSubroutine(out Scp3114Disguise scp3114Disguise))
Log.Error("Scp3114Disguise not found in Scp3114Role::ctor");

Disguise = scp3114Disguise;

if (!SubroutineModule.TryGetSubroutine(out Scp3114VoiceLines scp3114VoiceLines))
Log.Error("Scp3114VoiceLines not found in Scp3114Role::ctor");

VoiceLines = scp3114VoiceLines;
}

/// <inheritdoc/>
public override RoleTypeId Type { get; } = RoleTypeId.Scp3114;

/// <inheritdoc/>
public SubroutineManagerModule SubroutineModule { get; }

/// <inheritdoc/>
public HumeShieldModuleBase HumeShieldModule { get; }

/// <summary>
/// Gets Scp3114's <see cref="Scp3114Slap"/>.
/// </summary>
public Scp3114Slap Slap { get; }

/// <summary>
/// Gets Scp3114's <see cref="Scp3114Dance"/>.
/// </summary>
public Scp3114Dance Dance { get; }

/// <summary>
/// Gets Scp3114's <see cref="Scp3114Reveal"/>.
/// </summary>
public Scp3114Reveal Reveal { get; }

/// <summary>
/// Gets Scp3114's <see cref="Scp3114Identity"/>.
/// </summary>
public Scp3114Identity Identity { get; }

/// <summary>
/// Gets Scp3114's <see cref="Scp3114History"/>.
/// </summary>
public Scp3114History History { get; }

/// <summary>
/// Gets Scp3114's <see cref="Scp3114FakeModelManager"/>.
/// </summary>
public Scp3114FakeModelManager FakeModelManager { get; }

/// <summary>
/// Gets Scp3114's <see cref="Scp3114Disguise"/>.
/// </summary>
public Scp3114Disguise Disguise { get; }

/// <summary>
/// Gets Scp3114's <see cref="Scp3114VoiceLines"/>.
/// </summary>
public Scp3114VoiceLines VoiceLines { get; }

/// <summary>
/// Gets the <see cref="Scp3114GameRole"/> instance.
/// </summary>
public new Scp3114GameRole Base { get; }

/// <summary>
/// Gets the damage amount of SCP-3114's slap ability.
/// </summary>
public float SlapDamage => Slap.DamageAmount;

/// <summary>
/// Gets the current target of SCP-3114's strangle ability. Can be <see langword="null"/>.
/// </summary>
public Player StrangleTarget => Player.Get(Slap._strangle.SyncTarget?.Target);

/// <summary>
/// Gets or sets the SCP-3114's Stolen Role.
/// </summary>
public RoleTypeId StolenRole
{
get => Identity.CurIdentity.StolenRole;
set
{
if (Ragdoll is null)
return;

Ragdoll.Role = value;
Identity.ServerResendIdentity();
}
}

/// <summary>
/// Gets or sets the SCP-3114's Ragdoll used for it's FakeIdentity.
/// </summary>
public Ragdoll Ragdoll
{
get => Ragdoll.Get(Identity.CurIdentity.Ragdoll);
set
{
Identity.CurIdentity.Ragdoll = value?.Base;
Identity.ServerResendIdentity();
}
}

/// <summary>
/// Gets or sets the SCP-3114's UnitId used for it's FakeIdentity.
/// </summary>
public byte UnitId
{
get => Identity.CurIdentity.UnitNameId;
set
{
Identity.CurIdentity.UnitNameId = value;
Identity.ServerResendIdentity();
}
}

/// <summary>
/// Gets or sets current state of SCP-3114's disguise ability.
/// </summary>
public DisguiseStatus DisguiseStatus
{
get => Identity.CurIdentity.Status;
set
{
Identity.CurIdentity.Status = value;
Identity.ServerResendIdentity();
}
}

/// <summary>
/// Gets or sets the SCP-3114's Disguise duration.
/// </summary>
public float DisguiseDuration
{
get => Identity._disguiseDurationSeconds;
set => Identity._disguiseDurationSeconds = value;
}

/// <summary>
/// Gets or sets the warning time seconds.
/// </summary>
public float WarningTime
{
get => Identity._warningTimeSeconds;
set => Identity._warningTimeSeconds = value;
}

/// <summary>
/// Reset Scp3114 FakeIdentity.
/// </summary>
public void ResetIdentity()
{
Identity.CurIdentity.Reset();
Identity.ServerResendIdentity();
}

/// <summary>
/// Plays a random Scp3114 voice line.
/// </summary>
/// <param name="voiceLine">The type of voice line to play.</param>
public void PlaySound(Scp3114VoiceLines.VoiceLinesName voiceLine = Scp3114VoiceLines.VoiceLinesName.RandomIdle)
=> VoiceLines.ServerPlayConditionally(voiceLine);

/// <summary>
/// Gets the Spawn Chance of SCP-3114.
/// </summary>
/// <param name="alreadySpawned">The List of Roles already spawned.</param>
/// <returns>The Spawn Chance.</returns>
public float GetSpawnChance(List<RoleTypeId> alreadySpawned) => Base is ISpawnableScp spawnableScp ? spawnableScp.GetSpawnChance(alreadySpawned) : 0;
}
}
Loading

0 comments on commit ff41d64

Please sign in to comment.