Portable Recharger: Arsenal T3 (#26655)

* 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>
This commit is contained in:
icekot8
2024-04-28 06:19:33 +03:00
committed by GitHub
parent 49d8fe33a3
commit a7ad59f6ba
12 changed files with 179 additions and 7 deletions

View File

@@ -1,5 +1,10 @@
using Content.Shared.Power; using Content.Shared.Power;
using Content.Shared.Whitelist; 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 namespace Content.Server.Power.Components
{ {
@@ -26,5 +31,12 @@ namespace Content.Server.Power.Components
/// </summary> /// </summary>
[DataField("whitelist")] [DataField("whitelist")]
public EntityWhitelist? 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;
} }
} }

View File

@@ -1,8 +1,10 @@
using Content.Server.Power.Components; using Content.Server.Power.Components;
using Content.Server.Emp;
using Content.Server.PowerCell; using Content.Server.PowerCell;
using Content.Shared.Examine; using Content.Shared.Examine;
using Content.Shared.Power; using Content.Shared.Power;
using Content.Shared.PowerCell.Components; using Content.Shared.PowerCell.Components;
using Content.Shared.Emp;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
@@ -28,6 +30,8 @@ internal sealed class ChargerSystem : EntitySystem
SubscribeLocalEvent<ChargerComponent, ContainerIsInsertingAttemptEvent>(OnInsertAttempt); SubscribeLocalEvent<ChargerComponent, ContainerIsInsertingAttemptEvent>(OnInsertAttempt);
SubscribeLocalEvent<ChargerComponent, InsertIntoEntityStorageAttemptEvent>(OnEntityStorageInsertAttempt); SubscribeLocalEvent<ChargerComponent, InsertIntoEntityStorageAttemptEvent>(OnEntityStorageInsertAttempt);
SubscribeLocalEvent<ChargerComponent, ExaminedEvent>(OnChargerExamine); SubscribeLocalEvent<ChargerComponent, ExaminedEvent>(OnChargerExamine);
SubscribeLocalEvent<ChargerComponent, EmpPulseEvent>(OnEmpPulse);
} }
private void OnStartup(EntityUid uid, ChargerComponent component, ComponentStartup args) 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) private CellChargerStatus GetStatus(EntityUid uid, ChargerComponent component)
{ {
if (!TryComp(uid, out TransformComponent? transformComponent)) if (!component.Portable)
return CellChargerStatus.Off; {
if (!TryComp(uid, out TransformComponent? transformComponent) || !transformComponent.Anchored)
if (!transformComponent.Anchored) return CellChargerStatus.Off;
return CellChargerStatus.Off; }
if (!TryComp(uid, out ApcPowerReceiverComponent? apcPowerReceiverComponent)) if (!TryComp(uid, out ApcPowerReceiverComponent? apcPowerReceiverComponent))
return CellChargerStatus.Off; return CellChargerStatus.Off;
if (!apcPowerReceiverComponent.Powered) if (!component.Portable && !apcPowerReceiverComponent.Powered)
return CellChargerStatus.Off;
if (HasComp<EmpDisabledComponent>(uid))
return CellChargerStatus.Off; return CellChargerStatus.Off;
if (!_container.TryGetContainer(uid, component.SlotId, out var container)) if (!_container.TryGetContainer(uid, component.SlotId, out var container))
@@ -186,7 +199,7 @@ internal sealed class ChargerSystem : EntitySystem
return CellChargerStatus.Charging; return CellChargerStatus.Charging;
} }
private void TransferPower(EntityUid uid, EntityUid targetEntity, ChargerComponent component, float frameTime) private void TransferPower(EntityUid uid, EntityUid targetEntity, ChargerComponent component, float frameTime)
{ {
if (!TryComp(uid, out ApcPowerReceiverComponent? receiverComponent)) if (!TryComp(uid, out ApcPowerReceiverComponent? receiverComponent))

View File

@@ -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

View File

@@ -737,6 +737,14 @@
- WeaponLaserCannon - WeaponLaserCannon
- WeaponLaserCarbine - WeaponLaserCarbine
- WeaponXrayCannon - WeaponXrayCannon
- PowerCageSmall
- PowerCageMedium
- PowerCageHigh
- ShuttleGunSvalinnMachineGunCircuitboard
- ShuttleGunPerforatorCircuitboard
- ShuttleGunFriendshipCircuitboard
- ShuttleGunDusterCircuitboard
- PortableRecharger
- type: MaterialStorage - type: MaterialStorage
whitelist: whitelist:
tags: tags:

View File

@@ -690,3 +690,14 @@
Steel: 150 Steel: 150
Plastic: 100 Plastic: 100
Glass: 20 Glass: 20
- type: latheRecipe
id: PortableRecharger
result: PortableRecharger
completetime: 15
materials:
Steel: 2000
Uranium: 2000
Plastic: 1000
Plasma: 500
Glass: 500

View File

@@ -175,6 +175,7 @@
cost: 15000 cost: 15000
recipeUnlocks: recipeUnlocks:
- WeaponAdvancedLaser - WeaponAdvancedLaser
- PortableRecharger
- type: technology - type: technology
id: ExperimentalBatteryAmmo id: ExperimentalBatteryAmmo

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

View File

@@ -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
}
]
}