Weapons warnings cleanup (#36164)

* Weapons warnings cleanup

* Changes to audio on Reflection stuff
This commit is contained in:
J
2025-04-18 14:28:40 +00:00
committed by GitHub
parent d068075c81
commit a89af44f56
5 changed files with 22 additions and 23 deletions

View File

@@ -118,11 +118,7 @@ public sealed class ReflectSystem : EntitySystem
var newRot = rotation.RotateVec(locRot.ToVec());
_transform.SetLocalRotation(projectile, newRot.ToAngle());
if (_netManager.IsServer)
{
_popup.PopupEntity(Loc.GetString("reflect-shot"), user);
_audio.PlayPvs(reflect.SoundOnReflect, user, AudioHelpers.WithVariation(0.05f, _random));
}
PlayAudioAndPopup(reflect, user);
if (Resolve(projectile, ref projectileComp, false))
{
@@ -154,6 +150,16 @@ public sealed class ReflectSystem : EntitySystem
}
}
private void PlayAudioAndPopup(ReflectComponent reflect, EntityUid user)
{
// Can probably be changed for prediction
if (_netManager.IsServer)
{
_popup.PopupEntity(Loc.GetString("reflect-shot"), user);
_audio.PlayPvs(reflect.SoundOnReflect, user);
}
}
private bool TryReflectHitscan(
EntityUid user,
EntityUid reflector,
@@ -172,11 +178,7 @@ public sealed class ReflectSystem : EntitySystem
return false;
}
if (_netManager.IsServer)
{
_popup.PopupEntity(Loc.GetString("reflect-shot"), user);
_audio.PlayPvs(reflect.SoundOnReflect, user, AudioHelpers.WithVariation(0.05f, _random));
}
PlayAudioAndPopup(reflect, user);
var spread = _random.NextAngle(-reflect.Spread / 2, reflect.Spread / 2);
newDirection = -spread.RotateVec(direction);