Content audio (#20862)
This commit is contained in:
@@ -9,6 +9,9 @@ using Content.Shared.Nutrition.AnimalHusbandry;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Nutrition.EntitySystems;
|
||||
using Content.Shared.Storage;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -32,6 +35,7 @@ public sealed class AnimalHusbandrySystem : EntitySystem
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
|
||||
private readonly HashSet<EntityUid> _failedAttempts = new();
|
||||
private readonly HashSet<EntityUid> _birthQueue = new();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
@@ -222,7 +226,7 @@ public sealed class AnimalHusbandrySystem : EntitySystem
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
HashSet<EntityUid> birthQueue = new();
|
||||
_birthQueue.Clear();
|
||||
_failedAttempts.Clear();
|
||||
|
||||
var query = EntityQueryEnumerator<ReproductiveComponent>();
|
||||
@@ -230,7 +234,7 @@ public sealed class AnimalHusbandrySystem : EntitySystem
|
||||
{
|
||||
if (reproductive.GestationEndTime != null && _timing.CurTime >= reproductive.GestationEndTime)
|
||||
{
|
||||
birthQueue.Add(uid);
|
||||
_birthQueue.Add(uid);
|
||||
}
|
||||
|
||||
if (_timing.CurTime < reproductive.NextBreedAttempt)
|
||||
@@ -244,7 +248,7 @@ public sealed class AnimalHusbandrySystem : EntitySystem
|
||||
TryReproduceNearby(uid, reproductive);
|
||||
}
|
||||
|
||||
foreach (var queued in birthQueue)
|
||||
foreach (var queued in _birthQueue)
|
||||
{
|
||||
Birth(queued);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ using Content.Shared.Throwing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Nutrition.EntitySystems
|
||||
@@ -37,7 +38,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
|
||||
protected override void SplattedCreamPie(EntityUid uid, CreamPieComponent creamPie)
|
||||
{
|
||||
_audio.Play(_audio.GetSound(creamPie.Sound), Filter.Pvs(uid), uid, false, new AudioParams().WithVariation(0.125f));
|
||||
_audio.PlayPvs(_audio.GetSound(creamPie.Sound), uid, AudioParams.Default.WithVariation(0.125f));
|
||||
|
||||
if (EntityManager.TryGetComponent(uid, out FoodComponent? foodComp))
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Throwing;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -10,6 +10,8 @@ using Content.Shared.Emag.Systems;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Nutrition.EntitySystems;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server.Nutrition.EntitySystems;
|
||||
@@ -90,7 +92,7 @@ public sealed class FatExtractorSystem : EntitySystem
|
||||
|
||||
component.Processing = true;
|
||||
_appearance.SetData(uid, FatExtractorVisuals.Processing, true);
|
||||
component.Stream = _audio.PlayPvs(component.ProcessSound, uid);
|
||||
component.Stream = _audio.PlayPvs(component.ProcessSound, uid)?.Entity;
|
||||
component.NextUpdate = _timing.CurTime + component.UpdateTime;
|
||||
}
|
||||
|
||||
@@ -104,7 +106,7 @@ public sealed class FatExtractorSystem : EntitySystem
|
||||
|
||||
component.Processing = false;
|
||||
_appearance.SetData(uid, FatExtractorVisuals.Processing, false);
|
||||
component.Stream?.Stop();
|
||||
component.Stream = _audio.Stop(component.Stream);
|
||||
}
|
||||
|
||||
public bool TryGetValidOccupant(EntityUid uid, [NotNullWhen(true)] out EntityUid? occupant, FatExtractorComponent? component = null, EntityStorageComponent? storage = null)
|
||||
|
||||
@@ -28,6 +28,9 @@ using Content.Shared.Verbs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Storage;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
|
||||
namespace Content.Server.Nutrition.EntitySystems;
|
||||
|
||||
@@ -278,7 +281,7 @@ public sealed class FoodSystem : EntitySystem
|
||||
_adminLogger.Add(LogType.Ingestion, LogImpact.Low, $"{ToPrettyString(args.User):target} ate {ToPrettyString(uid):food}");
|
||||
}
|
||||
|
||||
_audio.Play(component.UseSound, Filter.Pvs(args.Target.Value), args.Target.Value, true, AudioParams.Default.WithVolume(-1f));
|
||||
_audio.PlayPvs(component.UseSound, args.Target.Value, AudioParams.Default.WithVolume(-1f));
|
||||
|
||||
// Try to break all used utensils
|
||||
foreach (var utensil in utensils)
|
||||
|
||||
@@ -7,6 +7,8 @@ using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Nutrition.EntitySystems;
|
||||
|
||||
@@ -7,16 +7,18 @@ using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Nutrition.EntitySystems
|
||||
{
|
||||
internal sealed class SliceableFoodSystem : EntitySystem
|
||||
public sealed class SliceableFoodSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -75,8 +77,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
xform.LocalRotation = 0;
|
||||
}
|
||||
|
||||
SoundSystem.Play(component.Sound.GetSound(), Filter.Pvs(uid),
|
||||
transform.Coordinates, AudioParams.Default.WithVolume(-2));
|
||||
_audio.PlayPvs(component.Sound, transform.Coordinates, AudioParams.Default.WithVolume(-2));
|
||||
|
||||
// Decrease size of item based on count - Could implement in the future
|
||||
// Bug with this currently is the size in a container is not updated
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Nutrition.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -15,6 +16,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly FoodSystem _foodSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -66,8 +68,8 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
|
||||
if (_robustRandom.Prob(component.BreakChance))
|
||||
{
|
||||
SoundSystem.Play(component.BreakSound.GetSound(), Filter.Pvs(userUid), userUid, AudioParams.Default.WithVolume(-2f));
|
||||
EntityManager.DeleteEntity(component.Owner);
|
||||
_audio.PlayPvs(component.BreakSound, userUid, AudioParams.Default.WithVolume(-2f));
|
||||
EntityManager.DeleteEntity(uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user