-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #259 from Rxup/upstream-sync
Upstream sync
- Loading branch information
Showing
237 changed files
with
47,071 additions
and
66,376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Content.Shared.StatusIcon; | ||
using Content.Shared.StatusIcon.Components; | ||
using Robust.Shared.Prototypes; | ||
using Content.Shared.Ghost; | ||
using Robust.Client.Player; | ||
|
||
namespace Content.Client.Antag; | ||
|
||
/// <summary> | ||
/// Used for assigning specified icons for antags. | ||
/// </summary> | ||
public abstract class AntagStatusIconSystem<T> : SharedStatusIconSystem | ||
where T : Component | ||
{ | ||
[Dependency] private readonly IPrototypeManager _prototype = default!; | ||
[Dependency] private readonly IPlayerManager _player = default!; | ||
|
||
/// <summary> | ||
/// Will check if the local player has the same component as the one who called it and give the status icon. | ||
/// </summary> | ||
/// <param name="antagStatusIcon">The status icon that your antag uses</param> | ||
/// <param name="args">The GetStatusIcon event.</param> | ||
protected virtual void GetStatusIcon(string antagStatusIcon, ref GetStatusIconsEvent args) | ||
{ | ||
var ent = _player.LocalPlayer?.ControlledEntity; | ||
|
||
if (!HasComp<T>(ent) && !HasComp<GhostComponent>(ent)) | ||
return; | ||
|
||
args.StatusIcons.Add(_prototype.Index<StatusIconPrototype>(antagStatusIcon)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Content.Shared.Revolutionary.Components; | ||
using Content.Client.Antag; | ||
using Content.Shared.StatusIcon.Components; | ||
|
||
namespace Content.Client.Revolutionary; | ||
|
||
/// <summary> | ||
/// Used for the client to get status icons from other revs. | ||
/// </summary> | ||
public sealed class RevolutionarySystem : AntagStatusIconSystem<RevolutionaryComponent> | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<RevolutionaryComponent, GetStatusIconsEvent>(GetRevIcon); | ||
SubscribeLocalEvent<HeadRevolutionaryComponent, GetStatusIconsEvent>(GetHeadRevIcon); | ||
} | ||
|
||
/// <summary> | ||
/// Checks if the person who triggers the GetStatusIcon event is also a Rev or a HeadRev. | ||
/// </summary> | ||
private void GetRevIcon(EntityUid uid, RevolutionaryComponent comp, ref GetStatusIconsEvent args) | ||
{ | ||
if (!HasComp<HeadRevolutionaryComponent>(uid)) | ||
{ | ||
GetStatusIcon(comp.RevStatusIcon, ref args); | ||
} | ||
} | ||
|
||
private void GetHeadRevIcon(EntityUid uid, HeadRevolutionaryComponent comp, ref GetStatusIconsEvent args) | ||
{ | ||
GetStatusIcon(comp.HeadRevStatusIcon, ref args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.