]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Portable Recharger: Arsenal T3 (#26655)
authoricekot8 <93311212+icekot8@users.noreply.github.com>
Sun, 28 Apr 2024 03:19:33 +0000 (06:19 +0300)
committerGitHub <noreply@github.com>
Sun, 28 Apr 2024 03:19:33 +0000 (13:19 +1000)
* sys

* item

* ahm.

* Update Content.Server/Power/Components/ChargerComponent.cs

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
12 files changed:
Content.Server/Power/Components/ChargerComponent.cs
Content.Server/Power/EntitySystems/ChargerSystem.cs
Resources/Prototypes/Entities/Objects/Power/portable_recharger.yml [new file with mode: 0644]
Resources/Prototypes/Entities/Structures/Machines/lathe.yml
Resources/Prototypes/Recipes/Lathes/security.yml
Resources/Prototypes/Research/arsenal.yml
Resources/Textures/Objects/Power/portable_recharger.rsi/charging-equipped-BACKPACK.png [new file with mode: 0644]
Resources/Textures/Objects/Power/portable_recharger.rsi/charging-unlit.png [new file with mode: 0644]
Resources/Textures/Objects/Power/portable_recharger.rsi/charging.png [new file with mode: 0644]
Resources/Textures/Objects/Power/portable_recharger.rsi/inhand-left.png [new file with mode: 0644]
Resources/Textures/Objects/Power/portable_recharger.rsi/inhand-right.png [new file with mode: 0644]
Resources/Textures/Objects/Power/portable_recharger.rsi/meta.json [new file with mode: 0644]

index af4498f01bae6309a93198125ca7ef46bd8f84cc..e45ded071cfd9444221b13bd7b9441ea327eb1be 100644 (file)
@@ -1,5 +1,10 @@
 using Content.Shared.Power;
 using Content.Shared.Whitelist;
+using Content.Shared.Power;
+using Content.Shared.Whitelist;
+using Robust.Shared.GameObjects;
+using Robust.Shared.Serialization.Manager.Attributes;
+using Robust.Shared.ViewVariables;
 
 namespace Content.Server.Power.Components
 {
@@ -26,5 +31,12 @@ namespace Content.Server.Power.Components
         /// </summary>
         [DataField("whitelist")]
         public EntityWhitelist? Whitelist;
+
+        /// <summary>
+        /// Indicates whether the charger is portable and thus subject to EMP effects
+        /// and bypasses checks for transform, anchored, and ApcPowerReceiverComponent.
+        /// </summary>
+        [DataField]
+        public bool Portable = false;
     }
 }
index db16dfa008e3d384ec349da8bb6110a0ea4a97b0..1ff13a24f2c31463025f79fec3a35f603de08cc9 100644 (file)
@@ -1,8 +1,10 @@
 using Content.Server.Power.Components;
+using Content.Server.Emp;
 using Content.Server.PowerCell;
 using Content.Shared.Examine;
 using Content.Shared.Power;
 using Content.Shared.PowerCell.Components;
+using Content.Shared.Emp;
 using JetBrains.Annotations;
 using Robust.Shared.Containers;
 using System.Diagnostics.CodeAnalysis;
@@ -28,6 +30,8 @@ internal sealed class ChargerSystem : EntitySystem
         SubscribeLocalEvent<ChargerComponent, ContainerIsInsertingAttemptEvent>(OnInsertAttempt);
         SubscribeLocalEvent<ChargerComponent, InsertIntoEntityStorageAttemptEvent>(OnEntityStorageInsertAttempt);
         SubscribeLocalEvent<ChargerComponent, ExaminedEvent>(OnChargerExamine);
+
+        SubscribeLocalEvent<ChargerComponent, EmpPulseEvent>(OnEmpPulse);
     }
 
     private void OnStartup(EntityUid uid, ChargerComponent component, ComponentStartup args)
@@ -158,18 +162,27 @@ internal sealed class ChargerSystem : EntitySystem
         }
     }
 
+    private void OnEmpPulse(EntityUid uid, ChargerComponent component, ref EmpPulseEvent args)
+    {
+        args.Affected = true;
+        args.Disabled = true;
+    }
+
     private CellChargerStatus GetStatus(EntityUid uid, ChargerComponent component)
     {
-        if (!TryComp(uid, out TransformComponent? transformComponent))
-            return CellChargerStatus.Off;
+        if (!component.Portable)
+        {
+            if (!TryComp(uid, out TransformComponent? transformComponent) || !transformComponent.Anchored)
+                return CellChargerStatus.Off;
+        }
 
-        if (!transformComponent.Anchored)
+        if (!TryComp(uid, out ApcPowerReceiverComponent? apcPowerReceiverComponent))
             return CellChargerStatus.Off;
 
-        if (!TryComp(uid, out ApcPowerReceiverComponent? apcPowerReceiverComponent))
+        if (!component.Portable && !apcPowerReceiverComponent.Powered)
             return CellChargerStatus.Off;
 
-        if (!apcPowerReceiverComponent.Powered)
+        if (HasComp<EmpDisabledComponent>(uid))
             return CellChargerStatus.Off;
 
         if (!_container.TryGetContainer(uid, component.SlotId, out var container))
@@ -186,7 +199,7 @@ internal sealed class ChargerSystem : EntitySystem
 
         return CellChargerStatus.Charging;
     }
