mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* Make StationRecords YAML savable * Update SharedStationRecordsSystem.cs * Predict Station Records * Attribute subs, query Resolve & DirtyFields * Cleanup, prediction fixes, locale fixes * Update GeneralRecordsUi.cs Remove GeneralStationRecordConsoleState and obsolete SelectStationRecord
46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
using Content.Shared.Station;
|
|
using Content.Shared.StationRecords.Components;
|
|
using Content.Shared.StationRecords.Events;
|
|
|
|
namespace Content.Shared.StationRecords.Systems;
|
|
|
|
public abstract partial class SharedGeneralStationRecordConsoleSystem : EntitySystem
|
|
{
|
|
[Dependency] protected SharedStationSystem StationSys = default!;
|
|
[Dependency] protected StationRecordsSystem StationRecordsSys = default!;
|
|
|
|
[Dependency] protected EntityQuery<StationRecordsComponent> RecordsQuery = default!;
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnRecordModified(Entity<GeneralStationRecordConsoleComponent> ent, ref RecordModifiedEvent args)
|
|
{
|
|
UpdateUserInterface(ent);
|
|
}
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnGeneralRecordCreated(Entity<GeneralStationRecordConsoleComponent> ent, ref GeneralRecordCreatedEvent args)
|
|
{
|
|
UpdateUserInterface(ent);
|
|
}
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnRecordRemoved(Entity<GeneralStationRecordConsoleComponent> ent, ref RecordRemovedEvent args)
|
|
{
|
|
UpdateUserInterface(ent);
|
|
}
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnRecordDelete(Entity<GeneralStationRecordConsoleComponent> ent, ref DeleteStationRecord args)
|
|
{
|
|
if (!ent.Comp.CanDeleteEntries)
|
|
return;
|
|
|
|
var owning = StationSys.GetOwningStation(ent.Owner);
|
|
if (owning != null)
|
|
StationRecordsSys.RemoveRecord(new StationRecordKey(args.Id, owning.Value));
|
|
|
|
UpdateUserInterface(ent);
|
|
}
|
|
|
|
protected virtual void UpdateUserInterface(Entity<GeneralStationRecordConsoleComponent> ent) { }
|
|
}
|