pneumatic cannon fixes (#14705)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-03-25 23:15:46 +00:00
committed by GitHub
parent e898246af1
commit 27e5fe5767
7 changed files with 92 additions and 10 deletions

View File

@@ -169,7 +169,8 @@ 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)
public override void Shoot(EntityUid gunUid, GunComponent gun, List<(EntityUid? Entity, IShootable Shootable)> ammo,
EntityCoordinates fromCoordinates, EntityCoordinates toCoordinates, EntityUid? user = null, bool throwItems = false)
{
// 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.
@@ -178,6 +179,16 @@ public sealed partial class GunSystem : SharedGunSystem
foreach (var (ent, shootable) in ammo)
{
if (throwItems)
{
Recoil(user, direction);
if (ent!.Value.IsClientSide())
Del(ent.Value);
else
RemComp<AmmoComponent>(ent.Value);
continue;
}
switch (shootable)
{
case CartridgeAmmoComponent cartridge: