diff --git a/Content.Server/Materials/MaterialReclaimerSystem.cs b/Content.Server/Materials/MaterialReclaimerSystem.cs index ce1f285fcf..2f8b43e832 100644 --- a/Content.Server/Materials/MaterialReclaimerSystem.cs +++ b/Content.Server/Materials/MaterialReclaimerSystem.cs @@ -166,13 +166,17 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem var xform = Transform(uid); SpawnMaterialsFromComposition(uid, item, completion * component.Efficiency, xform: xform); - SpawnChemicalsFromComposition(uid, item, completion, component, xform); if (CanGib(uid, item, component)) { + SpawnChemicalsFromComposition(uid, item, completion, false, component, xform); _body.GibBody(item, true); _appearance.SetData(uid, RecyclerVisuals.Bloody, true); } + else + { + SpawnChemicalsFromComposition(uid, item, completion, true, component, xform); + } QueueDel(item); } @@ -213,6 +217,7 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem private void SpawnChemicalsFromComposition(EntityUid reclaimer, EntityUid item, float efficiency, + bool sound = true, MaterialReclaimerComponent? reclaimerComponent = null, TransformComponent? xform = null, PhysicalCompositionComponent? composition = null) @@ -248,7 +253,7 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem _solutionContainer.TryTransferSolution(reclaimer, reclaimerComponent.OutputSolution, totalChemicals, totalChemicals.Volume); if (totalChemicals.Volume > 0) { - _puddle.TrySpillAt(reclaimer, totalChemicals, out _, transformComponent: xform); + _puddle.TrySpillAt(reclaimer, totalChemicals, out _, sound, transformComponent: xform); } } } diff --git a/Content.Shared/Materials/SharedMaterialReclaimerSystem.cs b/Content.Shared/Materials/SharedMaterialReclaimerSystem.cs index 3f5832f69a..c3c712b617 100644 --- a/Content.Shared/Materials/SharedMaterialReclaimerSystem.cs +++ b/Content.Shared/Materials/SharedMaterialReclaimerSystem.cs @@ -35,11 +35,17 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem SubscribeLocalEvent(OnUnpaused); SubscribeLocalEvent(OnExamined); SubscribeLocalEvent(OnEmagged); + SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnCollide); SubscribeLocalEvent(OnActiveStartup); SubscribeLocalEvent(OnActiveUnpaused); } + private void OnMapInit(EntityUid uid, MaterialReclaimerComponent component, MapInitEvent args) + { + component.NextSound = Timing.CurTime; + } + private void OnShutdown(EntityUid uid, MaterialReclaimerComponent component, ComponentShutdown args) { component.Stream?.Stop(); @@ -109,8 +115,11 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem } if (Timing.CurTime > component.NextSound) - component.Stream = _audio.PlayPvs(component.Sound, uid); - component.NextSound = Timing.CurTime + component.SoundCooldown; + { + component.Stream = _audio.PlayPredicted(component.Sound, uid, user); + + component.NextSound = Timing.CurTime + component.SoundCooldown; + } var duration = GetReclaimingDuration(uid, item, component); // if it's instant, don't bother with all the active comp stuff.