From 227a86f494d2e815ccb34b01ae77edca55cd3bb8 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Thu, 2 Jun 2022 12:01:50 +1000 Subject: [PATCH] Re-implement hitscan sounds (#8581) I forgor. Also added RW to ballistic prototype for funsies. --- Content.Server/Weapon/Ranged/Systems/GunSystem.cs | 2 ++ .../Components/BallisticAmmoProviderComponent.cs | 8 ++++---- Content.Shared/Weapons/Ranged/HitscanPrototype.cs | 14 ++++++++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Content.Server/Weapon/Ranged/Systems/GunSystem.cs b/Content.Server/Weapon/Ranged/Systems/GunSystem.cs index 537dd5bc58..957f16a977 100644 --- a/Content.Server/Weapon/Ranged/Systems/GunSystem.cs +++ b/Content.Server/Weapon/Ranged/Systems/GunSystem.cs @@ -121,6 +121,8 @@ public sealed partial class GunSystem : SharedGunSystem if (dmg != null) { + PlayImpactSound(result.HitEntity, dmg, hitscan.Sound, hitscan.ForceSound); + if (user != null) { Logs.Add(LogType.HitScanHit, diff --git a/Content.Shared/Weapons/Ranged/Components/BallisticAmmoProviderComponent.cs b/Content.Shared/Weapons/Ranged/Components/BallisticAmmoProviderComponent.cs index 73a85c5641..9377238f24 100644 --- a/Content.Shared/Weapons/Ranged/Components/BallisticAmmoProviderComponent.cs +++ b/Content.Shared/Weapons/Ranged/Components/BallisticAmmoProviderComponent.cs @@ -10,19 +10,19 @@ namespace Content.Shared.Weapons.Ranged.Components; [RegisterComponent, NetworkedComponent] public sealed class BallisticAmmoProviderComponent : Component { - [ViewVariables(VVAccess.ReadOnly), DataField("soundRack")] + [ViewVariables(VVAccess.ReadWrite), DataField("soundRack")] public SoundSpecifier? SoundRack = new SoundPathSpecifier("/Audio/Weapons/Guns/Cock/smg_cock.ogg"); - [ViewVariables(VVAccess.ReadOnly), DataField("soundInsert")] + [ViewVariables(VVAccess.ReadWrite), DataField("soundInsert")] public SoundSpecifier? SoundInsert = new SoundPathSpecifier("/Audio/Weapons/Guns/MagIn/bullet_insert.ogg"); - [ViewVariables, DataField("proto", customTypeSerializer: typeof(PrototypeIdSerializer))] + [ViewVariables(VVAccess.ReadWrite), DataField("proto", customTypeSerializer: typeof(PrototypeIdSerializer))] public string? FillProto; [ViewVariables(VVAccess.ReadWrite), DataField("capacity")] public int Capacity = 30; - [ViewVariables, DataField("unspawnedCount")] + [ViewVariables(VVAccess.ReadWrite), DataField("unspawnedCount")] public int UnspawnedCount; [ViewVariables(VVAccess.ReadWrite), DataField("whitelist")] diff --git a/Content.Shared/Weapons/Ranged/HitscanPrototype.cs b/Content.Shared/Weapons/Ranged/HitscanPrototype.cs index d7bab2668d..764b8c3218 100644 --- a/Content.Shared/Weapons/Ranged/HitscanPrototype.cs +++ b/Content.Shared/Weapons/Ranged/HitscanPrototype.cs @@ -1,5 +1,6 @@ using Content.Shared.Damage; using Content.Shared.Physics; +using Content.Shared.Sound; using Content.Shared.Weapons.Ranged.Systems; using Robust.Shared.Prototypes; using Robust.Shared.Utility; @@ -28,8 +29,17 @@ public sealed class HitscanPrototype : IPrototype, IShootable [ViewVariables, DataField("collisionMask")] public int CollisionMask = (int) CollisionGroup.Opaque; - [ViewVariables(VVAccess.ReadWrite), DataField("color")] - public Color Color = Color.White; + /// + /// Sound that plays upon the thing being hit. + /// + [ViewVariables, DataField("sound")] + public SoundSpecifier? Sound; + + /// + /// Force the hitscan sound to play rather than potentially playing the entity's sound. + /// + [ViewVariables(VVAccess.ReadWrite), DataField("forceSound")] + public bool ForceSound; /// /// Try not to set this too high.