From cf1b3b09137217b8921752747ce976c340d5512c Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:38:16 +0200 Subject: [PATCH] Merge spider clan charges can be armed again (#32866) to Master (#32881) HOTFIX spider clan charges can be armed again (#32866) * fix ninja bomb component check * remove TryGetRole --- Content.Server/Ninja/Systems/SpiderChargeSystem.cs | 10 ++++++---- Content.Shared/Mind/SharedMindSystem.cs | 13 ------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/Content.Server/Ninja/Systems/SpiderChargeSystem.cs b/Content.Server/Ninja/Systems/SpiderChargeSystem.cs index c916d568d5..6594d7883b 100644 --- a/Content.Server/Ninja/Systems/SpiderChargeSystem.cs +++ b/Content.Server/Ninja/Systems/SpiderChargeSystem.cs @@ -1,14 +1,12 @@ using Content.Server.Explosion.EntitySystems; -using Content.Server.GameTicking.Rules.Components; using Content.Server.Mind; using Content.Server.Objectives.Components; using Content.Server.Popups; using Content.Server.Roles; -using Content.Shared.Interaction; using Content.Shared.Ninja.Components; using Content.Shared.Ninja.Systems; +using Content.Shared.Roles; using Content.Shared.Sticky; -using Robust.Shared.GameObjects; namespace Content.Server.Ninja.Systems; @@ -19,6 +17,7 @@ public sealed class SpiderChargeSystem : SharedSpiderChargeSystem { [Dependency] private readonly MindSystem _mind = default!; [Dependency] private readonly PopupSystem _popup = default!; + [Dependency] private readonly SharedRoleSystem _role = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SpaceNinjaSystem _ninja = default!; @@ -41,7 +40,10 @@ public sealed class SpiderChargeSystem : SharedSpiderChargeSystem var user = args.User; - if (!_mind.TryGetRole(user, out var _)) + if (!_mind.TryGetMind(args.User, out var mind, out _)) + return; + + if (!_role.MindHasRole(mind)) { _popup.PopupEntity(Loc.GetString("spider-charge-not-ninja"), user, user); args.Cancelled = true; diff --git a/Content.Shared/Mind/SharedMindSystem.cs b/Content.Shared/Mind/SharedMindSystem.cs index 162bca495c..bf0b5f650a 100644 --- a/Content.Shared/Mind/SharedMindSystem.cs +++ b/Content.Shared/Mind/SharedMindSystem.cs @@ -483,19 +483,6 @@ public abstract class SharedMindSystem : EntitySystem return false; } - /// - /// Gets a role component from a player's mind. - /// - /// Whether a role was found - public bool TryGetRole(EntityUid user, [NotNullWhen(true)] out T? role) where T : IComponent - { - role = default; - if (!TryComp(user, out var mindContainer) || mindContainer.Mind == null) - return false; - - return TryComp(mindContainer.Mind, out role); - } - /// /// Sets the Mind's UserId, Session, and updates the player's PlayerData. This should have no direct effect on the /// entity that any mind is connected to, except as a side effect of the fact that it may change a player's -- 2.52.0