forked from space-syndicate/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Sec always watching * Убран статус "Подозревается" * Wanted and Detained
- Loading branch information
Showing
15 changed files
with
275 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
Content.Client/_CorvaxNext/CartridgeLoader/Cartridges/SecWatchEntryControl.xaml
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,19 @@ | ||
<BoxContainer xmlns="https://spacestation14.io" | ||
xmlns:cartridges="clr-namespace:Content.Client._CorvaxNext.CartridgeLoader.Cartridges" | ||
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls" | ||
HorizontalExpand="True" | ||
VerticalExpand="True" | ||
Margin="5"> | ||
<!-- All labels populated in constructor --> | ||
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Left"> | ||
<BoxContainer Orientation="Vertical"> | ||
<Label Name="Status"/> | ||
<Label Text="{Loc 'criminal-records-console-reason'}"/> | ||
</BoxContainer> | ||
<customControls:VSeparator StyleClasses="LowDivider" Margin="8 0"/> | ||
<BoxContainer Orientation="Vertical"> | ||
<Label Name="Title"/> | ||
<Label Name="Reason"/> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</BoxContainer> |
21 changes: 21 additions & 0 deletions
21
Content.Client/_CorvaxNext/CartridgeLoader/Cartridges/SecWatchEntryControl.xaml.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,21 @@ | ||
using Content.Shared.CartridgeLoader.Cartridges; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client._CorvaxNext.CartridgeLoader.Cartridges; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class SecWatchEntryControl : BoxContainer | ||
{ | ||
public SecWatchEntryControl(SecWatchEntry entry) | ||
{ | ||
RobustXamlLoader.Load(this); | ||
|
||
Status.Text = Loc.GetString($"criminal-records-status-{entry.Status.ToString().ToLower()}"); | ||
Title.Text = Loc.GetString("sec-watch-entry", ("name", entry.Name), ("job", entry.Job)); | ||
|
||
Reason.Text = entry.Reason ?? Loc.GetString("sec-watch-no-reason"); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Content.Client/_CorvaxNext/CartridgeLoader/Cartridges/SecWatchUi.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,27 @@ | ||
using Content.Client.UserInterface.Fragments; | ||
using Content.Shared.CartridgeLoader; | ||
using Content.Shared.CartridgeLoader.Cartridges; | ||
using Robust.Client.UserInterface; | ||
|
||
namespace Content.Client._CorvaxNext.CartridgeLoader.Cartridges; | ||
|
||
public sealed partial class SecWatchUi : UIFragment | ||
{ | ||
private SecWatchUiFragment? _fragment; | ||
|
||
public override Control GetUIFragmentRoot() | ||
{ | ||
return _fragment!; | ||
} | ||
|
||
public override void Setup(BoundUserInterface ui, EntityUid? owner) | ||
{ | ||
_fragment = new SecWatchUiFragment(); | ||
} | ||
|
||
public override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
if (state is SecWatchUiState cast) | ||
_fragment?.UpdateState(cast); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Content.Client/_CorvaxNext/CartridgeLoader/Cartridges/SecWatchUiFragment.xaml
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,13 @@ | ||
<cartridges:SecWatchUiFragment xmlns="https://spacestation14.io" | ||
xmlns:cartridges="clr-namespace:Content.Client._CorvaxNext.CartridgeLoader.Cartridges" | ||
Margin="5" | ||
VerticalExpand="True"> | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True"> | ||
<Label Text="{Loc 'sec-watch-title'}" HorizontalExpand="True" HorizontalAlignment="Center"/> | ||
<Label Name="NoEntries" Text="{Loc 'sec-watch-no-entries'}" HorizontalExpand="True" HorizontalAlignment="Center" Visible="False"/> | ||
<ScrollContainer HorizontalExpand="True" VerticalExpand="True"> | ||
<!-- Populated when state received --> | ||
<BoxContainer Name="Entries" Orientation="Vertical" VerticalAlignment="Top"/> | ||
</ScrollContainer> | ||
</BoxContainer> | ||
</cartridges:SecWatchUiFragment> |
25 changes: 25 additions & 0 deletions
25
Content.Client/_CorvaxNext/CartridgeLoader/Cartridges/SecWatchUiFragment.xaml.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,25 @@ | ||
using Content.Shared.CartridgeLoader.Cartridges; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client._CorvaxNext.CartridgeLoader.Cartridges; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class SecWatchUiFragment : BoxContainer | ||
{ | ||
public SecWatchUiFragment() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
} | ||
|
||
public void UpdateState(SecWatchUiState state) | ||
{ | ||
NoEntries.Visible = state.Entries.Count == 0; | ||
Entries.RemoveAllChildren(); | ||
foreach (var entry in state.Entries) | ||
{ | ||
Entries.AddChild(new SecWatchEntryControl(entry)); | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Content.Server/_CorvaxNext/CartridgeLoader/Cartridges/SecWatchCartridgeComponent.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,23 @@ | ||
using Content.Shared.Security; | ||
|
||
namespace Content.Server.CartridgeLoader.Cartridges; | ||
|
||
[RegisterComponent, Access(typeof(SecWatchCartridgeSystem))] | ||
public sealed partial class SecWatchCartridgeComponent : Component | ||
{ | ||
/// <summary> | ||
/// Only show people with these statuses. | ||
/// </summary> | ||
[DataField] | ||
public List<SecurityStatus> Statuses = new() | ||
{ | ||
SecurityStatus.Wanted, | ||
SecurityStatus.Detained | ||
}; | ||
|
||
/// <summary> | ||
/// Station entity thats getting its records checked. | ||
/// </summary> | ||
[DataField] | ||
public EntityUid? Station; | ||
} |
73 changes: 73 additions & 0 deletions
73
Content.Server/_CorvaxNext/CartridgeLoader/Cartridges/SecWatchCartridgeSystem.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,73 @@ | ||
using Content.Server.Station.Systems; | ||
using Content.Server.StationRecords; | ||
using Content.Server.StationRecords.Systems; | ||
using Content.Shared.CartridgeLoader; | ||
using Content.Shared.CartridgeLoader.Cartridges; | ||
using Content.Shared.CriminalRecords; | ||
using Content.Shared.StationRecords; | ||
|
||
namespace Content.Server.CartridgeLoader.Cartridges; | ||
|
||
public sealed class SecWatchCartridgeSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly CartridgeLoaderSystem _cartridgeLoader = default!; | ||
[Dependency] private readonly StationRecordsSystem _records = default!; | ||
[Dependency] private readonly StationSystem _station = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<RecordModifiedEvent>(OnRecordModified); | ||
|
||
SubscribeLocalEvent<SecWatchCartridgeComponent, CartridgeUiReadyEvent>(OnUiReady); | ||
} | ||
|
||
private void OnRecordModified(RecordModifiedEvent args) | ||
{ | ||
// when a record is modified update the ui of every loaded cartridge tuned to the same station | ||
var query = EntityQueryEnumerator<SecWatchCartridgeComponent, CartridgeComponent>(); | ||
while (query.MoveNext(out var uid, out var comp, out var cartridge)) | ||
{ | ||
if (cartridge.LoaderUid is not {} loader || comp.Station != args.Station) | ||
continue; | ||
|
||
UpdateUI((uid, comp), loader); | ||
} | ||
} | ||
|
||
private void OnUiReady(Entity<SecWatchCartridgeComponent> ent, ref CartridgeUiReadyEvent args) | ||
{ | ||
UpdateUI(ent, args.Loader); | ||
} | ||
|
||
private void UpdateUI(Entity<SecWatchCartridgeComponent> ent, EntityUid loader) | ||
{ | ||
// if the loader is on a grid, update the station | ||
// if it is off grid use the cached station | ||
if (_station.GetOwningStation(loader) is {} station) | ||
ent.Comp.Station = station; | ||
|
||
if (!TryComp<StationRecordsComponent>(ent.Comp.Station, out var records)) | ||
return; | ||
|
||
station = ent.Comp.Station.Value; | ||
|
||
var entries = new List<SecWatchEntry>(); | ||
foreach (var (id, criminal) in _records.GetRecordsOfType<CriminalRecord>(station, records)) | ||
{ | ||
if (!ent.Comp.Statuses.Contains(criminal.Status)) | ||
continue; | ||
|
||
var key = new StationRecordKey(id, station); | ||
if (!_records.TryGetRecord<GeneralStationRecord>(key, out var general, records)) | ||
continue; | ||
|
||
var status = criminal.Status; | ||
entries.Add(new SecWatchEntry(general.Name, general.JobTitle, criminal.Status, criminal.Reason)); | ||
} | ||
|
||
var state = new SecWatchUiState(entries); | ||
_cartridgeLoader.UpdateCartridgeUiState(loader, state); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
Content.Shared/_CorvaxNext/CartridgeLoader/Cartridges/SecWatchUiState.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,24 @@ | ||
using Content.Shared.Security; | ||
using Robust.Shared.Serialization; | ||
|
||
namespace Content.Shared.CartridgeLoader.Cartridges; | ||
|
||
/// <summary> | ||
/// Show a list of wanted and suspected people from criminal records. | ||
/// </summary> | ||
[Serializable, NetSerializable] | ||
public sealed class SecWatchUiState : BoundUserInterfaceState | ||
{ | ||
public readonly List<SecWatchEntry> Entries; | ||
|
||
public SecWatchUiState(List<SecWatchEntry> entries) | ||
{ | ||
Entries = entries; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Entry for a person who is wanted or suspected. | ||
/// </summary> | ||
[Serializable, NetSerializable] | ||
public record struct SecWatchEntry(string Name, string Job, SecurityStatus Status, string? Reason); |
5 changes: 5 additions & 0 deletions
5
Resources/Locale/en-US/_corvaxnext/cartridge-loader/secwatch.ftl
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,5 @@ | ||
sec-watch-program-name = SecWatch | ||
sec-watch-title = SecWatch 1.0 | ||
sec-watch-no-entries = Everything's calm. Why not enjoy a Monkin Donut? | ||
sec-watch-entry = {$name} | ||
sec-watch-no-reason = None given??? |
5 changes: 5 additions & 0 deletions
5
Resources/Locale/ru-RU/_corvaxnext/cartridge-loader/secwatch.ftl
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,5 @@ | ||
sec-watch-program-name = ОКО СБ | ||
sec-watch-title = ОКО СБ 1.0 | ||
sec-watch-no-entries = Полный порядок. Безопасность превыше всего. | ||
sec-watch-entry = {$name} | ||
sec-watch-no-reason = Причина не уточнена. |
2 changes: 2 additions & 0 deletions
2
Resources/Locale/ru-RU/ss14-ru/prototypes/_corvaxnext/entities/objects/devices/cartriges.ftl
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,2 @@ | ||
ent-SecWatchCartridge = картридж "око сб" | ||
.desc = Картридж, отслеживающий статус разыскиваемых службой безопасности лиц. |
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
20 changes: 20 additions & 0 deletions
20
Resources/Prototypes/_CorvaxNext/Entities/Objects/Devices/cartridges.yml
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,20 @@ | ||
- type: entity | ||
parent: BaseItem | ||
id: SecWatchCartridge | ||
name: sec watch cartridge | ||
description: A cartridge that tracks the status of currently wanted individuals. | ||
components: | ||
- type: Sprite | ||
sprite: _CorvaxNext/Objects/Devices/cartridge.rsi | ||
state: cart-cri | ||
- type: Icon | ||
sprite: _CorvaxNext/Objects/Devices/cartridge.rsi | ||
state: cart-cri | ||
- type: UIFragment | ||
ui: !type:SecWatchUi | ||
- type: Cartridge | ||
programName: sec-watch-program-name | ||
icon: | ||
sprite: Objects/Weapons/Melee/stunbaton.rsi | ||
state: stunbaton_on | ||
- type: SecWatchCartridge |
Binary file added
BIN
+2.91 KB
Resources/Textures/_CorvaxNext/Objects/Devices/cartridge.rsi/cart-cri.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions
14
Resources/Textures/_CorvaxNext/Objects/Devices/cartridge.rsi/meta.json
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,14 @@ | ||
{ | ||
"version": 1, | ||
"license": "CC-BY-SA-3.0", | ||
"copyright": "Timfa, plus edits by portfiend", | ||
"size": { | ||
"x": 32, | ||
"y": 32 | ||
}, | ||
"states": [ | ||
{ | ||
"name": "cart-cri" | ||
} | ||
] | ||
} |