diff --git a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs index 9186772dc5..90f67c2890 100644 --- a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs @@ -171,7 +171,7 @@ public sealed partial class GunSystem : SharedGunSystem // Something like ballistic might want to leave it in the container still if (!cartridge.DeleteOnSpawn && !Containers.IsEntityInContainer(ent!.Value)) - EjectCartridge(ent.Value); + EjectCartridge(ent.Value, angle); Dirty(cartridge); break; diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index f0500d1fbd..68b64d43dc 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -377,6 +377,7 @@ public abstract partial class SharedGunSystem : EntitySystem /// protected void EjectCartridge( EntityUid entity, + Angle? angle = null, bool playSound = true) { // TODO: Sound limit version. @@ -389,6 +390,13 @@ public abstract partial class SharedGunSystem : EntitySystem TransformSystem.SetLocalRotation(xform, Random.NextAngle()); TransformSystem.SetCoordinates(entity, xform, coordinates); + // decides direction the casing ejects and only when not cycling + if (angle != null) + { + Angle ejectAngle = angle.Value; + ejectAngle += 3.7f; // 212 degrees; casings should eject slightly to the right and behind of a gun + ThrowingSystem.TryThrow(entity, ejectAngle.ToVec().Normalized() / 100, 5f); + } if (playSound && TryComp(entity, out var cartridge)) { Audio.PlayPvs(cartridge.EjectSound, entity, AudioParams.Default.WithVariation(0.05f).WithVolume(-1f)); diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/base_cartridge.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/base_cartridge.yml index f0c84aef1a..de6f9f92a5 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/base_cartridge.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/base_cartridge.yml @@ -22,3 +22,8 @@ - type: Item size: 1 - type: SpaceGarbage + - type: EmitSoundOnLand + sound: + path: /Audio/Weapons/Guns/Casings/casing_fall_2.ogg + params: + volume: -1