Content audio (#20862)
This commit is contained in:
@@ -7,6 +7,8 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
@@ -5,6 +5,8 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -19,7 +19,7 @@ public abstract class SharedAmbientSoundSystem : EntitySystem
|
||||
|
||||
ambience.Enabled = value;
|
||||
QueueUpdate(uid, ambience);
|
||||
Dirty(ambience);
|
||||
Dirty(uid, ambience);
|
||||
}
|
||||
|
||||
public virtual void SetRange(EntityUid uid, float value, AmbientSoundComponent? ambience = null)
|
||||
@@ -29,7 +29,7 @@ public abstract class SharedAmbientSoundSystem : EntitySystem
|
||||
|
||||
ambience.Range = value;
|
||||
QueueUpdate(uid, ambience);
|
||||
Dirty(ambience);
|
||||
Dirty(uid, ambience);
|
||||
}
|
||||
|
||||
protected virtual void QueueUpdate(EntityUid uid, AmbientSoundComponent ambience)
|
||||
@@ -43,7 +43,7 @@ public abstract class SharedAmbientSoundSystem : EntitySystem
|
||||
return;
|
||||
|
||||
ambience.Volume = value;
|
||||
Dirty(ambience);
|
||||
Dirty(uid, ambience);
|
||||
}
|
||||
|
||||
public virtual void SetSound(EntityUid uid, SoundSpecifier sound, AmbientSoundComponent? ambience = null)
|
||||
@@ -53,7 +53,7 @@ public abstract class SharedAmbientSoundSystem : EntitySystem
|
||||
|
||||
ambience.Sound = sound;
|
||||
QueueUpdate(uid, ambience);
|
||||
Dirty(ambience);
|
||||
Dirty(uid, ambience);
|
||||
}
|
||||
|
||||
private void HandleCompState(EntityUid uid, AmbientSoundComponent component, ref ComponentHandleState args)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
|
||||
namespace Content.Shared.Audio;
|
||||
|
||||
public abstract class SharedContentAudioSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] protected readonly SharedAudioSystem Audio = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Standard variation to use for sounds.
|
||||
@@ -14,6 +16,6 @@ public abstract class SharedContentAudioSystem : EntitySystem
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
_audio.OcclusionCollisionMask = (int) CollisionGroup.Impassable;
|
||||
Audio.OcclusionCollisionMask = (int) CollisionGroup.Impassable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Shared.Blocking;
|
||||
@@ -51,7 +52,7 @@ public sealed partial class BlockingSystem
|
||||
|
||||
if (blocking.IsBlocking)
|
||||
{
|
||||
_audio.PlayPvs(blocking.BlockSound, uid, AudioParams.Default.WithVariation(0.2f));
|
||||
_audio.PlayPvs(blocking.BlockSound, uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,8 +57,11 @@ public sealed partial class BlockingComponent : Component
|
||||
/// <summary>
|
||||
/// The sound to be played when you get hit while actively blocking
|
||||
/// </summary>
|
||||
[DataField("blockSound")]
|
||||
public SoundSpecifier BlockSound = new SoundPathSpecifier("/Audio/Weapons/block_metal1.ogg");
|
||||
[DataField("blockSound")] public SoundSpecifier BlockSound =
|
||||
new SoundPathSpecifier("/Audio/Weapons/block_metal1.ogg")
|
||||
{
|
||||
Params = AudioParams.Default.WithVariation(0.25f)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Fraction of original damage shield will take instead of user
|
||||
|
||||
@@ -493,8 +493,10 @@ public abstract partial class SharedBuckleSystem
|
||||
|
||||
_joints.RefreshRelay(buckleUid);
|
||||
Appearance.SetData(strapUid, StrapVisuals.State, strapComp.BuckledEntities.Count != 0);
|
||||
var audioSourceUid = userUid != buckleUid ? userUid : strapUid;
|
||||
_audio.PlayPredicted(strapComp.UnbuckleSound, strapUid, audioSourceUid);
|
||||
|
||||
// TODO: Buckle listening to moveevents is sussy anyway.
|
||||
if (!TerminatingOrDeleted(strapUid))
|
||||
_audio.PlayPredicted(strapComp.UnbuckleSound, strapUid, userUid);
|
||||
|
||||
var ev = new BuckleChangeEvent(strapUid, buckleUid, false);
|
||||
RaiseLocalEvent(buckleUid, ref ev);
|
||||
|
||||
@@ -7,6 +7,8 @@ using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Pulling;
|
||||
using Content.Shared.Standing;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
@@ -69,6 +69,8 @@ namespace Content.Shared.CCVar
|
||||
public static readonly CVarDef<float> AmbienceVolume =
|
||||
CVarDef.Create("ambience.volume", 0.0f, CVar.ARCHIVE | CVar.CLIENTONLY);
|
||||
|
||||
public const float MasterMultiplier = 2f;
|
||||
|
||||
// Midi is on engine so deal
|
||||
public const float MidiMultiplier = 3f;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Lock;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -117,7 +118,7 @@ public abstract class SharedItemCabinetSystem : EntitySystem
|
||||
return;
|
||||
|
||||
cabinet.Opened = !cabinet.Opened;
|
||||
Dirty(cabinet);
|
||||
Dirty(uid, cabinet);
|
||||
_itemSlots.SetLock(uid, cabinet.CabinetSlot, !cabinet.Opened);
|
||||
|
||||
if (_timing.IsFirstTimePredicted)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.StepTrigger.Systems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -4,6 +4,8 @@ using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared.Chemistry.Reaction
|
||||
|
||||
@@ -8,6 +8,8 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Stunnable;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -18,6 +18,7 @@ using Content.Shared.Physics;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Stunnable;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Physics.Components;
|
||||
|
||||
@@ -9,6 +9,8 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
@@ -29,6 +29,8 @@ using Content.Shared.Rejuvenate;
|
||||
using Content.Shared.Stunnable;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
@@ -16,6 +16,7 @@ using Content.Shared.Throwing;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -4,6 +4,8 @@ using Content.Shared.DoAfter;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Content.Shared.Doors.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Prying.Components;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
|
||||
namespace Content.Shared.Doors.Systems;
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Events;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Timing;
|
||||
using Content.Shared.Prying.Components;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
|
||||
namespace Content.Shared.Doors.Systems;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Strip.Components;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
@@ -23,6 +24,7 @@ public abstract partial class InventorySystem
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeed = default!;
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
@@ -206,10 +208,10 @@ public abstract partial class InventorySystem
|
||||
filter.RemoveWhereAttachedEntity(entity => entity == actor);
|
||||
}
|
||||
|
||||
SoundSystem.Play(clothing.EquipSound.GetSound(), filter, target, clothing.EquipSound.Params.WithVolume(-2f));
|
||||
_audio.PlayPredicted(clothing.EquipSound, target, actor);
|
||||
}
|
||||
|
||||
inventory.Dirty();
|
||||
Dirty(target, inventory);
|
||||
|
||||
_movementSpeed.RefreshMovementSpeedModifiers(target);
|
||||
|
||||
@@ -393,10 +395,11 @@ public abstract partial class InventorySystem
|
||||
filter.RemoveWhereAttachedEntity(entity => entity == actor);
|
||||
}
|
||||
|
||||
SoundSystem.Play(clothing.UnequipSound.GetSound(), filter, target, clothing.UnequipSound.Params.WithVolume(-2f));
|
||||
_audio.PlayPredicted(clothing.UnequipSound, target, actor);
|
||||
}
|
||||
|
||||
Dirty(target, inventory);
|
||||
|
||||
_movementSpeed.RefreshMovementSpeedModifiers(target);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -3,6 +3,8 @@ using Content.Shared.Clothing.EntitySystems;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Light.Components;
|
||||
using Content.Shared.Toggleable;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Light;
|
||||
|
||||
@@ -30,13 +30,19 @@ public sealed partial class LockComponent : Component
|
||||
/// The sound played when unlocked.
|
||||
/// </summary>
|
||||
[DataField("unlockingSound"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public SoundSpecifier UnlockSound = new SoundPathSpecifier("/Audio/Machines/door_lock_off.ogg");
|
||||
public SoundSpecifier UnlockSound = new SoundPathSpecifier("/Audio/Machines/door_lock_off.ogg")
|
||||
{
|
||||
Params = AudioParams.Default.WithVolume(-5f),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The sound played when locked.
|
||||
/// </summary>
|
||||
[DataField("lockingSound"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public SoundSpecifier LockSound = new SoundPathSpecifier("/Audio/Machines/door_lock_on.ogg");
|
||||
public SoundSpecifier LockSound = new SoundPathSpecifier("/Audio/Machines/door_lock_on.ogg")
|
||||
{
|
||||
Params = AudioParams.Default.WithVolume(-5f)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not an emag disables it.
|
||||
|
||||
@@ -11,6 +11,7 @@ using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Verbs;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Lock;
|
||||
@@ -102,11 +103,11 @@ public sealed class LockSystem : EntitySystem
|
||||
|
||||
_sharedPopupSystem.PopupClient(Loc.GetString("lock-comp-do-lock-success",
|
||||
("entityName", Identity.Name(uid, EntityManager))), uid, user);
|
||||
_audio.PlayPredicted(lockComp.LockSound, uid, user, AudioParams.Default.WithVolume(-5));
|
||||
_audio.PlayPredicted(lockComp.LockSound, uid, user);
|
||||
|
||||
lockComp.Locked = true;
|
||||
_appearanceSystem.SetData(uid, StorageVisuals.Locked, true);
|
||||
Dirty(lockComp);
|
||||
Dirty(uid, lockComp);
|
||||
|
||||
var ev = new LockToggledEvent(true);
|
||||
RaiseLocalEvent(uid, ref ev, true);
|
||||
@@ -130,11 +131,11 @@ public sealed class LockSystem : EntitySystem
|
||||
("entityName", Identity.Name(uid, EntityManager))), uid, user.Value);
|
||||
}
|
||||
|
||||
_audio.PlayPredicted(lockComp.UnlockSound, uid, user, AudioParams.Default.WithVolume(-5));
|
||||
_audio.PlayPredicted(lockComp.UnlockSound, uid, user);
|
||||
|
||||
lockComp.Locked = false;
|
||||
_appearanceSystem.SetData(uid, StorageVisuals.Locked, false);
|
||||
Dirty(lockComp);
|
||||
Dirty(uid, lockComp);
|
||||
|
||||
var ev = new LockToggledEvent(false);
|
||||
RaiseLocalEvent(uid, ref ev, true);
|
||||
@@ -213,7 +214,7 @@ public sealed class LockSystem : EntitySystem
|
||||
{
|
||||
if (!component.Locked || !component.BreakOnEmag)
|
||||
return;
|
||||
_audio.PlayPredicted(component.UnlockSound, uid, null, AudioParams.Default.WithVolume(-5));
|
||||
_audio.PlayPredicted(component.UnlockSound, uid, null);
|
||||
_appearanceSystem.SetData(uid, StorageVisuals.Locked, false);
|
||||
RemComp<LockComponent>(uid); //Literally destroys the lock as a tell it was emagged
|
||||
args.Handled = true;
|
||||
|
||||
@@ -126,7 +126,7 @@ public sealed partial class MaterialReclaimerComponent : Component
|
||||
[DataField]
|
||||
public TimeSpan SoundCooldown = TimeSpan.FromSeconds(0.8f);
|
||||
|
||||
public IPlayingAudioStream? Stream;
|
||||
public EntityUid? Stream;
|
||||
|
||||
/// <summary>
|
||||
/// A counter of how many items have been processed
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Mech.Equipment.Systems;
|
||||
using Content.Shared.Timing;
|
||||
using Robust.Shared.Audio;
|
||||
using System.Linq;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
|
||||
namespace Content.Shared.Mech.Equipment.Systems;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Pulling.Components;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Ninja.Components;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Shared.Ninja.Systems;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Clothing.EntitySystems;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Ninja.Components;
|
||||
using Content.Shared.Timing;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
|
||||
namespace Content.Shared.Ninja.Systems;
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ using Content.Shared.DoAfter;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Throwing;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Physics;
|
||||
|
||||
@@ -8,6 +8,8 @@ using Content.Shared.Doors.Components;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using PryUnpoweredComponent = Content.Shared.Prying.Components.PryUnpoweredComponent;
|
||||
|
||||
namespace Content.Shared.Prying.Systems;
|
||||
|
||||
@@ -13,6 +13,7 @@ using Content.Shared.RCD.Components;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Tiles;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
@@ -82,7 +82,7 @@ public sealed partial class GeigerComponent : Component
|
||||
/// Current stream of geiger counter audio.
|
||||
/// Played only for current user.
|
||||
/// </summary>
|
||||
public IPlayingAudioStream? Stream;
|
||||
public EntityUid? Stream;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -9,6 +9,8 @@ using Content.Shared.Radio.Components;
|
||||
using Content.Shared.Tools;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Content.Shared.Wires;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
@@ -3,6 +3,8 @@ using Content.Shared.DoAfter;
|
||||
using Content.Shared.Random;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -6,6 +6,8 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Stacks;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
@@ -33,6 +33,8 @@ public sealed partial class EmaggableMedibotComponent : Component
|
||||
/// <summary>
|
||||
/// Sound to play when the bot has been emagged
|
||||
/// </summary>
|
||||
[DataField("sparkSound")]
|
||||
public SoundSpecifier SparkSound = new SoundCollectionSpecifier("sparks");
|
||||
[DataField("sparkSound")] public SoundSpecifier SparkSound = new SoundCollectionSpecifier("sparks")
|
||||
{
|
||||
Params = AudioParams.Default.WithVolume(8f),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
|
||||
namespace Content.Shared.Silicons.Bots;
|
||||
|
||||
@@ -22,7 +23,7 @@ public sealed class MedibotSystem : EntitySystem
|
||||
if (!TryComp<MedibotComponent>(uid, out var medibot))
|
||||
return;
|
||||
|
||||
_audio.PlayPredicted(comp.SparkSound, uid, args.UserUid, AudioParams.Default.WithVolume(8));
|
||||
_audio.PlayPredicted(comp.SparkSound, uid, args.UserUid);
|
||||
|
||||
medibot.StandardMed = comp.StandardMed;
|
||||
medibot.StandardMedAmount = comp.StandardMedAmount;
|
||||
|
||||
@@ -61,7 +61,7 @@ public sealed partial class SingularityComponent : Component
|
||||
/// The audio stream that plays the sound specified by <see cref="AmbientSound"/> on loop.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public IPlayingAudioStream? AmbientSoundStream = null;
|
||||
public EntityUid? AmbientSoundStream = null;
|
||||
|
||||
/// <summary>
|
||||
/// The sound that the singularity produces when it forms.
|
||||
|
||||
@@ -5,6 +5,8 @@ using Content.Shared.StatusEffect;
|
||||
using Content.Shared.StepTrigger.Systems;
|
||||
using Content.Shared.Stunnable;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Shared.Sound.Components;
|
||||
using Content.Shared.Throwing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Physics.Components;
|
||||
@@ -142,8 +143,11 @@ public abstract class SharedEmitSoundSystem : EntitySystem
|
||||
var fraction = MathF.Min(1f, (physics.LinearVelocity.Length() - component.MinimumVelocity) / MaxVolumeVelocity);
|
||||
var volume = MinVolume + (MaxVolume - MinVolume) * fraction;
|
||||
component.NextSound = _timing.CurTime + EmitSoundOnCollideComponent.CollideCooldown;
|
||||
var sound = component.Sound;
|
||||
|
||||
if (_netMan.IsServer)
|
||||
_audioSystem.PlayPvs(component.Sound, uid, AudioParams.Default.WithVolume(volume));
|
||||
if (_netMan.IsServer && sound != null)
|
||||
{
|
||||
_audioSystem.PlayPvs(_audioSystem.GetSound(sound), uid, AudioParams.Default.WithVolume(volume));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Physics;
|
||||
using Content.Shared.Rotation;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
|
||||
@@ -81,7 +82,7 @@ namespace Content.Shared.Standing
|
||||
|
||||
if (playSound)
|
||||
{
|
||||
_audio.PlayPredicted(standingState.DownSound, uid, uid, AudioParams.Default.WithVariation(0.25f));
|
||||
_audio.PlayPredicted(standingState.DownSound, uid, uid);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -5,6 +5,8 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Placeable;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -15,6 +15,8 @@ using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Tools.Systems;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Wall;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
@@ -17,6 +17,8 @@ using Content.Shared.Stacks;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Timing;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -18,6 +18,7 @@ using Content.Shared.Standing;
|
||||
using Content.Shared.StatusEffect;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ using Content.Shared.Pulling;
|
||||
using Content.Shared.Pulling.Components;
|
||||
using Content.Shared.Teleportation.Components;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
|
||||
@@ -15,7 +15,10 @@ namespace Content.Shared.Tiles
|
||||
[DataField("outputs", customTypeSerializer: typeof(PrototypeIdListSerializer<ContentTileDefinition>))]
|
||||
public List<string>? OutputTiles;
|
||||
|
||||
[DataField("placeTileSound")]
|
||||
public SoundSpecifier PlaceTileSound = new SoundPathSpecifier("/Audio/Items/genhit.ogg");
|
||||
[DataField("placeTileSound")] public SoundSpecifier PlaceTileSound =
|
||||
new SoundPathSpecifier("/Audio/Items/genhit.ogg")
|
||||
{
|
||||
Params = AudioParams.Default.WithVariation(0.125f),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ using Content.Shared.Physics;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Network;
|
||||
@@ -178,7 +179,7 @@ public sealed class FloorTileSystem : EntitySystem
|
||||
var variant = (byte) (_timing.CurTick.Value % ((ContentTileDefinition) _tileDefinitionManager[tileId]).Variants);
|
||||
mapGrid.SetTile(location.Offset(new Vector2(offset, offset)), new Tile(tileId, 0, variant));
|
||||
|
||||
_audio.PlayPredicted(placeSound, location, user, AudioHelpers.WithVariation(0.125f, _random));
|
||||
_audio.PlayPredicted(placeSound, location, user);
|
||||
}
|
||||
|
||||
public bool CanPlaceTile(EntityUid gridUid, MapGridComponent component, [NotNullWhen(false)] out string? reason)
|
||||
|
||||
@@ -3,6 +3,8 @@ using Content.Shared.DoAfter;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -52,7 +54,7 @@ public abstract partial class SharedToolSystem : EntitySystem
|
||||
if (tool.UseSound == null)
|
||||
return;
|
||||
|
||||
_audioSystem.PlayPredicted(tool.UseSound, uid, user, tool.UseSound.Params.WithVariation(0.175f).AddVolume(-5f));
|
||||
_audioSystem.PlayPredicted(tool.UseSound, uid, user);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -43,5 +43,5 @@ public sealed partial class ParacusiaComponent : Component
|
||||
[DataField("timeBetweenIncidents", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
|
||||
public TimeSpan NextIncidentTime;
|
||||
|
||||
public IPlayingAudioStream? Stream;
|
||||
public EntityUid? Stream;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public sealed partial class VehicleComponent : Component
|
||||
};
|
||||
|
||||
[ViewVariables]
|
||||
public IPlayingAudioStream? HonkPlayingStream;
|
||||
public EntityUid? HonkPlayingStream;
|
||||
|
||||
/// Use ambient sound component for the idle sound.
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Vehicle.Components;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
@@ -174,8 +176,7 @@ public abstract partial class SharedVehicleSystem : EntitySystem
|
||||
|
||||
// TODO: Need audio refactor maybe, just some way to null it when the stream is over.
|
||||
// For now better to just not loop to keep the code much cleaner.
|
||||
vehicle.HonkPlayingStream?.Stop();
|
||||
vehicle.HonkPlayingStream = _audioSystem.PlayPredicted(vehicle.HornSound, uid, uid);
|
||||
vehicle.HonkPlayingStream = _audioSystem.PlayPredicted(vehicle.HornSound, uid, uid)?.Entity;
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ using System.Linq;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
namespace Content.Shared.VendingMachines;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Physics.Events;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -20,6 +20,7 @@ using Content.Shared.Weapons.Ranged.Components;
|
||||
using Content.Shared.Weapons.Ranged.Events;
|
||||
using Content.Shared.Weapons.Ranged.Systems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
|
||||
@@ -52,5 +52,5 @@ public abstract partial class BaseForceGunComponent : Component
|
||||
Params = AudioParams.Default.WithLoop(true).WithVolume(-8f),
|
||||
};
|
||||
|
||||
public IPlayingAudioStream? Stream;
|
||||
public EntityUid? Stream;
|
||||
}
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -7,6 +7,8 @@ using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Throwing;
|
||||
using Content.Shared.Toggleable;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
@@ -232,10 +234,10 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
|
||||
|
||||
// Sad...
|
||||
if (_netManager.IsServer && component.Stream == null)
|
||||
component.Stream = _audio.PlayPredicted(component.Sound, gunUid, null);
|
||||
component.Stream = _audio.PlayPredicted(component.Sound, gunUid, null)?.Entity;
|
||||
|
||||
Dirty(tethered);
|
||||
Dirty(component);
|
||||
Dirty(target, tethered);
|
||||
Dirty(gunUid, component);
|
||||
}
|
||||
|
||||
protected virtual void StopTether(EntityUid gunUid, BaseForceGunComponent component, bool land = true, bool transfer = false)
|
||||
@@ -269,7 +271,7 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
|
||||
|
||||
if (!transfer)
|
||||
{
|
||||
component.Stream?.Stop();
|
||||
_audio.Stop(component.Stream);
|
||||
component.Stream = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,5 +24,5 @@ public sealed partial class GrapplingGunComponent : Component
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("cycleSound"), AutoNetworkedField]
|
||||
public SoundSpecifier? CycleSound = new SoundPathSpecifier("/Audio/Weapons/Guns/MagIn/kinetic_reload.ogg");
|
||||
|
||||
public IPlayingAudioStream? Stream;
|
||||
public EntityUid? Stream;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -20,6 +20,7 @@ using Content.Shared.Weapons.Melee.Events;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Content.Shared.Weapons.Ranged.Events;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
|
||||
@@ -10,6 +10,8 @@ using Content.Shared.Popups;
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Content.Shared.Weapons.Ranged.Events;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
@@ -15,13 +17,11 @@ public abstract class SharedWeatherSystem : EntitySystem
|
||||
[Dependency] protected readonly IPrototypeManager ProtoMan = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefManager = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metadata = default!;
|
||||
|
||||
protected ISawmill Sawmill = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Sawmill = Logger.GetSawmill("weather");
|
||||
SubscribeLocalEvent<WeatherComponent, EntityUnpausedEvent>(OnWeatherUnpaused);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public abstract class SharedWeatherSystem : EntitySystem
|
||||
// Admin messed up or the likes.
|
||||
if (!ProtoMan.TryIndex<WeatherPrototype>(proto, out var weatherProto))
|
||||
{
|
||||
Sawmill.Error($"Unable to find weather prototype for {comp.Weather}, ending!");
|
||||
Log.Error($"Unable to find weather prototype for {comp.Weather}, ending!");
|
||||
EndWeather(uid, comp, proto);
|
||||
continue;
|
||||
}
|
||||
@@ -156,7 +156,8 @@ public abstract class SharedWeatherSystem : EntitySystem
|
||||
/// </summary>
|
||||
public void SetWeather(MapId mapId, WeatherPrototype? proto, TimeSpan? endTime)
|
||||
{
|
||||
var weatherComp = EnsureComp<WeatherComponent>(MapManager.GetMapEntityId(mapId));
|
||||
var mapUid = MapManager.GetMapEntityId(mapId);
|
||||
var weatherComp = EnsureComp<WeatherComponent>(mapUid);
|
||||
|
||||
foreach (var (eProto, weather) in weatherComp.Weather)
|
||||
{
|
||||
@@ -168,7 +169,7 @@ public abstract class SharedWeatherSystem : EntitySystem
|
||||
if (weather.State == WeatherState.Ending)
|
||||
weather.State = WeatherState.Running;
|
||||
|
||||
Dirty(weatherComp);
|
||||
Dirty(mapUid, weatherComp);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -178,7 +179,7 @@ public abstract class SharedWeatherSystem : EntitySystem
|
||||
if (weather.EndTime == null || weather.EndTime > end)
|
||||
{
|
||||
weather.EndTime = end;
|
||||
Dirty(weatherComp);
|
||||
Dirty(mapUid, weatherComp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,10 +212,10 @@ public abstract class SharedWeatherSystem : EntitySystem
|
||||
if (!component.Weather.TryGetValue(proto, out var data))
|
||||
return;
|
||||
|
||||
data.Stream?.Stop();
|
||||
_audio.Stop(data.Stream);
|
||||
data.Stream = null;
|
||||
component.Weather.Remove(proto);
|
||||
Dirty(component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
protected virtual bool SetState(WeatherState state, WeatherComponent component, WeatherData weather, WeatherPrototype weatherProto)
|
||||
|
||||
@@ -24,7 +24,7 @@ public sealed partial class WeatherData
|
||||
{
|
||||
// Client audio stream.
|
||||
[NonSerialized]
|
||||
public IPlayingAudioStream? Stream;
|
||||
public EntityUid? Stream;
|
||||
|
||||
/// <summary>
|
||||
/// When the weather started if relevant.
|
||||
|
||||
@@ -12,6 +12,8 @@ using Content.Shared.Weapons.Melee.Components;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Content.Shared.Weapons.Ranged.Systems;
|
||||
using Content.Shared.Wieldable.Components;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Player;
|
||||
using Content.Shared.Timing;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user