Unrevert audio (#21330)

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
This commit is contained in:
metalgearsloth
2023-11-27 22:12:34 +11:00
committed by GitHub
parent d3486d3b25
commit 269c93245d
288 changed files with 848 additions and 427 deletions

View File

@@ -9,6 +9,8 @@ using Content.Shared.Projectiles;
using Content.Shared.Timing;
using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Weapons.Ranged.Systems;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Network;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
@@ -61,13 +63,13 @@ public abstract class SharedGrapplingGunSystem : EntitySystem
// At least show the visuals.
component.Projectile = shotUid.Value;
Dirty(component);
Dirty(uid, component);
var visuals = EnsureComp<JointVisualsComponent>(shotUid.Value);
visuals.Sprite =
new SpriteSpecifier.Rsi(new ResPath("Objects/Weapons/Guns/Launchers/grappling_gun.rsi"), "rope");
visuals.OffsetA = new Vector2(0f, 0.5f);
visuals.Target = uid;
Dirty(visuals);
Dirty(shotUid.Value, visuals);
}
TryComp<AppearanceComponent>(uid, out var appearance);
@@ -133,7 +135,7 @@ public abstract class SharedGrapplingGunSystem : EntitySystem
}
component.Projectile = null;
Dirty(component);
Dirty(uid, component);
}
}
@@ -145,19 +147,18 @@ public abstract class SharedGrapplingGunSystem : EntitySystem
if (value)
{
if (Timing.IsFirstTimePredicted)
component.Stream = _audio.PlayPredicted(component.ReelSound, uid, user);
component.Stream = _audio.PlayPredicted(component.ReelSound, uid, user)?.Entity;
}
else
{
if (Timing.IsFirstTimePredicted)
{
component.Stream?.Stop();
component.Stream = null;
component.Stream = _audio.Stop(component.Stream);
}
}
component.Reeling = value;
Dirty(component);
Dirty(uid, component);
}
public override void Update(float frameTime)
@@ -173,8 +174,7 @@ public abstract class SharedGrapplingGunSystem : EntitySystem
if (Timing.IsFirstTimePredicted)
{
// Just in case.
grappling.Stream?.Stop();
grappling.Stream = null;
grappling.Stream = _audio.Stop(grappling.Stream);
}
continue;
@@ -200,7 +200,7 @@ public abstract class SharedGrapplingGunSystem : EntitySystem
_physics.WakeBody(jointComp.Relay.Value);
}
Dirty(jointComp);
Dirty(uid, jointComp);
if (distance.MaxLength.Equals(distance.MinLength))
{
@@ -221,7 +221,7 @@ public abstract class SharedGrapplingGunSystem : EntitySystem
joint.MinLength = 0.35f;
// Setting velocity directly for mob movement fucks this so need to make them aware of it.
// joint.Breakpoint = 4000f;
Dirty(jointComp);
Dirty(uid, jointComp);
}
[Serializable, NetSerializable]