Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Psionics Registry Computer, PsiWatch, and Epi-Glasses/Epi-HUD #1598

Merged
merged 20 commits into from
Jan 20, 2025
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
39ca830
Add everything for psionics except equipment.
CerberusWolfie Jan 19, 2025
e901437
Add glasses (which currently don't work in-game, but they're there).
CerberusWolfie Jan 19, 2025
24f77c8
Change reason to psionics/reason and make glasses work.
CerberusWolfie Jan 19, 2025
8984d17
Fix the image for abusing.
CerberusWolfie Jan 19, 2025
84f0336
Add cartridge and apply it to Chaplain, Mystagogue, Mantis, and Catal…
CerberusWolfie Jan 20, 2025
2c7534f
Add Loadouts.
CerberusWolfie Jan 20, 2025
1b81d2a
Add cartridge to locker.
CerberusWolfie Jan 20, 2025
b78c20b
Change the accesses required to only Chapel, Library, Mantis, and Mys…
CerberusWolfie Jan 20, 2025
4bbdc6f
Map on all maps.
CerberusWolfie Jan 20, 2025
540f089
Merge branch 'master' into PsionicsRecords
CerberusWolfie Jan 20, 2025
569850d
Fix a minor typo, lmao.
CerberusWolfie Jan 20, 2025
77dc608
Merge branch 'PsionicsRecords' of https://github.com/CerberusWolfie/E…
CerberusWolfie Jan 20, 2025
3420d1e
Merge branch 'master' into PsionicsRecords
CerberusWolfie Jan 20, 2025
01c2be5
Update psionics-records.ftl
sleepyyapril Jan 20, 2025
bf5013c
Merge branch 'master' into PsionicsRecords
sleepyyapril Jan 20, 2025
cc46b0f
Merge upstream to correct merge conflicts. Switch ComputerPsionicsRec…
CerberusWolfie Jan 20, 2025
c8feaec
I forgot to include the computers, lmao....
CerberusWolfie Jan 20, 2025
401d460
Merge branch 'PsionicsRecords' of https://github.com/CerberusWolfie/E…
CerberusWolfie Jan 20, 2025
5651dc8
Merge branch 'master' into PsionicsRecords
CerberusWolfie Jan 20, 2025
3b9a04a
Merge branch 'master' into PsionicsRecords
sleepyyapril Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add cartridge and apply it to Chaplain, Mystagogue, Mantis, and Catal…
…oguer.
  • Loading branch information
CerberusWolfie committed Jan 20, 2025
commit 84f0336c1e712b7f1de5a9d4b354fb533f762f50
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.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 'psionics-records-console-reason'}"/>
</BoxContainer>
<customControls:VSeparator StyleClasses="LowDivider" Margin="8 0"/>
<BoxContainer Orientation="Vertical">
<Label Name="Title"/>
<Label Name="Reason"/>
</BoxContainer>
</BoxContainer>
</BoxContainer>
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;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

/// <summary>
/// ADAPTED FROM SECWATCH - DELTAV
/// </summary>

namespace Content.Client.CartridgeLoader.Cartridges;

[GenerateTypedNameReferences]
public sealed partial class PsiWatchEntryControl : BoxContainer
{
public PsiWatchEntryControl(PsiWatchEntry entry)
{
RobustXamlLoader.Load(this);

Status.Text = Loc.GetString($"psionics-records-status-{entry.Status.ToString().ToLower()}");
Title.Text = Loc.GetString("psi-watch-entry", ("name", entry.Name), ("job", entry.Job));

Reason.Text = entry.Reason ?? Loc.GetString("psi-watch-no-reason");
}
}
31 changes: 31 additions & 0 deletions Content.Client/CartridgeLoader/Cartridges/PsiWatchUi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Content.Client.UserInterface.Fragments;
using Content.Shared.CartridgeLoader;
using Content.Shared.CartridgeLoader.Cartridges;
using Robust.Client.UserInterface;

/// <summary>
/// ADAPTED FROM SECWATCH - DELTAV
/// </summary>

namespace Content.Client.CartridgeLoader.Cartridges;

