]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
MedTek Cartridge (#32450)
authorArchRBX <5040911+ArchRBX@users.noreply.github.com>
Wed, 2 Oct 2024 06:17:57 +0000 (07:17 +0100)
committerGitHub <noreply@github.com>
Wed, 2 Oct 2024 06:17:57 +0000 (23:17 -0700)
* 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 <punk.gear5260@fastmail.com>
Content.Server/CartridgeLoader/Cartridges/MedTekCartridgeComponent.cs [new file with mode: 0644]
Content.Server/CartridgeLoader/Cartridges/MedTekCartridgeSystem.cs [new file with mode: 0644]
Content.Server/Medical/Components/HealthAnalyzerComponent.cs
Content.Server/Medical/HealthAnalyzerSystem.cs
Resources/Locale/en-US/cartridge-loader/cartridges.ftl
Resources/Prototypes/Catalog/Fills/Lockers/heads.yml
Resources/Prototypes/Entities/Objects/Devices/cartridges.yml
Resources/Prototypes/Entities/Objects/Devices/pda.yml
Resources/Textures/Objects/Devices/cartridge.rsi/cart-med.png [new file with mode: 0644]
Resources/Textures/Objects/Devices/cartridge.rsi/meta.json

diff --git a/Content.Server/CartridgeLoader/Cartridges/MedTekCartridgeComponent.cs b/Content.Server/CartridgeLoader/Cartridges/MedTekCartridgeComponent.cs
new file mode 100644 (file)
index 0000000..1a49b4d
--- /dev/null
@@ -0,0 +1,6 @@
+namespace Content.Server.CartridgeLoader.Cartridges;
+
+[RegisterComponent]
+public sealed partial class MedTekCartridgeComponent : Component
+{
+}
diff --git a/Content.Server/CartridgeLoader/Cartridges/MedTekCartridgeSystem.cs b/Content.Server/CartridgeLoader/Cartridges/MedTekCartridgeSystem.cs
new file mode 100644 (file)
index 0000000..4d1b71d
--- /dev/null
@@ -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);
+        }
+    }
+}
index 85956b60299bac13175db359421f15a1091dc467..34b7af0212dd878157f6e60b913e18b9326a002a 100644 (file)
@@ -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
index 82f8075902821854aeccff2479773b0f97470f33..60a492a755fe0a6d1451fba85a42101559cbe2f9 100644 (file)
@@ -13,11 +13,9 @@ using Content.Shared.Item.ItemToggle.Components;
 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;
@@ -104,7 +102,8 @@ public sealed class HealthAnalyzerSystem : EntitySystem
         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);
index 804da0992fa3b78212c489b3490695cc7098bdad..ceeac1be3c975147e37f6c023dc1d4299eabbafb 100644 (file)
@@ -22,6 +22,8 @@ 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
index 2ca2b0f740468cdd2ba12a8fb8f7c160fe232ada..82660f8f13abb73843c12dfdfbdfb28217395629 100644 (file)
     - id: MedicalTechFabCircuitboard
     - id: MedkitFilled
     - id: RubberStampCMO
+    - id: MedTekCartridge
 
 # Hardsuit table, used for suit storage as well
 - type: entityTable
index aee26b0776985de8752c67c0c2d6cadbe78a4fa2..0ab0b687dcf2d7a38e2b72dc1a39600a3c5b9dfc 100644 (file)
   - type: StealTarget
     stealGroup: WantedListCartridge
 
+- type: entity
+  parent: BaseItem
+  id: MedTekCartridge
+  name: MedTek cartridge
+  description: A program that provides medical diagnostic tools.
+  components:
+    - type: Sprite
+      sprite: Objects/Devices/cartridge.rsi
+      state: cart-med
+    - type: Icon
+      sprite: Objects/Devices/cartridge.rsi
+      state: cart-med
+    - type: Cartridge
+      programName: med-tek-program-name
+      icon:
+        sprite: Objects/Specific/Medical/healthanalyzer.rsi
+        state: icon
+    - type: MedTekCartridge
+
 - type: entity
   parent: BaseItem
   id: AstroNavCartridge
