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,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 (!transformComponent.Anchored)
return CellChargerStatus.Off;
if (!component.Portable)
{
if (!TryComp(uid, out TransformComponent? transformComponent) || !transformComponent.Anchored)
return CellChargerStatus.Off;
}
if (!TryComp(uid, out ApcPowerReceiverComponent? apcPowerReceiverComponent))
return CellChargerStatus.Off;
if (!apcPowerReceiverComponent.Powered)
if (!component.Portable && !apcPowerReceiverComponent.Powered)
return CellChargerStatus.Off;
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))