diff --git a/EXILED/Exiled.API/Features/Roles/Role.cs b/EXILED/Exiled.API/Features/Roles/Role.cs index 96f7a3b687..bc9f94d20d 100644 --- a/EXILED/Exiled.API/Features/Roles/Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Role.cs @@ -10,19 +10,17 @@ namespace Exiled.API.Features.Roles using System; using Enums; - using Exiled.API.Features.Core; using Exiled.API.Features.Spawn; using Exiled.API.Interfaces; using Extensions; - using PlayerRoles; using PlayerRoles.PlayableScps.Scp049.Zombies; - using UnityEngine; using FilmmakerGameRole = PlayerRoles.Filmmaker.FilmmakerRole; using HumanGameRole = PlayerRoles.HumanRole; + using NoneGameRole = PlayerRoles.NoneRole; using OverwatchGameRole = PlayerRoles.Spectating.OverwatchRole; using Scp049GameRole = PlayerRoles.PlayableScps.Scp049.Scp049Role; using Scp079GameRole = PlayerRoles.PlayableScps.Scp079.Scp079Role; @@ -229,7 +227,8 @@ public virtual void Set(RoleTypeId newRole, SpawnReason reason, RoleSpawnFlags s SpectatorGameRole spectatorRole => new SpectatorRole(spectatorRole), HumanGameRole humanRole => new HumanRole(humanRole), FilmmakerGameRole filmmakerRole => new FilmMakerRole(filmmakerRole), - _ => new NoneRole(role), + NoneGameRole noneRole => new NoneRole(noneRole), + _ => null, }; } } diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs index 786842b5bc..8de7578477 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs @@ -43,8 +43,6 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable instruction.Calls(Method(typeof(GameObjectPools.PoolObject), nameof(GameObjectPools.PoolObject.SetupPoolObject)))) + offset; - newInstructions[index].WithLabels(continueLabel1); - newInstructions.InsertRange( index, new[] { - // if (player == null) - // continue - new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex), - new(OpCodes.Brfalse_S, continueLabel1), - // player.Role = Role.Create(roleBase); new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex), new(OpCodes.Ldloc_2), @@ -154,22 +140,10 @@ private static IEnumerable Transpiler(IEnumerable i.Calls(Method(typeof(PlayerRoleManager.RoleChanged), nameof(PlayerRoleManager.RoleChanged.Invoke)))) + offset; - newInstructions[index].labels.Add(continueLabel2); - newInstructions.InsertRange( index, - new[] + new CodeInstruction[] { - // if (player == null) - // continue - new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex), - new(OpCodes.Brfalse_S, continueLabel2), - - // if (changingRoleEventArgs == null) - // continue - new CodeInstruction(OpCodes.Ldloc_S, changingRoleEventArgs.LocalIndex), - new(OpCodes.Brfalse_S, continueLabel2), - // changingRoleEventArgs new(OpCodes.Ldloc_S, changingRoleEventArgs.LocalIndex), @@ -181,11 +155,6 @@ private static IEnumerable Transpiler(IEnumerable