-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-picked commit 60b9d89 from space-wizards/space-station-14/master
- Loading branch information
Showing
19 changed files
with
230 additions
and
40 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
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
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
50 changes: 47 additions & 3 deletions
50
Content.Shared/CriminalRecords/Systems/SharedCriminalRecordsConsoleSystem.cs
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 |
---|---|---|
@@ -1,8 +1,52 @@ | ||
using Content.Shared.IdentityManagement; | ||
using Content.Shared.IdentityManagement.Components; | ||
using Content.Shared.Security; | ||
using Content.Shared.Security.Components; | ||
|
||
namespace Content.Shared.CriminalRecords.Systems; | ||
|
||
/// <summary> | ||
/// Nothing is predicted just exists for access. | ||
/// </summary> | ||
public abstract class SharedCriminalRecordsConsoleSystem : EntitySystem | ||
{ | ||
/// <summary> | ||
/// Any entity that has a the name of the record that was just changed as their visible name will get their icon | ||
/// updated with the new status, if the record got removed their icon will be removed too. | ||
/// </summary> | ||
public void UpdateCriminalIdentity(string name, SecurityStatus status) | ||
{ | ||
var query = EntityQueryEnumerator<IdentityComponent>(); | ||
|
||
while (query.MoveNext(out var uid, out var identity)) | ||
{ | ||
if (!Identity.Name(uid, EntityManager).Equals(name)) | ||
continue; | ||
|
||
if (status == SecurityStatus.None) | ||
RemComp<CriminalRecordComponent>(uid); | ||
else | ||
SetCriminalIcon(name, status, uid); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Decides the icon that should be displayed on the entity based on the security status | ||
/// </summary> | ||
public void SetCriminalIcon(string name, SecurityStatus status, EntityUid characterUid) | ||
{ | ||
EnsureComp<CriminalRecordComponent>(characterUid, out var record); | ||
|
||
var previousIcon = record.StatusIcon; | ||
|
||
record.StatusIcon = status switch | ||
{ | ||
SecurityStatus.Paroled => "SecurityIconParoled", | ||
SecurityStatus.Wanted => "SecurityIconWanted", | ||
SecurityStatus.Detained => "SecurityIconIncarcerated", | ||
SecurityStatus.Discharged => "SecurityIconDischarged", | ||
SecurityStatus.Suspected => "SecurityIconSuspected", | ||
_ => record.StatusIcon | ||
}; | ||
|
||
if(previousIcon != record.StatusIcon) | ||
Dirty(characterUid, record); | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
Content.Shared/IdentityManagement/Components/IdentityComponent.cs
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
15 changes: 15 additions & 0 deletions
15
Content.Shared/Security/Components/CriminalRecordComponent.cs
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,15 @@ | ||
using Content.Shared.StatusIcon; | ||
using Robust.Shared.GameStates; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Shared.Security.Components; | ||
|
||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] | ||
public sealed partial class CriminalRecordComponent : Component | ||
{ | ||
/// <summary> | ||
/// The icon that should be displayed based on the criminal status of the entity. | ||
/// </summary> | ||
[DataField, AutoNetworkedField] | ||
public ProtoId<StatusIconPrototype> StatusIcon = "SecurityIconWanted"; | ||
} |
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.