Weapons warnings cleanup (#36164)
* Weapons warnings cleanup * Changes to audio on Reflection stuff
This commit is contained in:
@@ -1,12 +1,9 @@
|
|||||||
using Content.Shared.Construction.Components;
|
|
||||||
using Content.Shared.Stunnable;
|
using Content.Shared.Stunnable;
|
||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
using Content.Shared.Timing;
|
using Content.Shared.Timing;
|
||||||
using Content.Shared.Weapons.Melee.Components;
|
using Content.Shared.Weapons.Melee.Components;
|
||||||
using Content.Shared.Weapons.Melee.Events;
|
using Content.Shared.Weapons.Melee.Events;
|
||||||
using Robust.Shared.Physics;
|
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Systems;
|
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace Content.Shared.Weapons.Melee;
|
namespace Content.Shared.Weapons.Melee;
|
||||||
@@ -17,7 +14,6 @@ namespace Content.Shared.Weapons.Melee;
|
|||||||
public sealed class MeleeThrowOnHitSystem : EntitySystem
|
public sealed class MeleeThrowOnHitSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
|
||||||
[Dependency] private readonly UseDelaySystem _delay = default!;
|
[Dependency] private readonly UseDelaySystem _delay = default!;
|
||||||
[Dependency] private readonly SharedStunSystem _stun = default!;
|
[Dependency] private readonly SharedStunSystem _stun = default!;
|
||||||
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ public abstract partial class SharedGunSystem
|
|||||||
// The problem is client will dump the cartridge on the ground and the new server state
|
// The problem is client will dump the cartridge on the ground and the new server state
|
||||||
// won't correspond due to randomness so looks weird
|
// won't correspond due to randomness so looks weird
|
||||||
// but we also need to always take it from the chamber or else ammocount won't be correct.
|
// but we also need to always take it from the chamber or else ammocount won't be correct.
|
||||||
TransformSystem.DetachParentToNull(chambered.Value, Transform(chambered.Value));
|
TransformSystem.DetachEntity(chambered.Value, Transform(chambered.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateAmmoCount(uid);
|
UpdateAmmoCount(uid);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ using Robust.Shared.Audio.Systems;
|
|||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Systems;
|
using Robust.Shared.Physics.Systems;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
@@ -462,7 +463,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||||||
var coordinates = xform.Coordinates;
|
var coordinates = xform.Coordinates;
|
||||||
coordinates = coordinates.Offset(offsetPos);
|
coordinates = coordinates.Offset(offsetPos);
|
||||||
|
|
||||||
TransformSystem.SetLocalRotation(xform, Random.NextAngle());
|
TransformSystem.SetLocalRotation(entity, Random.NextAngle(), xform);
|
||||||
TransformSystem.SetCoordinates(entity, xform, coordinates);
|
TransformSystem.SetCoordinates(entity, xform, coordinates);
|
||||||
|
|
||||||
// decides direction the casing ejects and only when not cycling
|
// decides direction the casing ejects and only when not cycling
|
||||||
@@ -510,8 +511,8 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||||||
|
|
||||||
public void CauseImpulse(EntityCoordinates fromCoordinates, EntityCoordinates toCoordinates, EntityUid user, PhysicsComponent userPhysics)
|
public void CauseImpulse(EntityCoordinates fromCoordinates, EntityCoordinates toCoordinates, EntityUid user, PhysicsComponent userPhysics)
|
||||||
{
|
{
|
||||||
var fromMap = fromCoordinates.ToMapPos(EntityManager, TransformSystem);
|
var fromMap = TransformSystem.ToMapCoordinates(fromCoordinates).Position;
|
||||||
var toMap = toCoordinates.ToMapPos(EntityManager, TransformSystem);
|
var toMap = TransformSystem.ToMapCoordinates(toCoordinates).Position;
|
||||||
var shotDirection = (toMap - fromMap).Normalized();
|
var shotDirection = (toMap - fromMap).Normalized();
|
||||||
|
|
||||||
const float impulseStrength = 25.0f;
|
const float impulseStrength = 25.0f;
|
||||||
|
|||||||
@@ -13,20 +13,20 @@ public sealed partial class ReflectComponent : Component
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// What we reflect.
|
/// What we reflect.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField("reflects")]
|
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||||
public ReflectType Reflects = ReflectType.Energy | ReflectType.NonEnergy;
|
public ReflectType Reflects = ReflectType.Energy | ReflectType.NonEnergy;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Probability for a projectile to be reflected.
|
/// Probability for a projectile to be reflected.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("reflectProb"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
|
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
|
||||||
public float ReflectProb = 0.25f;
|
public float ReflectProb = 0.25f;
|
||||||
|
|
||||||
[DataField("spread"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
|
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
|
||||||
public Angle Spread = Angle.FromDegrees(45);
|
public Angle Spread = Angle.FromDegrees(45);
|
||||||
|
|
||||||
[DataField("soundOnReflect")]
|
[DataField]
|
||||||
public SoundSpecifier? SoundOnReflect = new SoundPathSpecifier("/Audio/Weapons/Guns/Hits/laser_sear_wall.ogg");
|
public SoundSpecifier? SoundOnReflect = new SoundPathSpecifier("/Audio/Weapons/Guns/Hits/laser_sear_wall.ogg", AudioParams.Default.WithVariation(0.05f));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
|
|||||||
@@ -118,11 +118,7 @@ public sealed class ReflectSystem : EntitySystem
|
|||||||
var newRot = rotation.RotateVec(locRot.ToVec());
|
var newRot = rotation.RotateVec(locRot.ToVec());
|
||||||
_transform.SetLocalRotation(projectile, newRot.ToAngle());
|
_transform.SetLocalRotation(projectile, newRot.ToAngle());
|
||||||
|
|
||||||
if (_netManager.IsServer)
|
PlayAudioAndPopup(reflect, user);
|
||||||
{
|
|
||||||
_popup.PopupEntity(Loc.GetString("reflect-shot"), user);
|
|
||||||
_audio.PlayPvs(reflect.SoundOnReflect, user, AudioHelpers.WithVariation(0.05f, _random));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Resolve(projectile, ref projectileComp, false))
|
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(
|
private bool TryReflectHitscan(
|
||||||
EntityUid user,
|
EntityUid user,
|
||||||
EntityUid reflector,
|
EntityUid reflector,
|
||||||
@@ -172,11 +178,7 @@ public sealed class ReflectSystem : EntitySystem
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_netManager.IsServer)
|
PlayAudioAndPopup(reflect, user);
|
||||||
{
|
|
||||||
_popup.PopupEntity(Loc.GetString("reflect-shot"), user);
|
|
||||||
_audio.PlayPvs(reflect.SoundOnReflect, user, AudioHelpers.WithVariation(0.05f, _random));
|
|
||||||
}
|
|
||||||
|
|
||||||
var spread = _random.NextAngle(-reflect.Spread / 2, reflect.Spread / 2);
|
var spread = _random.NextAngle(-reflect.Spread / 2, reflect.Spread / 2);
|
||||||
newDirection = -spread.RotateVec(direction);
|
newDirection = -spread.RotateVec(direction);
|
||||||
|
|||||||
Reference in New Issue
Block a user