AstroNav GPS Cartridge (#32194)

* initial commit

* adds astronav cartridge to QM locker

* changes requested in review

* fix merge conflicts

* fixes the statuscontrol disappearing if you eject the cartridge but still have it installed

* fix notificationsenabled on salv pda proto

* fixes lingering statuscontrol on eject while held

---------

Co-authored-by: archrbx <punk.gear5260@fastmail.com>
This commit is contained in:
ArchRBX 2024-09-24 18:02:51 +01:00 committed by deltanedas
parent 850c5d76ad
commit 726ad01ccd
14 changed files with 152 additions and 25 deletions

View File

@ -1,9 +0,0 @@
using Content.Shared.GPS;
namespace Content.Client.GPS.Components
{
[RegisterComponent]
public sealed partial class HandheldGPSComponent : SharedHandheldGPSComponent
{
}
}

View File

@ -1,4 +1,4 @@
using Content.Client.GPS.Components;
using Content.Shared.GPS.Components;
using Content.Client.GPS.UI;
using Content.Client.Items;

View File

@ -1,4 +1,4 @@
using Content.Client.GPS.Components;
using Content.Shared.GPS.Components;
using Content.Client.Message;
using Content.Client.Stylesheets;
using Robust.Client.GameObjects;
@ -30,6 +30,13 @@ public sealed class HandheldGpsStatusControl : Control
{
base.FrameUpdate(args);
// don't display the label if the gps component is being removed
if (_parent.Comp.LifeStage > ComponentLifeStage.Running)
{
_label.Visible = false;
return;
}
_updateDif += args.DeltaSeconds;
if (_updateDif < _parent.Comp.UpdateRate)
return;
@ -44,9 +51,9 @@ public sealed class HandheldGpsStatusControl : Control
var posText = "Error";
if (_entMan.TryGetComponent(_parent, out TransformComponent? transComp))
{
var pos = _transform.GetMapCoordinates(_parent.Owner, xform: transComp);
var x = (int) pos.X;
var y = (int) pos.Y;
var pos = _transform.GetMapCoordinates(_parent.Owner, xform: transComp);
var x = (int)pos.X;
var y = (int)pos.Y;
posText = $"({x}, {y})";
}
_label.SetMarkup(Loc.GetString("handheld-gps-coordinates-title", ("coordinates", posText)));

View File

@ -0,0 +1,9 @@
using Content.Shared.CartridgeLoader.Cartridges;
using Content.Shared.GPS;
namespace Content.Server.CartridgeLoader.Cartridges;
[RegisterComponent]
public sealed partial class AstroNavCartridgeComponent : Component
{
}

View File

@ -0,0 +1,32 @@
using Content.Shared.CartridgeLoader;
using Content.Shared.CartridgeLoader.Cartridges;
using Content.Shared.GPS.Components;
namespace Content.Server.CartridgeLoader.Cartridges;
public sealed class AstroNavCartridgeSystem : EntitySystem
{
[Dependency] private readonly CartridgeLoaderSystem _cartridgeLoaderSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AstroNavCartridgeComponent, CartridgeAddedEvent>(OnCartridgeAdded);
SubscribeLocalEvent<AstroNavCartridgeComponent, CartridgeRemovedEvent>(OnCartridgeRemoved);
}
private void OnCartridgeAdded(Entity<AstroNavCartridgeComponent> ent, ref CartridgeAddedEvent args)
{
EnsureComp<HandheldGPSComponent>(args.Loader);
}
private void OnCartridgeRemoved(Entity<AstroNavCartridgeComponent> ent, ref CartridgeRemovedEvent args)
{
// only remove when the program itself is removed
if (!_cartridgeLoaderSystem.HasProgram<AstroNavCartridgeComponent>(args.Loader))
{
RemComp<HandheldGPSComponent>(args.Loader);
}
}
}

View File

@ -12,7 +12,6 @@ namespace Content.Server.Entry
"GuideHelp",
"Clickable",
"Icon",
"HandheldGPS",
"CableVisualizer",
"SolutionItemStatus",
"UIFragment",

View File

@ -0,0 +1,10 @@
using Robust.Shared.GameStates;
namespace Content.Shared.GPS.Components;
[RegisterComponent, NetworkedComponent]
public sealed partial class HandheldGPSComponent : Component
{
[DataField]
public float UpdateRate = 1.5f;
}

View File

@ -1,9 +0,0 @@
namespace Content.Shared.GPS
{
public abstract partial class SharedHandheldGPSComponent : Component
{
[DataField("updateRate")]
public float UpdateRate = 1.5f;
}
}

View File

@ -19,3 +19,34 @@ log-probe-scan = Downloaded logs from {$device}!
log-probe-label-time = Time
log-probe-label-accessor = Accessed by
log-probe-label-number = #
astro-nav-program-name = AstroNav
# Wanted list cartridge
wanted-list-program-name = Wanted list
wanted-list-label-no-records = It's all right, cowboy
wanted-list-search-placeholder = Search by name and status
wanted-list-age-label = [color=darkgray]Age:[/color] [color=white]{$age}[/color]
wanted-list-job-label = [color=darkgray]Job:[/color] [color=white]{$job}[/color]
wanted-list-species-label = [color=darkgray]Species:[/color] [color=white]{$species}[/color]
wanted-list-gender-label = [color=darkgray]Gender:[/color] [color=white]{$gender}[/color]
wanted-list-reason-label = [color=darkgray]Reason:[/color] [color=white]{$reason}[/color]
wanted-list-unknown-reason-label = unknown reason
wanted-list-initiator-label = [color=darkgray]Initiator:[/color] [color=white]{$initiator}[/color]
wanted-list-unknown-initiator-label = unknown initiator
wanted-list-status-label = [color=darkgray]status:[/color] {$status ->
[suspected] [color=yellow]suspected[/color]
[wanted] [color=red]wanted[/color]
[detained] [color=#b18644]detained[/color]
[paroled] [color=green]paroled[/color]
[discharged] [color=green]discharged[/color]
*[other] none
}
wanted-list-history-table-time-col = Time
wanted-list-history-table-reason-col = Crime
wanted-list-history-table-initiator-col = Initiator

View File

@ -19,6 +19,7 @@
- id: RubberStampApproved
- id: RubberStampDenied
- id: RubberStampQm
- id: AstroNavCartridge
- type: entity
id: LockerQuarterMasterFilled

View File

@ -93,3 +93,46 @@
- type: GuideHelp
guides:
- Forensics
# DeltaV: this is replaced by SecWatch, the commit additing it isn't included
#- type: entity
# parent: BaseItem
# id: WantedListCartridge
# name: Wanted list cartridge
# description: A program to get a list of wanted persons.
# components:
# - type: Sprite
# sprite: Objects/Devices/cartridge.rsi
# state: cart-sec
# - type: Icon
# sprite: Objects/Devices/cartridge.rsi
# state: cart-sec
# - type: UIFragment
# ui: !type:WantedListUi
# - type: Cartridge
# programName: wanted-list-program-name
# icon:
# sprite: Objects/Misc/books.rsi
# state: icon_magnifier
# - type: WantedListCartridge
# - type: StealTarget
# stealGroup: WantedListCartridge
- type: entity
parent: BaseItem
id: AstroNavCartridge
name: AstroNav cartridge
description: A program for navigation that provides GPS coordinates.
components:
- type: Sprite
sprite: Objects/Devices/cartridge.rsi
state: cart-nav
- type: Icon
sprite: Objects/Devices/cartridge.rsi
state: cart-nav
- type: Cartridge
programName: astro-nav-program-name
icon:
sprite: Objects/Devices/gps.rsi
state: icon
- type: AstroNavCartridge

View File

@ -426,6 +426,13 @@
accentVColor: "#8900c9"
- type: Icon
state: pda-miner
- type: CartridgeLoader
uiKey: enum.PdaUiKey.Key
preinstalled:
- CrewManifestCartridge
- NotekeeperCartridge
- NewsReaderCartridge
- AstroNavCartridge
- type: entity
parent: BasePDA

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

View File

@ -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)",
"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 made by ArchRBX (github)",
"size": {
"x": 32,
"y": 32
@ -58,6 +58,9 @@
{
"name": "cart-mi"
},
{
"name": "cart-nav"
},
{
"name": "cart-ord"
},
@ -70,6 +73,9 @@
{
"name": "cart-s"
},
{
"name": "cart-sec"
},
{
"name": "cart-tear"
},