From 284d57081cdb203a1bb7520ac8ebc490f5597c24 Mon Sep 17 00:00:00 2001 From: Yamato Date: Sun, 22 Dec 2024 22:30:36 +0100 Subject: [PATCH 1/4] Scp1507Role --- EXILED/Exiled.API/Features/Roles/Role.cs | 2 + .../Exiled.API/Features/Roles/Scp1507Role.cs | 67 +++++++++++++++++++ .../Patches/Events/Player/TriggeringTesla.cs | 46 +++++++------ 3 files changed, 96 insertions(+), 19 deletions(-) create mode 100644 EXILED/Exiled.API/Features/Roles/Scp1507Role.cs diff --git a/EXILED/Exiled.API/Features/Roles/Role.cs b/EXILED/Exiled.API/Features/Roles/Role.cs index ef6d8dceab..0218a7ad89 100644 --- a/EXILED/Exiled.API/Features/Roles/Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Role.cs @@ -27,6 +27,7 @@ namespace Exiled.API.Features.Roles using Scp079GameRole = PlayerRoles.PlayableScps.Scp079.Scp079Role; using Scp096GameRole = PlayerRoles.PlayableScps.Scp096.Scp096Role; using Scp106GameRole = PlayerRoles.PlayableScps.Scp106.Scp106Role; + using Scp1507GameRole = PlayerRoles.PlayableScps.Scp1507.Scp1507Role; using Scp173GameRole = PlayerRoles.PlayableScps.Scp173.Scp173Role; using Scp3114GameRole = PlayerRoles.PlayableScps.Scp3114.Scp3114Role; using Scp939GameRole = PlayerRoles.PlayableScps.Scp939.Scp939Role; @@ -235,6 +236,7 @@ public virtual void Set(RoleTypeId newRole, SpawnReason reason, RoleSpawnFlags s FilmmakerGameRole filmmakerRole => new FilmMakerRole(filmmakerRole), NoneGameRole noneRole => new NoneRole(noneRole), DestroyedGameRole destroyedRole => new DestroyedRole(destroyedRole), + Scp1507GameRole scp1507 => new Scp1507Role(scp1507), _ => null, }; } diff --git a/EXILED/Exiled.API/Features/Roles/Scp1507Role.cs b/EXILED/Exiled.API/Features/Roles/Scp1507Role.cs new file mode 100644 index 0000000000..3bc5807086 --- /dev/null +++ b/EXILED/Exiled.API/Features/Roles/Scp1507Role.cs @@ -0,0 +1,67 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Roles +{ + using System.Collections.Generic; + + using Exiled.API.Enums; + using Exiled.API.Features.Pools; + + using PlayerRoles; + using PlayerRoles.PlayableScps; + using PlayerRoles.PlayableScps.HumeShield; + using PlayerRoles.PlayableScps.Scp939; + using PlayerRoles.PlayableScps.Scp939.Mimicry; + using PlayerRoles.PlayableScps.Scp939.Ripples; + using PlayerRoles.Subroutines; + + using RelativePositioning; + + using UnityEngine; + + using Scp1507GameRole = PlayerRoles.PlayableScps.Scp1507.Scp1507Role; + + /// + /// Defines a role that represents SCP-1507. + /// + public class Scp1507Role : FpcRole, ISubroutinedScpRole, IHumeShieldRole, ISpawnableScp + { + /// + /// Initializes a new instance of the class. + /// + /// the base . + internal Scp1507Role(Scp1507GameRole baseRole) + : base(baseRole) + { + Base = baseRole; + SubroutineModule = baseRole.SubroutineModule; + HumeShieldModule = baseRole.HumeShieldModule; + } + + /// + public override RoleTypeId Type => Base._roleTypeId; + + /// + public SubroutineManagerModule SubroutineModule { get; } + + /// + public HumeShieldModuleBase HumeShieldModule { get; } + + /// + /// Gets the instance. + /// + public new Scp1507GameRole Base { get; } + + /// + /// Gets the Spawn Chance of SCP-939. + /// + /// The List of Roles already spawned. + /// The Spawn Chance. + public float GetSpawnChance(List alreadySpawned) => Base is ISpawnableScp spawnableScp ? spawnableScp.GetSpawnChance(alreadySpawned) : 0; + } +} diff --git a/EXILED/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs b/EXILED/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs index 05f9b37280..b68b34fad6 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs @@ -7,6 +7,7 @@ namespace Exiled.Events.Patches.Events.Player { + using System; using System.Collections.Generic; using System.Reflection.Emit; @@ -66,32 +67,39 @@ private static IEnumerable Transpiler(IEnumerable Date: Sun, 22 Dec 2024 22:36:55 +0100 Subject: [PATCH 2/4] more obvious exception --- EXILED/Exiled.API/Features/Roles/Role.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.API/Features/Roles/Role.cs b/EXILED/Exiled.API/Features/Roles/Role.cs index 0218a7ad89..c24f7af012 100644 --- a/EXILED/Exiled.API/Features/Roles/Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Role.cs @@ -237,7 +237,7 @@ public virtual void Set(RoleTypeId newRole, SpawnReason reason, RoleSpawnFlags s NoneGameRole noneRole => new NoneRole(noneRole), DestroyedGameRole destroyedRole => new DestroyedRole(destroyedRole), Scp1507GameRole scp1507 => new Scp1507Role(scp1507), - _ => null, + _ => throw new Exception($"Contact Exiled Support Missing Role ({role?.RoleTypeId}) in Exiled.API::Create"), }; } } From 05229723aaa08db2a9a2ce1ab8a54099600ee117 Mon Sep 17 00:00:00 2001 From: Yamato Date: Sun, 22 Dec 2024 22:38:24 +0100 Subject: [PATCH 3/4] Revert debug --- .../Patches/Events/Player/TriggeringTesla.cs | 46 ++++++++----------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs b/EXILED/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs index b68b34fad6..05f9b37280 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs @@ -7,7 +7,6 @@ namespace Exiled.Events.Patches.Events.Player { - using System; using System.Collections.Generic; using System.Reflection.Emit; @@ -67,39 +66,32 @@ private static IEnumerable Transpiler(IEnumerable Date: Mon, 23 Dec 2024 00:20:54 +0100 Subject: [PATCH 4/4] change exception --- EXILED/Exiled.API/Features/Roles/Role.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.API/Features/Roles/Role.cs b/EXILED/Exiled.API/Features/Roles/Role.cs index c24f7af012..5e4869a728 100644 --- a/EXILED/Exiled.API/Features/Roles/Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Role.cs @@ -237,7 +237,7 @@ public virtual void Set(RoleTypeId newRole, SpawnReason reason, RoleSpawnFlags s NoneGameRole noneRole => new NoneRole(noneRole), DestroyedGameRole destroyedRole => new DestroyedRole(destroyedRole), Scp1507GameRole scp1507 => new Scp1507Role(scp1507), - _ => throw new Exception($"Contact Exiled Support Missing Role ({role?.RoleTypeId}) in Exiled.API::Create"), + _ => throw new Exception($"Missing role found in Exiled.API.Features.Roles.Role::Create ({role?.RoleTypeId}). Please contact an Exiled developer."), }; } }