index c6952fdd6aa217e61c0d21bd533e50cfcfae08fe..dfc1c6fa5bed97bb6a50e162d023eae6b47b156d 100644 (file)
   id: BaseMedicalPDA
   abstract: true
   components:
-  - type: ItemToggle
-    onUse: false
-  - type: HealthAnalyzer
-    scanDelay: 1
-    scanningEndSound:
-      path: "/Audio/Items/Medical/healthscanner.ogg"
+  - type: CartridgeLoader
+    uiKey: enum.PdaUiKey.Key
+    preinstalled:
+      - CrewManifestCartridge
+      - NotekeeperCartridge
+      - NewsReaderCartridge
+      - MedTekCartridge
 
 - type: entity
   parent: BasePDA
   parent: BaseMedicalPDA
   id: MedicalInternPDA
   name: medical intern PDA
-  description: Why isn't it white? Has a built-in health analyzer.
+  description: Why isn't it white?
   components:
   - type: Pda
     id: MedicalInternIDCard
   parent: BaseMedicalPDA
   id: CMOPDA
   name: chief medical officer PDA
-  description: Extraordinarily shiny and sterile. Has a built-in health analyzer.
+  description: Extraordinarily shiny and sterile.
   components:
   - type: Pda
     id: CMOIDCard
   parent: BaseMedicalPDA
   id: MedicalPDA
   name: medical PDA
-  description: Shiny and sterile. Has a built-in health analyzer.
+  description: Shiny and sterile.
   components:
   - type: Pda
     id: MedicalIDCard
   parent: BaseMedicalPDA
   id: ParamedicPDA
   name: paramedic PDA
-  description: Shiny and sterile. Has a built-in rapid health analyzer.
+  description: Shiny and sterile.
   components:
   - type: Pda
     id: ParamedicIDCard
   id: ERTMedicPDA
   name: ERT Medic PDA
   suffix: Medic
-  description: Red for firepower, it's shiny and sterile. Has a built-in rapid health analyzer.
+  description: Red for firepower, it's shiny and sterile.
   components:
   - type: Pda
     id: ERTMedicIDCard
-  - type: HealthAnalyzer
-    scanDelay: 1
-    scanningEndSound:
-      path: "/Audio/Items/Medical/healthscanner.ogg"
+  - type: CartridgeLoader
+    uiKey: enum.PdaUiKey.Key
+    preinstalled:
+      - CrewManifestCartridge
+      - NotekeeperCartridge
+      - NewsReaderCartridge
+      - MedTekCartridge
+      - WantedListCartridge
 
 - type: entity
   parent: ERTLeaderPDA
   parent: BaseMedicalPDA
   id: BrigmedicPDA
   name: brigmedic PDA
-  description: I wonder whose pulse is on the screen? I hope he doesnt stop... PDA has a built-in health analyzer.
+  description: I wonder whose pulse is on the screen? I hope it doesn't stop...
   components:
   - type: Pda
     id: BrigmedicIDCard
   parent: BaseMedicalPDA
   id: SeniorPhysicianPDA
   name: senior physician PDA
-  description: Smells faintly like iron and chemicals. Has a built-in health analyzer.
+  description: Smells faintly like iron and chemicals.
   components:
   - type: Pda
     id: SeniorPhysicianIDCard
     uiKey: enum.PdaUiKey.Key
     preinstalled:
       - NotekeeperCartridge
+      - MedTekCartridge
     cartridgeSlot:
       priority: -1
       name: Cartridge
diff --git a/Resources/Textures/Objects/Devices/cartridge.rsi/cart-med.png b/Resources/Textures/Objects/Devices/cartridge.rsi/cart-med.png
new file mode 100644 (file)
index 0000000..69be9eb
Binary files /dev/null and b/Resources/Textures/Objects/Devices/cartridge.rsi/cart-med.png differ
index e7415fe1c271c5e7a722018c522da3494a43c8e2..b79f46d08db63f21ffc1ad3f493ae258583f7ef7 100644 (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), cart-sec made by dieselmohawk (discord), cart-nav 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)",
   "size": {
     "x": 32,
     "y": 32
@@ -55,6 +55,9 @@
     {
       "name": "cart-m"
     },
+    {
+      "name": "cart-med"
+    },
     {
       "name": "cart-mi"
     },