Re-implement hitscan sounds (#8581)

I forgor. Also added RW to ballistic prototype for funsies.
This commit is contained in:
metalgearsloth
2022-06-02 12:01:50 +10:00
committed by GitHub
parent d5620aa833
commit 227a86f494
3 changed files with 18 additions and 6 deletions

View File

@@ -121,6 +121,8 @@ public sealed partial class GunSystem : SharedGunSystem
if (dmg != null) if (dmg != null)
{ {
PlayImpactSound(result.HitEntity, dmg, hitscan.Sound, hitscan.ForceSound);
if (user != null) if (user != null)
{ {
Logs.Add(LogType.HitScanHit, Logs.Add(LogType.HitScanHit,

View File

@@ -10,19 +10,19 @@ namespace Content.Shared.Weapons.Ranged.Components;
[RegisterComponent, NetworkedComponent] [RegisterComponent, NetworkedComponent]
public sealed class BallisticAmmoProviderComponent : Component 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"); 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"); public SoundSpecifier? SoundInsert = new SoundPathSpecifier("/Audio/Weapons/Guns/MagIn/bullet_insert.ogg");
[ViewVariables, DataField("proto", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))] [ViewVariables(VVAccess.ReadWrite), DataField("proto", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? FillProto; public string? FillProto;
[ViewVariables(VVAccess.ReadWrite), DataField("capacity")] [ViewVariables(VVAccess.ReadWrite), DataField("capacity")]
public int Capacity = 30; public int Capacity = 30;
[ViewVariables, DataField("unspawnedCount")] [ViewVariables(VVAccess.ReadWrite), DataField("unspawnedCount")]
public int UnspawnedCount; public int UnspawnedCount;
[ViewVariables(VVAccess.ReadWrite), DataField("whitelist")] [ViewVariables(VVAccess.ReadWrite), DataField("whitelist")]

View File

@@ -1,5 +1,6 @@
using Content.Shared.Damage; using Content.Shared.Damage;
using Content.Shared.Physics; using Content.Shared.Physics;
using Content.Shared.Sound;
using Content.Shared.Weapons.Ranged.Systems; using Content.Shared.Weapons.Ranged.Systems;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Utility; using Robust.Shared.Utility;
@@ -28,8 +29,17 @@ public sealed class HitscanPrototype : IPrototype, IShootable
[ViewVariables, DataField("collisionMask")] [ViewVariables, DataField("collisionMask")]
public int CollisionMask = (int) CollisionGroup.Opaque; public int CollisionMask = (int) CollisionGroup.Opaque;
[ViewVariables(VVAccess.ReadWrite), DataField("color")] /// <summary>
public Color Color = Color.White; /// Sound that plays upon the thing being hit.
/// </summary>
[ViewVariables, DataField("sound")]
public SoundSpecifier? Sound;
/// <summary>
/// Force the hitscan sound to play rather than potentially playing the entity's sound.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("forceSound")]
public bool ForceSound;
/// <summary> /// <summary>
/// Try not to set this too high. /// Try not to set this too high.