Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
PDA Programs in Loadout (new-frontiers-14#2287)
Browse files Browse the repository at this point in the history
* PDA

* Comments

* Update cartridges.yml

* CartridgeLoader: auto-install & disposable fixes

* 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 <[email protected]>

* MedTek Cartridge (#32450)

* initial commit

* adds cartridge to cmo's locker

* tidies up yml, adds default scanner sound, makes it so the silent property silences the scanner sound too

* fixes ert medic pda not having it preinstalled

* adds attribution

* removes redundant dependencies

* fix agent pda

---------

Co-authored-by: archrbx <[email protected]>

* Fix

* NFJanitor

* Update silence.ogg

* PDA

* Update pda.yml

* Update cartridges.yml

* Update cartridges.yml

* Added admin PDA

* Update pda.yml

* PDA review pass

* NFMobAGhostGear fix

* fix Admin PDA cartridge references

---------

Co-authored-by: Whatstone <[email protected]>
Co-authored-by: ArchRBX <[email protected]>
Co-authored-by: archrbx <[email protected]>
  • Loading branch information
4 people authored Oct 20, 2024
1 parent 33511ae commit 4fa2db9
Show file tree
Hide file tree
Showing 51 changed files with 525 additions and 221 deletions.
9 changes: 0 additions & 9 deletions Content.Client/GPS/Components/HandheldGPSComponent.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Content.Client/GPS/Systems/HandheldGpsSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Client.GPS.Components;
using Content.Shared.GPS.Components;
using Content.Client.GPS.UI;
using Content.Client.Items;

Expand Down
15 changes: 11 additions & 4 deletions Content.Client/GPS/UI/HandheldGpsStatusControl.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -30,6 +30,13 @@ protected override void FrameUpdate(FrameEventArgs args)
{
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;
Expand All @@ -44,9 +51,9 @@ private void UpdateGpsDetails()
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)));
Expand Down
12 changes: 12 additions & 0 deletions Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ public bool InstallProgram(EntityUid loaderUid, string prototype, bool deinstall

RaiseLocalEvent(installedProgram, new CartridgeAddedEvent(loaderUid));
UpdateUserInterfaceState(loaderUid, loader);

if (cartridge.Readonly) // Frontier: Block uninstall
cartridge.InstallationStatus = InstallationStatus.Readonly; // Frontier

if (cartridge.Disposable) // Frontier: Delete the cartridge after install if its disposable.
QueueDel(loader.CartridgeSlot.ContainerSlot!.ContainedEntity); // Frontier

return true;
}

