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