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:
@@ -1,9 +0,0 @@
|
||||
using Content.Shared.GPS;
|
||||
|
||||
namespace Content.Client.GPS.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed partial class HandheldGPSComponent : SharedHandheldGPSComponent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Client.GPS.Components;
|
||||
using Content.Shared.GPS.Components;
|
||||
using Content.Client.GPS.UI;
|
||||
using Content.Client.Items;
|
||||
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ namespace Content.Server.Entry
|
||||
"GuideHelp",
|
||||
"Clickable",
|
||||
"Icon",
|
||||
"HandheldGPS",
|
||||
"CableVisualizer",
|
||||
"SolutionItemStatus",
|
||||
"UIFragment",
|
||||
|
||||
10
Content.Shared/GPS/Components/HandheldGPSComponent.cs
Normal file
10
Content.Shared/GPS/Components/HandheldGPSComponent.cs
Normal 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;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
namespace Content.Shared.GPS
|
||||
{
|
||||
public abstract partial class SharedHandheldGPSComponent : Component
|
||||
{
|
||||
[DataField("updateRate")]
|
||||
public float UpdateRate = 1.5f;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ 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
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
- id: RubberStampApproved
|
||||
- id: RubberStampDenied
|
||||
- id: RubberStampQm
|
||||
- id: AstroNavCartridge
|
||||
|
||||
- type: entity
|
||||
id: LockerQuarterMasterFilled
|
||||
|
||||
@@ -116,3 +116,22 @@
|
||||
- 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
|
||||
|
||||
@@ -400,6 +400,13 @@
|
||||
accentVColor: "#8900c9"
|
||||
- type: Icon
|
||||
state: pda-miner
|
||||
- type: CartridgeLoader
|
||||
uiKey: enum.PdaUiKey.Key
|
||||
preinstalled:
|
||||
- CrewManifestCartridge
|
||||
- NotekeeperCartridge
|
||||
- NewsReaderCartridge
|
||||
- AstroNavCartridge
|
||||
|
||||
- type: entity
|
||||
parent: BasePDA
|
||||
|
||||
BIN
Resources/Textures/Objects/Devices/cartridge.rsi/cart-nav.png
Normal file
BIN
Resources/Textures/Objects/Devices/cartridge.rsi/cart-nav.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 300 B |
@@ -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)",
|
||||
"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"
|
||||
},
|
||||
@@ -79,9 +85,6 @@
|
||||
{
|
||||
"name": "cart-y"
|
||||
},
|
||||
{
|
||||
"name": "cart-sec"
|
||||
},
|
||||
{
|
||||
"name": "insert_overlay"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user