Expand Down Expand Up @@ -343,6 +350,11 @@ protected override void OnItemInserted(EntityUid uid, CartridgeLoaderComponent l
if (TryComp(args.Entity, out CartridgeComponent? cartridge))
cartridge.LoaderUid = uid;

// Frontier: Try to auto install the program when inserted, QOL
if (cartridge != null && cartridge.AutoInstall)
InstallCartridge(uid, args.Entity, loader);
// End Frontier

RaiseLocalEvent(args.Entity, new CartridgeAddedEvent(uid));
base.OnItemInserted(uid, loader, args);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
{
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Content.Server.CartridgeLoader.Cartridges;

[RegisterComponent]
public sealed partial class MedTekCartridgeComponent : Component
{
}
31 changes: 31 additions & 0 deletions Content.Server/CartridgeLoader/Cartridges/MedTekCartridgeSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Content.Server.Medical.Components;
using Content.Shared.CartridgeLoader;

namespace Content.Server.CartridgeLoader.Cartridges;

public sealed class MedTekCartridgeSystem : EntitySystem
{
[Dependency] private readonly CartridgeLoaderSystem _cartridgeLoaderSystem = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<MedTekCartridgeComponent, CartridgeAddedEvent>(OnCartridgeAdded);
SubscribeLocalEvent<MedTekCartridgeComponent, CartridgeRemovedEvent>(OnCartridgeRemoved);
}

private void OnCartridgeAdded(Entity<MedTekCartridgeComponent> ent, ref CartridgeAddedEvent args)
{
var healthAnalyzer = EnsureComp<HealthAnalyzerComponent>(args.Loader);
}

private void OnCartridgeRemoved(Entity<MedTekCartridgeComponent> ent, ref CartridgeRemovedEvent args)
{
// only remove when the program itself is removed
if (!_cartridgeLoaderSystem.HasProgram<MedTekCartridgeComponent>(args.Loader))
{
RemComp<HealthAnalyzerComponent>(args.Loader);
}
}
}
1 change: 0 additions & 1 deletion Content.Server/Entry/IgnoredComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public static class IgnoredComponents
"GuideHelp",
"Clickable",
"Icon",
"HandheldGPS",
"CableVisualizer",
"SolutionItemStatus",
"UIFragment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public sealed partial class HealthAnalyzerComponent : Component
/// Sound played on scanning end
/// </summary>
[DataField]
public SoundSpecifier? ScanningEndSound;
public SoundSpecifier ScanningEndSound = new SoundPathSpecifier("/Audio/Items/Medical/healthscanner.ogg");

/// <summary>
/// Whether to show up the popup
Expand Down
5 changes: 2 additions & 3 deletions Content.Server/Medical/HealthAnalyzerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
using Content.Shared.MedicalScanner;
using Content.Shared.Mobs.Components;
using Content.Shared.Popups;
using Content.Shared.PowerCell;
using Robust.Server.GameObjects;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Player;
using Robust.Shared.Timing;

namespace Content.Server.Medical;
Expand Down Expand Up @@ -104,7 +102,8 @@ private void OnDoAfter(Entity<HealthAnalyzerComponent> uid, ref HealthAnalyzerDo
if (args.Handled || args.Cancelled || args.Target == null || !_cell.HasDrawCharge(uid, user: args.User))
return;

_audio.PlayPvs(uid.Comp.ScanningEndSound, uid);
if (!uid.Comp.Silent)
_audio.PlayPvs(uid.Comp.ScanningEndSound, uid);

OpenUserInterface(args.User, uid);
BeginAnalyzingEntity(uid, args.Target.Value);
Expand Down
20 changes: 19 additions & 1 deletion Content.Shared/CartridgeLoader/CartridgeComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Robust.Shared.GameStates;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;

Expand All @@ -21,6 +21,24 @@ public sealed partial class CartridgeComponent : Component

[AutoNetworkedField]
public InstallationStatus InstallationStatus = InstallationStatus.Cartridge;

/// <summary>
/// Frontier: This is used for onetime use programs
/// </summary>
[DataField]
public bool Disposable = false;

/// <summary>
/// Frontier: This is used to auto install on insert
/// </summary>
[DataField]
public bool AutoInstall = false;

/// <summary>
/// Frontier: Block uninstall
/// </summary>
[DataField]
public bool Readonly = false;
}

[Serializable, NetSerializable]
Expand Down
4 changes: 2 additions & 2 deletions Content.Shared/CartridgeLoader/CartridgeLoaderComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Containers.ItemSlots;
using Robust.Shared.GameStates;

namespace Content.Shared.CartridgeLoader;
Expand Down Expand Up @@ -33,7 +33,7 @@ public sealed partial class CartridgeLoaderComponent : Component
/// The maximum amount of programs that can be installed on the cartridge loader entity
/// </summary>
[DataField]
public int DiskSpace = 5;
public int DiskSpace = 10; // Frontier 5<10

/// <summary>
/// Controls whether the cartridge loader will play notifications if it supports it at all
Expand Down
10 changes: 10 additions & 0 deletions Content.Shared/GPS/Components/HandheldGPSComponent.cs
Original file line number Diff line number Diff line change
@@ -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;
}
9 changes: 0 additions & 9 deletions Content.Shared/Tools/Components/SharedHandheldGPSComponent.cs

This file was deleted.