public sealed partial class PsiWatchUi : UIFragment
{
private PsiWatchUiFragment? _fragment;

public override Control GetUIFragmentRoot()
{
return _fragment!;
}

public override void Setup(BoundUserInterface ui, EntityUid? owner)
{
_fragment = new PsiWatchUiFragment();
}

public override void UpdateState(BoundUserInterfaceState state)
{
if (state is PsiWatchUiState cast)
_fragment?.UpdateState(cast);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<cartridges:PsiWatchUiFragment xmlns="https://spacestation14.io"
xmlns:cartridges="clr-namespace:Content.Client.CartridgeLoader.Cartridges"
Margin="5"
VerticalExpand="True">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True">
<Label Text="{Loc 'psi-watch-title'}" HorizontalExpand="True" HorizontalAlignment="Center"/>
<Label Name="NoEntries" Text="{Loc 'psi-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:PsiWatchUiFragment>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Content.Shared.CartridgeLoader.Cartridges;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

/// <summary>
/// ADAPTED FROM SECWATCH - DELTAV
/// </summary>

namespace Content.Client.CartridgeLoader.Cartridges;

[GenerateTypedNameReferences]
public sealed partial class PsiWatchUiFragment : BoxContainer
{
public PsiWatchUiFragment()
{
RobustXamlLoader.Load(this);
}

public void UpdateState(PsiWatchUiState state)
{
NoEntries.Visible = state.Entries.Count == 0;
Entries.RemoveAllChildren();
foreach (var entry in state.Entries)
{
Entries.AddChild(new PsiWatchEntryControl(entry));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Content.Shared.Psionics;

/// <summary>
/// ADAPTED FROM SECWATCH - DELTAV
/// </summary>

namespace Content.Server.CartridgeLoader.Cartridges;

[RegisterComponent, Access(typeof(PsiWatchCartridgeSystem))]
public sealed partial class PsiWatchCartridgeComponent : Component
{
/// <summary>
/// Only show people with these statuses.
/// </summary>
[DataField]
public List<PsionicsStatus> Statuses = new()
{
PsionicsStatus.Abusing,
PsionicsStatus.Registered,
PsionicsStatus.Suspected
};

/// <summary>
/// Station entity thats getting its records checked.
/// </summary>
[DataField]
public EntityUid? Station;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
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.PsionicsRecords;
using Content.Shared.StationRecords;

/// <summary>
/// ADAPTED FROM SECWATCH - DELTAV
/// </summary>

namespace Content.Server.CartridgeLoader.Cartridges;

public sealed class PsiWatchCartridgeSystem : 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<PsiWatchCartridgeComponent, 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<PsiWatchCartridgeComponent, 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<PsiWatchCartridgeComponent> ent, ref CartridgeUiReadyEvent args)
{
UpdateUI(ent, args.Loader);
}

private void UpdateUI(Entity<PsiWatchCartridgeComponent> 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<PsiWatchEntry>();
foreach (var (id, criminal) in _records.GetRecordsOfType<PsionicsRecord>(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 PsiWatchEntry(general.Name, general.JobTitle, criminal.Status, criminal.Reason));
}

var state = new PsiWatchUiState(entries);
_cartridgeLoader.UpdateCartridgeUiState(loader, state);
}
}
24 changes: 24 additions & 0 deletions Content.Shared/CartridgeLoader/Cartridges/PsiWatchUiState.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Content.Shared.Psionics;
using Robust.Shared.Serialization;

namespace Content.Shared.CartridgeLoader.Cartridges;

/// <summary>
/// Show a list of wanted and suspected people from psionics records.
/// </summary>
[Serializable, NetSerializable]
public sealed class PsiWatchUiState : BoundUserInterfaceState
{
public readonly List<PsiWatchEntry> Entries;

public PsiWatchUiState(List<PsiWatchEntry> entries)
{
Entries = entries;
}
}

/// <summary>
/// Entry for a person who is suspected, registered, or abusing.
/// </summary>
[Serializable, NetSerializable]
public record struct PsiWatchEntry(string Name, string Job, PsionicsStatus Status, string? Reason);
5 changes: 5 additions & 0 deletions Resources/Locale/en-US/cartridge-loader/psiwatch.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
psi-watch-program-name = PsiWatch
psi-watch-title = PsiWatch 1.3
psi-watch-no-entries = Nobody is registered. Why not enjoy a nice, cold brew?
psi-watch-entry = {$name}, {$job}
psi-watch-no-reason = [ERROR] No reason given?
24 changes: 23 additions & 1 deletion Resources/Prototypes/Entities/Objects/Devices/cartridges.yml
Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@
- type: Cartridge
programName: log-probe-program-name
icon:
sprite: Structures/Doors/Airlocks/Standard/security.rsi
sprite: Structures/Doors/Airlocks/Standard/psiurity.rsi
state: closed
- type: LogProbeCartridge
- type: GuideHelp
@@ -131,3 +131,25 @@
sprite: Objects/Devices/gps.rsi
state: icon
- type: AstroNavCartridge


- type: entity
parent: BaseItem
id: PsiWatchCartridge
name: psi watch cartridge
description: A cartridge that tracks the status of currently documented psionics individuals.
components:
- type: Sprite
sprite: Objects/Devices/cartridge.rsi
state: cart-psi
- type: Icon
sprite: Objects/Devices/cartridge.rsi
state: cart-psi
- type: UIFragment
ui: !type:PsiWatchUi
- type: Cartridge
programName: psi-watch-program-name
icon:
sprite: DeltaV/Structures/Machines/glimmer_machines.rsi
state: prober
- type: PsiWatchCartridge
14 changes: 14 additions & 0 deletions Resources/Prototypes/Entities/Objects/Devices/pda.yml
Original file line number Diff line number Diff line change
@@ -369,6 +369,14 @@
- type: Icon
sprite: DeltaV/Objects/Devices/pda.rsi # DeltaV - Give Chaplain PDA Epistemics colors
state: pda-chaplain
- type: CartridgeLoader # Nyanotrasen - Glimmer Monitor
preinstalled:
- CrewManifestCartridge
- NotekeeperCartridge
- NewsReaderCartridge
- GlimmerMonitorCartridge
- NanoChatCartridge # DeltaV
- PsiWatchCartridge

- type: entity
name: logistics officer PDA # DeltaV - Logistics Department replacing Cargo
@@ -500,6 +508,7 @@
- NewsReaderCartridge
- GlimmerMonitorCartridge
- NanoChatCartridge
- PsiWatchCartridge

- type: entity
parent: BasePDA
@@ -809,6 +818,7 @@
- NewsReaderCartridge
- GlimmerMonitorCartridge
- NanoChatCartridge # DeltaV
- PsiWatchCartridge

- type: entity
parent: BasePDA
@@ -832,6 +842,7 @@
- NewsReaderCartridge
- GlimmerMonitorCartridge
- NanoChatCartridge
- PsiWatchCartridge

- type: entity
parent: BasePDA
@@ -1387,6 +1398,9 @@
accentVColor: "#8900c9"
- type: Icon
state: pda-seniorresearcher
- type: CartridgeLoader
preinstalled:
- PsiWatchCartridge

- type: entity
parent: BaseMedicalPDA
Original file line number Diff line number Diff line change
@@ -122,3 +122,4 @@
- NewsReaderCartridge
- GlimmerMonitorCartridge
- NanoChatCartridge
- PsiWatchCartridge
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions Resources/Textures/Objects/Devices/cartridge.rsi/meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from vgstation at https://github.com/vgstation-coders/vgstation13/commit/1cdfb0230cc96d0ba751fa002d04f8aa2f25ad7d and tgstation at tgstation at https://github.com/tgstation/tgstation/commit/0c15d9dbcf0f2beb230eba5d9d889ef2d1945bb8, cart-log made by Skarletto (github), cart-sec made by dieselmohawk (discord), cart-nav, cart-med made by ArchRBX (github)",
"copyright": "Taken from vgstation at https://github.com/vgstation-coders/vgstation13/commit/1cdfb0230cc96d0ba751fa002d04f8aa2f25ad7d and tgstation at tgstation at https://github.com/tgstation/tgstation/commit/0c15d9dbcf0f2beb230eba5d9d889ef2d1945bb8, cart-log made by Skarletto (github), cart-sec made by dieselmohawk (discord), cart-nav, cart-med made by ArchRBX (github), cart-psi made by CerberusWolfie (github/discord)",
"size": {
"x": 32,
"y": 32
@@ -81,6 +81,9 @@
},
{
"name": "cart-med"
},
{
"name": "cart-psi"
}
]
}
}