Adds grappling gun (#16662)

This commit is contained in:
metalgearsloth
2023-05-27 14:15:15 +10:00
committed by GitHub
parent 9eb4d4edb0
commit 552fbb0585
48 changed files with 753 additions and 35 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Weapons.Ranged.Events;
using Robust.Shared.Map;
namespace Content.Client.Weapons.Ranged.Systems;
@@ -19,9 +20,10 @@ public sealed partial class GunSystem
}
}
protected override void Cycle(BallisticAmmoProviderComponent component, MapCoordinates coordinates)
protected override void Cycle(EntityUid uid, BallisticAmmoProviderComponent component, MapCoordinates coordinates)
{
if (!Timing.IsFirstTimePredicted) return;
if (!Timing.IsFirstTimePredicted)
return;
EntityUid? ent = null;
@@ -43,5 +45,8 @@ public sealed partial class GunSystem
if (ent != null && ent.Value.IsClientSide())
Del(ent.Value);
var cycledEvent = new GunCycledEvent();
RaiseLocalEvent(uid, ref cycledEvent);
}
}

View File

@@ -173,8 +173,10 @@ public sealed partial class GunSystem : SharedGunSystem
}
public override void Shoot(EntityUid gunUid, GunComponent gun, List<(EntityUid? Entity, IShootable Shootable)> ammo,
EntityCoordinates fromCoordinates, EntityCoordinates toCoordinates, EntityUid? user = null, bool throwItems = false)
EntityCoordinates fromCoordinates, EntityCoordinates toCoordinates, out bool userImpulse, EntityUid? user = null, bool throwItems = false)
{
userImpulse = true;
// Rather than splitting client / server for every ammo provider it's easier
// to just delete the spawned entities. This is for programmer sanity despite the wasted perf.
// This also means any ammo specific stuff can be grabbed as necessary.
@@ -207,6 +209,7 @@ public sealed partial class GunSystem : SharedGunSystem
}
else
{
userImpulse = false;
Audio.PlayPredicted(gun.SoundEmpty, gunUid, user);
}