Skip to content

Commit

Permalink
HOTFIX spider clan charges can be armed again (#32866)
Browse files Browse the repository at this point in the history
* fix ninja bomb component check

* remove TryGetRole
  • Loading branch information
Errant-4 authored Oct 18, 2024
1 parent 519a6b2 commit e04e3a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
10 changes: 6 additions & 4 deletions Content.Server/Ninja/Systems/SpiderChargeSystem.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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!;

Expand All @@ -41,7 +40,10 @@ private void OnAttemptStick(EntityUid uid, SpiderChargeComponent comp, ref Attem

var user = args.User;

if (!_mind.TryGetRole<NinjaRoleComponent>(user, out var _))
if (!_mind.TryGetMind(args.User, out var mind, out _))
return;

if (!_role.MindHasRole<NinjaRoleComponent>(mind))
{
_popup.PopupEntity(Loc.GetString("spider-charge-not-ninja"), user, user);
args.Cancelled = true;
Expand Down
13 changes: 0 additions & 13 deletions Content.Shared/Mind/SharedMindSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -483,19 +483,6 @@ public bool TryGetMind(
return false;
}

/// <summary>
/// Gets a role component from a player's mind.
/// </summary>
/// <returns>Whether a role was found</returns>
public bool TryGetRole<T>(EntityUid user, [NotNullWhen(true)] out T? role) where T : IComponent
{
role = default;
if (!TryComp<MindContainerComponent>(user, out var mindContainer) || mindContainer.Mind == null)
return false;

return TryComp(mindContainer.Mind, out role);
}

/// <summary>
/// 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
Expand Down

0 comments on commit e04e3a6

Please sign in to comment.