Adds force-gun (#16561)

This commit is contained in:
metalgearsloth
2023-05-19 17:10:31 +10:00
committed by GitHub
parent eb94a785f9
commit 4efb41aa58
26 changed files with 373 additions and 76 deletions

View File

@@ -1,5 +1,4 @@
using Content.Server.PowerCell;
using Content.Shared.PowerCell.Components;
using Content.Shared.Weapons.Misc;
using Robust.Shared.Physics.Components;
@@ -13,14 +12,15 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
{
base.Initialize();
SubscribeLocalEvent<TetherGunComponent, PowerCellSlotEmptyEvent>(OnGunEmpty);
SubscribeLocalEvent<ForceGunComponent, PowerCellSlotEmptyEvent>(OnGunEmpty);
}
private void OnGunEmpty(EntityUid uid, TetherGunComponent component, ref PowerCellSlotEmptyEvent args)
private void OnGunEmpty(EntityUid uid, BaseForceGunComponent component, ref PowerCellSlotEmptyEvent args)
{
StopTether(uid, component);
}
protected override bool CanTether(EntityUid uid, TetherGunComponent component, EntityUid target, EntityUid? user)
protected override bool CanTether(EntityUid uid, BaseForceGunComponent component, EntityUid target, EntityUid? user)
{
if (!base.CanTether(uid, component, target, user))
return false;
@@ -31,16 +31,16 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
return true;
}
protected override void StartTether(EntityUid gunUid, TetherGunComponent component, EntityUid target, EntityUid? user,
protected override void StartTether(EntityUid gunUid, BaseForceGunComponent component, EntityUid target, EntityUid? user,
PhysicsComponent? targetPhysics = null, TransformComponent? targetXform = null)
{
base.StartTether(gunUid, component, target, user, targetPhysics, targetXform);
_cell.SetPowerCellDrawEnabled(gunUid, true);
}
protected override void StopTether(EntityUid gunUid, TetherGunComponent component, bool transfer = false)
protected override void StopTether(EntityUid gunUid, BaseForceGunComponent component, bool land = true, bool transfer = false)
{
base.StopTether(gunUid, component, transfer);
base.StopTether(gunUid, component, land, transfer);
_cell.SetPowerCellDrawEnabled(gunUid, false);
}
}