diff --git a/EXILED/Exiled.API/Features/Npc.cs b/EXILED/Exiled.API/Features/Npc.cs index 779121804..893feac92 100644 --- a/EXILED/Exiled.API/Features/Npc.cs +++ b/EXILED/Exiled.API/Features/Npc.cs @@ -291,7 +291,7 @@ public static Npc Spawn(string name, RoleTypeId role = RoleTypeId.None, bool ign }); if (ignored) - Round.IgnoredPlayers.Add(npc.ReferenceHub); + Round.IgnoredPlayers.Add(npc); Dictionary.Add(npc.GameObject, npc); return npc; @@ -334,7 +334,7 @@ public void Destroy() { try { - Round.IgnoredPlayers.Remove(ReferenceHub); + Round.IgnoredPlayers.Remove(this); Dictionary.Remove(ReferenceHub.gameObject); NetworkServer.Destroy(ReferenceHub.gameObject); } diff --git a/EXILED/Exiled.API/Features/Round.cs b/EXILED/Exiled.API/Features/Round.cs index 38bb4407e..02a3407b5 100644 --- a/EXILED/Exiled.API/Features/Round.cs +++ b/EXILED/Exiled.API/Features/Round.cs @@ -26,7 +26,7 @@ public static class Round /// /// Gets a list of players who will be ignored from determining round end. /// - public static HashSet IgnoredPlayers { get; } = new(20); // TODO: Replace ReferenceHub to Player remind to change RoundEnd transpiler + public static HashSet IgnoredPlayers { get; } = new(20); /// /// Gets the time elapsed from the start of the round. diff --git a/EXILED/Exiled.API/Features/Warhead.cs b/EXILED/Exiled.API/Features/Warhead.cs index f26157777..5b53082a8 100644 --- a/EXILED/Exiled.API/Features/Warhead.cs +++ b/EXILED/Exiled.API/Features/Warhead.cs @@ -129,6 +129,11 @@ public static WarheadStatus Status /// public static bool IsInProgress => Controller.Info.InProgress; + /// + /// Gets a value indicating whether the warhead detonation is on cooldown. + /// + public static bool IsOnCooldown => Controller.CooldownEndTime > NetworkTime.time; + /// /// Gets or sets the warhead detonation timer. /// @@ -164,7 +169,7 @@ public static int Kills /// /// Gets a value indicating whether the warhead can be started. /// - public static bool CanBeStarted => !IsInProgress && !IsDetonated && Controller.CooldownEndTime <= NetworkTime.time; + public static bool CanBeStarted => !IsInProgress && !IsDetonated && !IsOnCooldown; /// /// Closes the surface blast doors. diff --git a/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs b/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs index fba037de7..e701deccb 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs @@ -59,7 +59,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable), nameof(HashSet.Contains))), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + new(OpCodes.Callvirt, Method(typeof(HashSet), nameof(HashSet.Contains))), new(OpCodes.Brtrue_S, jmp), }); diff --git a/EXILED/Exiled.Events/Patches/Generic/LastTarget.cs b/EXILED/Exiled.Events/Patches/Generic/LastTarget.cs index 442a5fbd6..c45145944 100644 --- a/EXILED/Exiled.Events/Patches/Generic/LastTarget.cs +++ b/EXILED/Exiled.Events/Patches/Generic/LastTarget.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -35,10 +35,11 @@ private static IEnumerable Transpiler(IEnumerable), nameof(HashSet.Contains))), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + new(OpCodes.Callvirt, Method(typeof(HashSet), nameof(HashSet.Contains))), new(OpCodes.Brtrue_S, continueLabel), }); diff --git a/EXILED/Exiled.Events/Patches/Generic/RoundTargetCount.cs b/EXILED/Exiled.Events/Patches/Generic/RoundTargetCount.cs index a4d67081e..983cb201a 100644 --- a/EXILED/Exiled.Events/Patches/Generic/RoundTargetCount.cs +++ b/EXILED/Exiled.Events/Patches/Generic/RoundTargetCount.cs @@ -52,11 +52,12 @@ private static IEnumerable Transpiler(IEnumerable), nameof(HashSet.Contains))), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + new(OpCodes.Callvirt, Method(typeof(HashSet), nameof(HashSet.Contains))), new(OpCodes.Brfalse_S, skip), new(OpCodes.Ldc_I4_0),