Rename SoundComponent and refactor its wrong usages. (#1036)
* Rename `SoundComponent` and refactor its wrong usages. * Replace verbose IoC grabs with EntitySysetm.Get * unused depend Co-authored-by: FL-OZ <anotherscuffed@gmail.com> Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
@@ -12,13 +12,13 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
{
|
||||
public sealed class MicrowaveVisualizer : AppearanceVisualizer
|
||||
{
|
||||
private SoundComponent _soundComponent;
|
||||
private LoopingSoundComponent _loopingSoundComponent;
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||
_soundComponent ??= component.Owner.GetComponent<SoundComponent>();
|
||||
_loopingSoundComponent ??= component.Owner.GetComponent<LoopingSoundComponent>();
|
||||
if (!component.TryGetData(PowerDeviceVisuals.VisualState, out MicrowaveVisualState state))
|
||||
{
|
||||
state = MicrowaveVisualState.Idle;
|
||||
@@ -28,7 +28,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
case MicrowaveVisualState.Idle:
|
||||
sprite.LayerSetState(MicrowaveVisualizerLayers.Base, "mw");
|
||||
sprite.LayerSetState(MicrowaveVisualizerLayers.BaseUnlit, "mw_unlit");
|
||||
_soundComponent.StopAllSounds();
|
||||
_loopingSoundComponent.StopAllSounds();
|
||||
break;
|
||||
|
||||
case MicrowaveVisualState.Cooking:
|
||||
@@ -39,8 +39,8 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
var schedSound = new ScheduledSound();
|
||||
schedSound.Filename = "/Audio/machines/microwave_loop.ogg";
|
||||
schedSound.AudioParams = audioParams;
|
||||
_soundComponent.StopAllSounds();
|
||||
_soundComponent.AddScheduledSound(schedSound);
|
||||
_loopingSoundComponent.StopAllSounds();
|
||||
_loopingSoundComponent.AddScheduledSound(schedSound);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -16,7 +16,7 @@ using Robust.Shared.Utility;
|
||||
namespace Content.Client.GameObjects.Components.Sound
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class SoundComponent : SharedSoundComponent
|
||||
public class LoopingSoundComponent : SharedLoopingSoundComponent
|
||||
{
|
||||
private readonly Dictionary<ScheduledSound, IPlayingAudioStream> _audioStreams = new Dictionary<ScheduledSound, IPlayingAudioStream>();
|
||||
private AudioSystem _audioSystem;
|
||||
@@ -19,6 +19,8 @@ using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Chemistry
|
||||
{
|
||||
@@ -320,10 +322,9 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
|
||||
private void ClickSound()
|
||||
{
|
||||
if (Owner.TryGetComponent(out SoundComponent sound))
|
||||
{
|
||||
sound.Play("/Audio/machines/machine_switch.ogg", AudioParams.Default.WithVolume(-2f));
|
||||
}
|
||||
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Chemistry
|
||||
{
|
||||
@@ -128,7 +129,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
_audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
||||
_audioSystem = EntitySystem.Get<AudioSystem>();
|
||||
_chemistrySystem = _entitySystemManager.GetEntitySystem<ChemistrySystem>();
|
||||
_reactions = _prototypeManager.EnumeratePrototypes<ReactionPrototype>();
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
}
|
||||
|
||||
// OK WE'RE GOOD CONSTRUCTION STARTED.
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/items/deconstruct.ogg", loc);
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/items/deconstruct.ogg", loc);
|
||||
if (prototype.Stages.Count == 2)
|
||||
{
|
||||
// Exactly 2 stages, so don't make an intermediate frame.
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Interfaces;
|
||||
using Content.Shared.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -75,7 +76,7 @@ namespace Content.Server.GameObjects.Components.Destructible
|
||||
_actSystem.HandleDestruction(Owner, true);
|
||||
if(destroySound != string.Empty)
|
||||
{
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play(destroySound, pos);
|
||||
EntitySystem.Get<AudioSystem>().Play(destroySound, pos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,10 @@ using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -20,6 +23,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly ILocalizationManager _localizationManager;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "Bucket";
|
||||
@@ -65,8 +69,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
return true;
|
||||
}
|
||||
|
||||
Owner.TryGetComponent(out SoundComponent soundComponent);
|
||||
soundComponent?.Play(_sound);
|
||||
EntitySystem.Get<AudioSystem>().Play(_sound, Owner);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -111,8 +114,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
return true;
|
||||
}
|
||||
|
||||
Owner.TryGetComponent(out SoundComponent soundComponent);
|
||||
soundComponent?.Play(_sound);
|
||||
EntitySystem.Get<AudioSystem>().Play(_sound, Owner);
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
@@ -5,7 +5,10 @@ using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
@@ -20,6 +23,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly ILocalizationManager _localizationManager;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "Mop";
|
||||
@@ -107,8 +111,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
return;
|
||||
}
|
||||
|
||||
Owner.TryGetComponent(out SoundComponent soundComponent);
|
||||
soundComponent?.Play(_pickupSound);
|
||||
EntitySystem.Get<AudioSystem>().Play(_pickupSound, Owner);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,10 @@ using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.Components.Container;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -27,6 +29,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly ISharedNotifyManager _notifyManager;
|
||||
[Dependency] private readonly ILocalizationManager _localizationManager;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] public float Wattage { get; set; } = 10;
|
||||
@@ -66,10 +69,8 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Owner.TryGetComponent(out SoundComponent soundComponent))
|
||||
{
|
||||
soundComponent.Play("/Audio/items/weapons/pistol_magin.ogg");
|
||||
}
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/items/weapons/pistol_magin.ogg", Owner);
|
||||
|
||||
|
||||
Dirty();
|
||||
|
||||
@@ -132,10 +133,8 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
SetState(false);
|
||||
Activated = false;
|
||||
|
||||
if (Owner.TryGetComponent(out SoundComponent soundComponent))
|
||||
{
|
||||
soundComponent.Play("/Audio/items/flashlight_toggle.ogg");
|
||||
}
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/items/flashlight_toggle.ogg", Owner);
|
||||
|
||||
}
|
||||
|
||||
private void TurnOn(IEntity user)
|
||||
@@ -146,13 +145,10 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
}
|
||||
|
||||
var cell = Cell;
|
||||
SoundComponent soundComponent;
|
||||
if (cell == null)
|
||||
{
|
||||
if (Owner.TryGetComponent(out soundComponent))
|
||||
{
|
||||
soundComponent.Play("/Audio/machines/button.ogg");
|
||||
}
|
||||
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/button.ogg", Owner);
|
||||
|
||||
_notifyManager.PopupMessage(Owner, user, _localizationManager.GetString("Cell missing..."));
|
||||
return;
|
||||
@@ -163,11 +159,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
// Simple enough.
|
||||
if (cell.AvailableCharge(1) < Wattage)
|
||||
{
|
||||
if (Owner.TryGetComponent(out soundComponent))
|
||||
{
|
||||
soundComponent.Play("/Audio/machines/button.ogg");
|
||||
}
|
||||
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/button.ogg", Owner);
|
||||
_notifyManager.PopupMessage(Owner, user, _localizationManager.GetString("Dead cell..."));
|
||||
return;
|
||||
}
|
||||
@@ -175,10 +167,8 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
Activated = true;
|
||||
SetState(true);
|
||||
|
||||
if (Owner.TryGetComponent(out soundComponent))
|
||||
{
|
||||
soundComponent.Play("/Audio/items/flashlight_toggle.ogg");
|
||||
}
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/items/flashlight_toggle.ogg", Owner);
|
||||
|
||||
}
|
||||
|
||||
private void SetState(bool on)
|
||||
@@ -225,10 +215,8 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
cell.Owner.Transform.GridPosition = user.Transform.GridPosition;
|
||||
}
|
||||
|
||||
if (Owner.TryGetComponent(out SoundComponent soundComponent))
|
||||
{
|
||||
soundComponent.Play("/Audio/items/weapons/pistol_magout.ogg");
|
||||
}
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/items/weapons/pistol_magout.ogg", Owner);
|
||||
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Serialization;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -66,7 +67,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
Owner.TryGetComponent(out _tool);
|
||||
Owner.TryGetComponent(out _sprite);
|
||||
|
||||
_audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
||||
_audioSystem = EntitySystem.Get<AudioSystem>();
|
||||
|
||||
SetTool();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
@@ -89,7 +90,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
_audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
||||
_audioSystem = EntitySystem.Get<AudioSystem>();
|
||||
_interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
|
||||
Owner.TryGetComponent(out _spriteComponent);
|
||||
}
|
||||
@@ -125,7 +126,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(name);
|
||||
var file = _robustRandom.Pick(soundCollection.PickFiles);
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>()
|
||||
EntitySystem.Get<AudioSystem>()
|
||||
.Play(file, Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,11 @@ using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Audio;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -22,6 +25,7 @@ namespace Content.Server.GameObjects.Components.Items
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
[Dependency] private readonly IRobustRandom _random;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "Dice";
|
||||
@@ -61,7 +65,7 @@ namespace Content.Server.GameObjects.Components.Items
|
||||
{
|
||||
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(_soundCollectionName);
|
||||
var file = _random.Pick(soundCollection.PickFiles);
|
||||
Owner.GetComponent<SoundComponent>().Play(file, AudioParams.Default);
|
||||
EntitySystem.Get<AudioSystem>().Play(file, Owner, AudioParams.Default);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Shared.Maps;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -53,8 +54,8 @@ namespace Content.Server.GameObjects.Components.Items
|
||||
{
|
||||
var desiredTile = _tileDefinitionManager[_outputTile];
|
||||
mapGrid.SetTile(eventArgs.ClickLocation, new Tile(desiredTile.TileId));
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/items/genhit.ogg", eventArgs.ClickLocation, AudioParams.Default);
|
||||
if(_stack.Count < 1){
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/items/genhit.ogg", eventArgs.ClickLocation);
|
||||
if(Stack.Count < 1){
|
||||
Owner.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,11 @@ using Content.Shared.GameObjects.Components.Storage;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.Components.Container;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -28,6 +30,9 @@ namespace Content.Server.GameObjects.Components
|
||||
[ComponentReference(typeof(IStorageComponent))]
|
||||
public class EntityStorageComponent : Component, IActivate, IStorageComponent, IInteractUsing
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
public override string Name => "EntityStorage";
|
||||
|
||||
private const float MaxSize = 1.0f; // maximum width or height of an entity allowed inside the storage.
|
||||
@@ -164,10 +169,7 @@ namespace Content.Server.GameObjects.Components
|
||||
}
|
||||
|
||||
ModifyComponents();
|
||||
if (Owner.TryGetComponent(out SoundComponent soundComponent))
|
||||
{
|
||||
soundComponent.Play("/Audio/machines/closetclose.ogg");
|
||||
}
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/closetclose.ogg", Owner);
|
||||
_lastInternalOpenAttempt = default;
|
||||
}
|
||||
|
||||
@@ -176,10 +178,8 @@ namespace Content.Server.GameObjects.Components
|
||||
Open = true;
|
||||
EmptyContents();
|
||||
ModifyComponents();
|
||||
if (Owner.TryGetComponent(out SoundComponent soundComponent))
|
||||
{
|
||||
soundComponent.Play("/Audio/machines/closetopen.ogg");
|
||||
}
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/closetopen.ogg", Owner);
|
||||
|
||||
}
|
||||
|
||||
private void ModifyComponents()
|
||||
|
||||
@@ -25,6 +25,7 @@ using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Server.BodySystem;
|
||||
using Content.Shared.BodySystem;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Kitchen
|
||||
{
|
||||
@@ -96,7 +97,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
_storage = ContainerManagerComponent.Ensure<Container>("microwave_entity_container", Owner, out var existed);
|
||||
_appearance = Owner.GetComponent<AppearanceComponent>();
|
||||
_powerDevice = Owner.GetComponent<PowerDeviceComponent>();
|
||||
_audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
||||
_audioSystem = EntitySystem.Get<AudioSystem>();
|
||||
_userInterface = Owner.GetComponent<ServerUserInterfaceComponent>()
|
||||
.GetBoundUserInterface(MicrowaveUiKey.Key);
|
||||
_userInterface.OnReceiveMessage += UserInterfaceOnReceiveMessage;
|
||||
|
||||
@@ -4,8 +4,11 @@ using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Random;
|
||||
@@ -20,6 +23,7 @@ namespace Content.Server.GameObjects.Components.Mining
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IRobustRandom _random;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override void Initialize()
|
||||
@@ -37,10 +41,9 @@ namespace Content.Server.GameObjects.Components.Mining
|
||||
Owner.GetComponent<DamageableComponent>().TakeDamage(DamageType.Brute, meleeWeaponComponent.Damage, item, eventArgs.User);
|
||||
|
||||
if (!item.TryGetComponent(out PickaxeComponent pickaxeComponent)) return true;
|
||||
if (!string.IsNullOrWhiteSpace(pickaxeComponent.MiningSound) &&
|
||||
item.TryGetComponent<SoundComponent>(out var soundComponent))
|
||||
if (!string.IsNullOrWhiteSpace(pickaxeComponent.MiningSound))
|
||||
{
|
||||
soundComponent.Play(pickaxeComponent.MiningSound, AudioParams.Default);
|
||||
EntitySystem.Get<AudioSystem>().Play(pickaxeComponent.MiningSound, Owner, AudioParams.Default);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Timers;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
@@ -169,7 +170,7 @@ namespace Content.Server.GameObjects.Components.Mobs
|
||||
_canHelp = false;
|
||||
Timer.Spawn(((int)_helpInterval*1000), () => _canHelp = true);
|
||||
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>()
|
||||
EntitySystem.Get<AudioSystem>()
|
||||
.Play("/Audio/effects/thudswoosh.ogg", Owner, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
_knockdownTimer -= _helpKnockdownRemove;
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
using Content.Server.GameObjects.Components.Sound;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Power;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.Components.UserInterface;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Power
|
||||
{
|
||||
@@ -14,6 +16,9 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public sealed class ApcComponent : SharedApcComponent, IActivate
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
PowerStorageComponent Storage;
|
||||
AppearanceComponent Appearance;
|
||||
private PowerProviderComponent _provider;
|
||||
@@ -119,7 +124,7 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
|
||||
private void _clickSound()
|
||||
{
|
||||
Owner.GetComponent<SoundComponent>().Play("/Audio/machines/machine_switch.ogg", AudioParams.Default.WithVolume(-2f));
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/machine_switch.ogg", AudioParams.Default.WithVolume(-2f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using Robust.Server.GameObjects.Components.Container;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -22,15 +23,16 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
[RegisterComponent]
|
||||
public class PoweredLightComponent : Component, IInteractHand, IInteractUsing
|
||||
{
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
public override string Name => "PoweredLight";
|
||||
|
||||
private static readonly TimeSpan _thunkDelay = TimeSpan.FromSeconds(2);
|
||||
|
||||
private TimeSpan _lastThunk;
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
private LightBulbType BulbType = LightBulbType.Tube;
|
||||
|
||||
@@ -80,7 +82,7 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
void Burn()
|
||||
{
|
||||
damageableComponent.TakeDamage(DamageType.Heat, 20, Owner);
|
||||
var audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
||||
var audioSystem = EntitySystem.Get<AudioSystem>();
|
||||
audioSystem.Play("/Audio/effects/lightburn.ogg", Owner);
|
||||
}
|
||||
|
||||
@@ -174,7 +176,7 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
if (time > _lastThunk + _thunkDelay)
|
||||
{
|
||||
_lastThunk = time;
|
||||
Owner.GetComponent<SoundComponent>().Play("/Audio/machines/light_tube_on.ogg", AudioParams.Default.WithVolume(-10f));
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/light_tube_on.ogg", Owner, AudioParams.Default.WithVolume(-10f));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -10,6 +10,7 @@ using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -121,7 +122,7 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
{
|
||||
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(_soundCollectionName);
|
||||
var file = _random.Pick(soundCollection.PickFiles);
|
||||
var audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
||||
var audioSystem = EntitySystem.Get<AudioSystem>();
|
||||
audioSystem.Play(file,Owner,AudioParams.Default);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using Content.Shared.Audio;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -15,10 +18,11 @@ namespace Content.Server.GameObjects.Components.Sound
|
||||
[RegisterComponent]
|
||||
public class FootstepModifierComponent : Component
|
||||
{
|
||||
#pragma warning disable 649
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
[Dependency] private readonly IRobustRandom _footstepRandom;
|
||||
#pragma warning restore 649
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
/// <inheritdoc />
|
||||
///
|
||||
|
||||
@@ -38,7 +42,7 @@ namespace Content.Server.GameObjects.Components.Sound
|
||||
{
|
||||
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(_soundCollectionName);
|
||||
var file = _footstepRandom.Pick(soundCollection.PickFiles);
|
||||
Owner.GetComponent<SoundComponent>().Play(file, AudioParams.Default.WithVolume(-2f));
|
||||
EntitySystem.Get<AudioSystem>().Play(file, Owner, AudioParams.Default.WithVolume(-2f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using Robust.Shared.Interfaces.Network;
|
||||
namespace Content.Server.GameObjects.Components.Sound
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class SoundComponent : SharedSoundComponent
|
||||
public class LoopingLoopingSoundComponent : SharedLoopingSoundComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Stops all sounds.
|
||||
@@ -6,6 +6,7 @@ using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Items;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Interfaces.Physics;
|
||||
@@ -109,7 +110,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
|
||||
if(OnHitEntities(hitEntities)) return;
|
||||
|
||||
var audioSystem = _entitySystemManager.GetEntitySystem<AudioSystem>();
|
||||
var audioSystem = EntitySystem.Get<AudioSystem>();
|
||||
var emitter = hitEntities.Count == 0 ? eventArgs.User : hitEntities[0];
|
||||
audioSystem.Play(hitEntities.Count > 0 ? _hitSound : "/Audio/weapons/punchmiss.ogg", emitter);
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ using Robust.Server.GameObjects.Components.Container;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -86,7 +87,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
if (!Activated || entities.Count == 0 || cell == null || !cell.CanDeductCharge(EnergyPerUse))
|
||||
return false;
|
||||
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/weapons/egloves.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/weapons/egloves.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
@@ -101,7 +102,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
cell.DeductCharge(EnergyPerUse);
|
||||
if(cell.Charge < EnergyPerUse)
|
||||
{
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().Play(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
TurnOff();
|
||||
}
|
||||
|
||||
@@ -132,7 +133,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
var sprite = Owner.GetComponent<SpriteComponent>();
|
||||
var item = Owner.GetComponent<ItemComponent>();
|
||||
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().Play(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
item.EquippedPrefix = "off";
|
||||
sprite.LayerSetState(0, "stunbaton_off");
|
||||
@@ -152,7 +153,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
|
||||
if (cell == null)
|
||||
{
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/machines/button.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/button.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
_notifyManager.PopupMessage(Owner, user, _localizationManager.GetString("Cell missing..."));
|
||||
return;
|
||||
@@ -160,12 +161,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
|
||||
if (cell.Charge < EnergyPerUse)
|
||||
{
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/machines/button.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/button.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
_notifyManager.PopupMessage(Owner, user, _localizationManager.GetString("Dead cell..."));
|
||||
return;
|
||||
}
|
||||
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().Play(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
item.EquippedPrefix = "on";
|
||||
sprite.LayerSetState(0, "stunbaton_on");
|
||||
@@ -192,7 +193,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
return false;
|
||||
}
|
||||
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/items/weapons/pistol_magin.ogg");
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/items/weapons/pistol_magin.ogg");
|
||||
|
||||
Dirty();
|
||||
|
||||
@@ -223,7 +224,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
cell.Owner.Transform.GridPosition = user.Transform.GridPosition;
|
||||
}
|
||||
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/items/weapons/pistol_magout.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/items/weapons/pistol_magout.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message)
|
||||
|
||||
@@ -27,6 +27,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
|
||||
[RegisterComponent]
|
||||
public class HitscanWeaponComponent : Component, IInteractUsing
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
private const float MaxLength = 20;
|
||||
public override string Name => "HitscanWeapon";
|
||||
|
||||
@@ -134,7 +137,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
|
||||
Shaded = false
|
||||
};
|
||||
EntitySystem.Get<EffectSystem>().CreateParticle(message);
|
||||
Owner.GetComponent<SoundComponent>().Play(_fireSound, AudioParams.Default.WithVolume(-5));
|
||||
EntitySystem.Get<AudioSystem>().Play(_fireSound, Owner, AudioParams.Default.WithVolume(-5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,11 @@ using Content.Shared.GameObjects.Components.Weapons.Ranged;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.Components.Container;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -28,6 +30,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
[RegisterComponent]
|
||||
public class BallisticMagazineWeaponComponent : BallisticWeaponComponent, IUse, IInteractUsing, IMapInit
|
||||
{
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
private const float BulletOffset = 0.2f;
|
||||
|
||||
public override string Name => "BallisticMagazineWeapon";
|
||||
@@ -105,7 +111,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
}
|
||||
if (_magInSound != null && playSound)
|
||||
{
|
||||
Owner.GetComponent<SoundComponent>().Play(_magInSound);
|
||||
EntitySystem.Get<AudioSystem>().Play(_magInSound, Owner);
|
||||
}
|
||||
magazinetype.OnAmmoCountChanged += MagazineAmmoCountChanged;
|
||||
if (GetChambered(0) == null)
|
||||
@@ -134,7 +140,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
entity.Transform.GridPosition = Owner.Transform.GridPosition;
|
||||
if (_magOutSound != null && playSound)
|
||||
{
|
||||
Owner.GetComponent<SoundComponent>().Play(_magOutSound, AudioParams.Default.WithVolume(20));
|
||||
EntitySystem.Get<AudioSystem>().Play(_magOutSound, Owner, AudioParams.Default.WithVolume(20));
|
||||
}
|
||||
UpdateAppearance();
|
||||
Dirty();
|
||||
@@ -160,7 +166,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
entity.Transform.GridPosition = Owner.Transform.GridPosition.Offset(offsetPos);
|
||||
entity.Transform.LocalRotation = _bulletDropRandom.Pick(RandomBulletDirs).ToAngle();
|
||||
var effect = $"/Audio/Guns/Casings/casingfall{_bulletDropRandom.Next(1, 4)}.ogg";
|
||||
Owner.GetComponent<SoundComponent>().Play(effect, AudioParams.Default.WithVolume(-3));
|
||||
EntitySystem.Get<AudioSystem>().Play(effect, Owner, AudioParams.Default.WithVolume(-3));
|
||||
|
||||
if (Magazine != null)
|
||||
{
|
||||
@@ -191,7 +197,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
EjectMagazine();
|
||||
if (_autoEjectSound != null)
|
||||
{
|
||||
Owner.GetComponent<SoundComponent>().Play(_autoEjectSound, AudioParams.Default.WithVolume(-5));
|
||||
EntitySystem.Get<AudioSystem>().Play(_autoEjectSound, Owner, AudioParams.Default.WithVolume(-5));
|
||||
}
|
||||
Dirty();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
{
|
||||
@@ -13,6 +16,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
/// </summary>
|
||||
public abstract class BallisticWeaponComponent : BaseProjectileWeaponComponent
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
private Chamber[] _chambers;
|
||||
|
||||
/// <summary>
|
||||
@@ -132,7 +139,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
return true;
|
||||
}
|
||||
|
||||
private void PlayEmptySound() => Owner.GetComponent<SoundComponent>().Play(_soundGunEmpty);
|
||||
private void PlayEmptySound() => EntitySystem.Get<AudioSystem>().Play(_soundGunEmpty, Owner);
|
||||
|
||||
protected sealed class Chamber
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Server.GameObjects.Components.Mobs;
|
||||
using Content.Server.GameObjects.Components.Projectiles;
|
||||
using Content.Server.GameObjects.Components.Sound;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -12,6 +11,8 @@ using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Physics;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
@@ -28,6 +29,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private IRobustRandom _spreadRandom;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
@@ -75,7 +77,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayFireSound() => Owner.GetComponent<SoundComponent>().Play(_soundGunshot);
|
||||
private void PlayFireSound() => EntitySystem.Get<AudioSystem>().Play(_soundGunshot, Owner);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the angle from an entity to a coordinate.
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
if (player.AttachedEntity == null
|
||||
|| player.AttachedEntity.Transform.GridID != gridId) continue;
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/effects/alert.ogg", player.AttachedEntity);
|
||||
EntitySystem.Get<AudioSystem>().Play("/Audio/effects/alert.ogg", player.AttachedEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Sound
|
||||
{
|
||||
public class SharedSoundComponent : Component
|
||||
public class SharedLoopingSoundComponent : Component
|
||||
{
|
||||
public override string Name => "Sound";
|
||||
public override uint? NetID => ContentNetIDs.SOUND;
|
||||
Reference in New Issue
Block a user