Content audio (#20862)
This commit is contained in:
@@ -8,6 +8,8 @@ using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Physics.Events;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -48,7 +50,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
|
||||
|
||||
private void OnShutdown(EntityUid uid, MaterialReclaimerComponent component, ComponentShutdown args)
|
||||
{
|
||||
component.Stream?.Stop();
|
||||
_audio.Stop(component.Stream);
|
||||
}
|
||||
|
||||
private void OnUnpaused(EntityUid uid, MaterialReclaimerComponent component, ref EntityUnpausedEvent args)
|
||||
@@ -116,8 +118,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
|
||||
|
||||
if (Timing.CurTime > component.NextSound)
|
||||
{
|
||||
component.Stream = _audio.PlayPredicted(component.Sound, uid, user);
|
||||
|
||||
component.Stream = _audio.PlayPredicted(component.Sound, uid, user)?.Entity;
|
||||
component.NextSound = Timing.CurTime + component.SoundCooldown;
|
||||
}
|
||||
|
||||
@@ -167,9 +168,11 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
|
||||
|
||||
component.ItemsProcessed++;
|
||||
if (component.CutOffSound)
|
||||
component.Stream?.Stop();
|
||||
{
|
||||
_audio.Stop(component.Stream);
|
||||
}
|
||||
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -181,7 +184,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
|
||||
return;
|
||||
component.Enabled = enabled;
|
||||
AmbientSound.SetAmbience(uid, enabled && component.Powered);
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user