-
+    
     private void TransferPower(EntityUid uid, EntityUid targetEntity, ChargerComponent component, float frameTime)
     {
         if (!TryComp(uid, out ApcPowerReceiverComponent? receiverComponent))
diff --git a/Resources/Prototypes/Entities/Objects/Power/portable_recharger.yml b/Resources/Prototypes/Entities/Objects/Power/portable_recharger.yml
new file mode 100644 (file)
index 0000000..35dfa08
--- /dev/null
@@ -0,0 +1,35 @@
+- type: entity
+  parent: Clothing
+  id: PortableRecharger
+  name: portable recharger 
+  description: High-tech recharger adapted for portability
+  components:
+  - type: Item
+    size: Huge
+  - type: Sprite
+    sprite: Objects/Power/portable_recharger.rsi
+    state: charging
+  - type: Clothing
+    equippedPrefix: charging
+    quickEquip: false
+    slots:
+    - back
+  - type: Charger
+    slotId: charger_slot
+    portable: true
+  - type: PowerChargerVisuals
+  - type: ApcPowerReceiver
+    needsPower: false
+    powerLoad: 0
+  - type: StaticPrice
+    price: 500
+  - type: Tag
+    tags: [] # ignore "WhitelistChameleon" tag
+  - type: ItemSlots
+    slots:
+      charger_slot:
+        ejectOnInteract: true
+        whitelist:
+          components:
+          - HitscanBatteryAmmoProvider
+          - ProjectileBatteryAmmoProvider
\ No newline at end of file
index b237fc88ed2e25833e6cffce20c38361667153eb..2a080a85db0080076aa6ce8aa50fdf77db35c993 100644 (file)
       - WeaponLaserCannon
       - WeaponLaserCarbine
       - WeaponXrayCannon
+      - PowerCageSmall
+      - PowerCageMedium
+      - PowerCageHigh
+      - ShuttleGunSvalinnMachineGunCircuitboard
+      - ShuttleGunPerforatorCircuitboard
+      - ShuttleGunFriendshipCircuitboard
+      - ShuttleGunDusterCircuitboard
+      - PortableRecharger
   - type: MaterialStorage
     whitelist:
       tags:
index bad38fc99f498c7f6c06a49477e38c568227e6c3..2ab8e18372ed7a0f2a371b0e4e965f0694705db1 100644 (file)
      Steel: 150
      Plastic: 100
      Glass: 20
+
+- type: latheRecipe
+  id: PortableRecharger
+  result: PortableRecharger
+  completetime: 15
+  materials:
+     Steel: 2000
+     Uranium: 2000
+     Plastic: 1000
+     Plasma: 500
+     Glass: 500
\ No newline at end of file
index 2daa3fdcc0f6caaa3dc25b0359f14ae1ba662e27..6c0e94e9e5ee13732f01c2755317f118b3b3df8a 100644 (file)
   cost: 15000
   recipeUnlocks:
   - WeaponAdvancedLaser
+  - PortableRecharger
 
 - type: technology
   id: ExperimentalBatteryAmmo
diff --git a/Resources/Textures/Objects/Power/portable_recharger.rsi/charging-equipped-BACKPACK.png b/Resources/Textures/Objects/Power/portable_recharger.rsi/charging-equipped-BACKPACK.png
new file mode 100644 (file)
index 0000000..500ad05
Binary files /dev/null and b/Resources/Textures/Objects/Power/portable_recharger.rsi/charging-equipped-BACKPACK.png differ
diff --git a/Resources/Textures/Objects/Power/portable_recharger.rsi/charging-unlit.png b/Resources/Textures/Objects/Power/portable_recharger.rsi/charging-unlit.png
new file mode 100644 (file)
index 0000000..6c902b7
Binary files /dev/null and b/Resources/Textures/Objects/Power/portable_recharger.rsi/charging-unlit.png differ
diff --git a/Resources/Textures/Objects/Power/portable_recharger.rsi/charging.png b/Resources/Textures/Objects/Power/portable_recharger.rsi/charging.png
new file mode 100644 (file)
index 0000000..6105bb4
Binary files /dev/null and b/Resources/Textures/Objects/Power/portable_recharger.rsi/charging.png differ
diff --git a/Resources/Textures/Objects/Power/portable_recharger.rsi/inhand-left.png b/Resources/Textures/Objects/Power/portable_recharger.rsi/inhand-left.png
new file mode 100644 (file)
index 0000000..e3bc6d8
Binary files /dev/null and b/Resources/Textures/Objects/Power/portable_recharger.rsi/inhand-left.png differ
diff --git a/Resources/Textures/Objects/Power/portable_recharger.rsi/inhand-right.png b/Resources/Textures/Objects/Power/portable_recharger.rsi/inhand-right.png
new file mode 100644 (file)
index 0000000..8c65192
Binary files /dev/null and b/Resources/Textures/Objects/Power/portable_recharger.rsi/inhand-right.png differ
diff --git a/Resources/Textures/Objects/Power/portable_recharger.rsi/meta.json b/Resources/Textures/Objects/Power/portable_recharger.rsi/meta.json
new file mode 100644 (file)
index 0000000..794f491
--- /dev/null
@@ -0,0 +1,92 @@
+{
+  "version": 1,
+  "license": "CC-BY-SA-3.0",
+  "copyright": "Sprited by Lomovar",
+  "size": {
+    "x": 32,
+    "y": 32
+  },
+  "states": [
+    {
+      "name": "charging",
+      "delays": [
+        [
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3
+        ]
+      ]
+    },
+    {
+      "name": "charging-equipped-BACKPACK",
+      "directions": 4,
+      "delays": [
+        [
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3
+        ],
+        [
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3
+        ],
+        [
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3
+        ],
+        [
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3
+        ]
+      ]
+    },
+    {
+      "name": "charging-unlit",
+      "delays": [
+        [
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3,
+          0.3
+        ]
+      ]
+    },
+    {
+      "name": "inhand-left",
+      "directions": 4
+    },
+    {
+      "name": "inhand-right",
+      "directions": 4
+    }
+  ]
+}
+