Binary file modified Resources/Audio/_NF/Effects/silence.ogg
Binary file not shown.
2 changes: 1 addition & 1 deletion Resources/Locale/en-US/_NF/cartridge-loader/cartridges.ftl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Appraisal cartridge
appraisal-program-name = Appraisal App Plus
appraisal-program-name = AppraiseAll Plus
appraisal-label-name = Item
appraisal-label-price = Appraised Price
3 changes: 2 additions & 1 deletion Resources/Locale/en-US/_NF/preferences/loadout-groups.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ loadout-group-contractor-face = mask
loadout-group-contractor-utility = tools
loadout-group-contractor-fun = fun
loadout-group-contractor-trinkets = trinkets
loadout-group-contractor-survival-box = survival box
loadout-group-contractor-encryption-key = encryption keys
loadout-group-contractor-survival-box = survival box
loadout-group-contractor-cartridge = PDA cartridges
loadout-group-contractor-implanter = implanters
loadout-group-contractor-bureaucracy = bureaucracy
4 changes: 4 additions & 0 deletions Resources/Locale/en-US/cartridge-loader/cartridges.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ log-probe-label-time = Time
log-probe-label-accessor = Accessed by
log-probe-label-number = #
astro-nav-program-name = AstroNav
med-tek-program-name = MedTek
# Wanted list cartridge
wanted-list-program-name = Wanted list
wanted-list-label-no-records = It's all right, cowboy
Expand Down
2 changes: 1 addition & 1 deletion Resources/Maps/_NF/Outpost/frontier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32151,7 +32151,7 @@ entities:
- type: Transform
pos: -5.5,1.5
parent: 2173
- proto: SpawnPointJanitor
- proto: NFSpawnPointJanitor
entities:
- uid: 2099
components:
Expand Down
2 changes: 1 addition & 1 deletion Resources/Maps/_NF/Test/dev_map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6843,7 +6843,7 @@ entities:
- type: Transform
pos: -3.5,2.5
parent: 179
- proto: SpawnPointJanitor
- proto: NFSpawnPointJanitor
entities:
- uid: 1488
components:
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Catalog/Fills/Lockers/heads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
# - id: MedicalTechFabCircuitboard # Frontier - bloat
# - id: MedkitFilled # Frontier - bloat
- id: RubberStampCMO
- id: MedTekCartridge

# Hardsuit table, used for suit storage as well
- type: entityTable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# - type: entity # Frontier - Not Merged yet
# parent: BaseItem
# parent: NFBasePDACartridge
# id: CrimeAssistCartridge
# name: crime assist cartridge
# description: A cartridge that helps identify crimes and see appropriate punishment.
Expand All @@ -18,29 +18,8 @@
# sprite: DeltaV/Icons/cri.rsi
# state: cri

# - type: entity # Frontier - Not Merged yet
# parent: BaseItem
# id: SecWatchCartridge
# name: sec watch cartridge
# description: A cartridge that tracks the status of currently wanted individuals.
# components:
# - type: Sprite
# sprite: DeltaV/Objects/Devices/cartridge.rsi
# state: cart-cri
# - type: Icon
# sprite: DeltaV/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

- type: entity
parent: BaseItem
parent: NFBasePDACartridge
id: MailMetricsCartridge
name: mail metrics cartridge
description: A cartridge that tracks statistics related to mail deliveries.
Expand All @@ -59,3 +38,4 @@
icon:
sprite: Nyanotrasen/Objects/Specific/Mail/mail.rsi
state: icon
readonly: true # Frontier
13 changes: 6 additions & 7 deletions Resources/Prototypes/DeltaV/Entities/Objects/Devices/pda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
- type: Icon
sprite: _NF/Objects/Devices/pda.rsi # Frontier - DeltaV/Objects/Devices/pda.rsi<_NF/Objects/Devices/pda.rsi
state: pda-mailcarrier
- type: CartridgeLoader # DeltaV - Courier Performance
preinstalled:
- CrewManifestCartridge
- NotekeeperCartridge
- NewsReaderCartridge
- BountyContractsCartridge
- MailMetricsCartridge
# - type: CartridgeLoader # DeltaV - Courier Performance # Frontier - pushed to cartridge loadouts
# preinstalled:
# - CrewManifestCartridge
# - NotekeeperCartridge
# - NewsReaderCartridge
# - MailMetricsCartridge
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Markers/Spawners/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@
id: SpawnPointJanitor
parent: SpawnPointJobBase
name: janitor
categories: [ HideSpawnMenu ] # Frontier
components:
- type: SpawnPoint
job_id: Janitor
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
- type: Inventory
templateId: aghost
- type: Loadout
prototypes: [ MobAghostGear ]
prototypes: [ NFMobAghostGear ] # Frontier MobAghostGear<NFMobAghostGear
- type: BypassInteractionChecks
- type: BankAccount # Frontier

Expand Down
Loading

0 comments on commit 4fa2db9

Please sign in to comment.