Refactor all references to AudioSystem functions now that the old ones are obsolete. (#1081)

Co-authored-by: FL-OZ <anotherscuffed@gmail.com>
This commit is contained in:
Memory
2020-06-07 08:55:15 -05:00
committed by GitHub
parent b8338bc64c
commit 21c41f28ed
40 changed files with 72 additions and 72 deletions

View File

@@ -128,7 +128,7 @@ namespace Content.Server.Explosions
Shaded = false Shaded = false
}; };
entitySystemManager.GetEntitySystem<EffectSystem>().CreateParticle(message); entitySystemManager.GetEntitySystem<EffectSystem>().CreateParticle(message);
entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/effects/explosion.ogg", coords); entitySystemManager.GetEntitySystem<AudioSystem>().PlayAtCoords("/Audio/effects/explosion.ogg", coords);
// Knock back cameras of all players in the area. // Knock back cameras of all players in the area.

View File

@@ -323,7 +323,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
private void ClickSound() private void ClickSound()
{ {
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f)); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/machines/machine_switch.ogg", Owner, AudioParams.Default.WithVolume(-2f));
} }

View File

@@ -288,7 +288,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
} }
else else
{ {
//This is trash but it shows the general idea //This is trash but it shows the general idea
var color = proto.SubstanceColor; var color = proto.SubstanceColor;
var colorIsh = "Red"; var colorIsh = "Red";
if (color.G > color.R) if (color.G > color.R)
@@ -492,7 +492,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
} }
//Play reaction sound client-side //Play reaction sound client-side
_audioSystem.Play("/Audio/effects/chemistry/bubbles.ogg", Owner.Transform.GridPosition); _audioSystem.PlayAtCoords("/Audio/effects/chemistry/bubbles.ogg", Owner.Transform.GridPosition);
} }
/// <summary> /// <summary>

View File

@@ -130,9 +130,9 @@ namespace Content.Server.GameObjects.Components.Construction
return false; return false;
} }
if (matStep.Material == MaterialType.Cable) if (matStep.Material == MaterialType.Cable)
sound.Play("/Audio/items/zip.ogg", Transform.GridPosition); sound.PlayAtCoords("/Audio/items/zip.ogg", Transform.GridPosition);
else else
sound.Play("/Audio/items/deconstruct.ogg", Transform.GridPosition); sound.PlayAtCoords("/Audio/items/deconstruct.ogg", Transform.GridPosition);
return true; return true;
case ConstructionStepTool toolStep: case ConstructionStepTool toolStep:
if (!slapped.TryGetComponent<ToolComponent>(out var tool)) if (!slapped.TryGetComponent<ToolComponent>(out var tool))

View File

@@ -84,7 +84,7 @@ namespace Content.Server.GameObjects.Components.Construction
} }
// OK WE'RE GOOD CONSTRUCTION STARTED. // OK WE'RE GOOD CONSTRUCTION STARTED.
EntitySystem.Get<AudioSystem>().Play("/Audio/items/deconstruct.ogg", loc); EntitySystem.Get<AudioSystem>().PlayAtCoords("/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.

View File

@@ -76,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)
{ {
EntitySystem.Get<AudioSystem>().Play(destroySound, pos); EntitySystem.Get<AudioSystem>().PlayAtCoords(destroySound, pos);
} }

View File

@@ -68,7 +68,7 @@ namespace Content.Server.GameObjects.Components.Fluids
return true; return true;
} }
EntitySystem.Get<AudioSystem>().Play(_sound, Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity(_sound, Owner);
return true; return true;
} }
@@ -113,7 +113,7 @@ namespace Content.Server.GameObjects.Components.Fluids
return true; return true;
} }
EntitySystem.Get<AudioSystem>().Play(_sound, Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity(_sound, Owner);
return true; return true;

View File

@@ -110,7 +110,7 @@ namespace Content.Server.GameObjects.Components.Fluids
return; return;
} }
EntitySystem.Get<AudioSystem>().Play(_pickupSound, Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity(_pickupSound, Owner);
} }
} }

View File

@@ -138,7 +138,7 @@ namespace Content.Server.GameObjects.Components.Fluids
return true; return true;
} }
EntitySystem.Get<AudioSystem>().Play(_spillSound); EntitySystem.Get<AudioSystem>().PlayAtCoords(_spillSound, Owner.Transform.GridPosition);
return true; return true;
} }

View File

@@ -68,7 +68,7 @@ namespace Content.Server.GameObjects.Components.Interactable
return false; return false;
} }
EntitySystem.Get<AudioSystem>().Play("/Audio/items/weapons/pistol_magin.ogg", Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/items/weapons/pistol_magin.ogg", Owner);
Dirty(); Dirty();
@@ -132,7 +132,7 @@ namespace Content.Server.GameObjects.Components.Interactable
SetState(false); SetState(false);
Activated = false; Activated = false;
EntitySystem.Get<AudioSystem>().Play("/Audio/items/flashlight_toggle.ogg", Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/items/flashlight_toggle.ogg", Owner);
} }
@@ -147,7 +147,7 @@ namespace Content.Server.GameObjects.Components.Interactable
if (cell == null) if (cell == null)
{ {
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/button.ogg", Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/machines/button.ogg", Owner);
_notifyManager.PopupMessage(Owner, user, _localizationManager.GetString("Cell missing...")); _notifyManager.PopupMessage(Owner, user, _localizationManager.GetString("Cell missing..."));
return; return;
@@ -158,7 +158,7 @@ namespace Content.Server.GameObjects.Components.Interactable
// Simple enough. // Simple enough.
if (cell.AvailableCharge(1) < Wattage) if (cell.AvailableCharge(1) < Wattage)
{ {
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/button.ogg", Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/machines/button.ogg", Owner);
_notifyManager.PopupMessage(Owner, user, _localizationManager.GetString("Dead cell...")); _notifyManager.PopupMessage(Owner, user, _localizationManager.GetString("Dead cell..."));
return; return;
} }
@@ -166,7 +166,7 @@ namespace Content.Server.GameObjects.Components.Interactable
Activated = true; Activated = true;
SetState(true); SetState(true);
EntitySystem.Get<AudioSystem>().Play("/Audio/items/flashlight_toggle.ogg", Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/items/flashlight_toggle.ogg", Owner);
} }
@@ -214,7 +214,7 @@ namespace Content.Server.GameObjects.Components.Interactable
cell.Owner.Transform.GridPosition = user.Transform.GridPosition; cell.Owner.Transform.GridPosition = user.Transform.GridPosition;
} }
EntitySystem.Get<AudioSystem>().Play("/Audio/items/weapons/pistol_magout.ogg", Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/items/weapons/pistol_magout.ogg", Owner);
} }

View File

@@ -74,7 +74,7 @@ namespace Content.Server.GameObjects.Components.Interactable
SetTool(); SetTool();
var current = _tools[_currentTool]; var current = _tools[_currentTool];
if(!string.IsNullOrEmpty(current.ChangeSound)) if(!string.IsNullOrEmpty(current.ChangeSound))
_audioSystem.Play(current.ChangeSound, Owner); _audioSystem.PlayFromEntity(current.ChangeSound, Owner);
} }
private void SetTool() private void SetTool()

View File

@@ -127,13 +127,13 @@ 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);
EntitySystem.Get<AudioSystem>() EntitySystem.Get<AudioSystem>()
.Play(file, Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume)); .PlayFromEntity(file, Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume));
} }
public void PlayUseSound(float volume=-5f) public void PlayUseSound(float volume=-5f)
{ {
if(string.IsNullOrEmpty(UseSoundCollection)) if(string.IsNullOrEmpty(UseSoundCollection))
_audioSystem.Play(UseSound, Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume)); _audioSystem.PlayFromEntity(UseSound, Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume));
else else
PlaySoundCollection(UseSoundCollection, volume); PlaySoundCollection(UseSoundCollection, volume);
} }

View File

@@ -64,7 +64,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);
EntitySystem.Get<AudioSystem>().Play(file, Owner, AudioParams.Default); EntitySystem.Get<AudioSystem>().PlayFromEntity(file, Owner, AudioParams.Default);
} }
} }

View File

@@ -53,7 +53,7 @@ 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));
EntitySystem.Get<AudioSystem>().Play("/Audio/items/genhit.ogg", eventArgs.ClickLocation); EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/items/genhit.ogg", eventArgs.ClickLocation);
if(_stack.Count < 1){ if(_stack.Count < 1){
Owner.Delete(); Owner.Delete();
} }

View File

@@ -166,7 +166,7 @@ namespace Content.Server.GameObjects.Components
} }
ModifyComponents(); ModifyComponents();
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/closetclose.ogg", Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/machines/closetclose.ogg", Owner);
_lastInternalOpenAttempt = default; _lastInternalOpenAttempt = default;
} }
@@ -175,7 +175,7 @@ namespace Content.Server.GameObjects.Components
Open = true; Open = true;
EmptyContents(); EmptyContents();
ModifyComponents(); ModifyComponents();
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/closetopen.ogg", Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/machines/closetopen.ogg", Owner);
} }

View File

@@ -108,7 +108,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
if (CheckAccess(user)) return; if (CheckAccess(user)) return;
Locked = false; Locked = false;
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/door_lock_off.ogg", Owner, AudioParams.Default.WithVolume(-5)); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/machines/door_lock_off.ogg", Owner, AudioParams.Default.WithVolume(-5));
} }
private void DoLock(IEntity user) private void DoLock(IEntity user)
@@ -116,7 +116,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
if (CheckAccess(user)) return; if (CheckAccess(user)) return;
Locked = true; Locked = true;
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/door_lock_on.ogg", Owner, AudioParams.Default.WithVolume(-5)); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/machines/door_lock_on.ogg", Owner, AudioParams.Default.WithVolume(-5));
} }
private bool CheckAccess(IEntity user) private bool CheckAccess(IEntity user)

View File

@@ -301,8 +301,8 @@ namespace Content.Server.GameObjects.Components.Kitchen
&& &&
(_currentCookTimerTime == (uint)recipeToCook.CookTime); (_currentCookTimerTime == (uint)recipeToCook.CookTime);
SetAppearance(MicrowaveVisualState.Cooking); SetAppearance(MicrowaveVisualState.Cooking);
_audioSystem.Play(_startCookingSound, Owner, AudioParams.Default); _audioSystem.PlayFromEntity(_startCookingSound, Owner, AudioParams.Default);
Timer.Spawn((int)(_currentCookTimerTime * _cookTimeMultiplier), () => Timer.Spawn((int)(_currentCookTimerTime * _cookTimeMultiplier), (System.Action)(() =>
{ {
if (_lostPower) if (_lostPower)
{ {
@@ -332,13 +332,13 @@ namespace Content.Server.GameObjects.Components.Kitchen
_entityManager.SpawnEntity(entityToSpawn, Owner.Transform.GridPosition); _entityManager.SpawnEntity(entityToSpawn, Owner.Transform.GridPosition);
} }
} }
_audioSystem.PlayFromEntity(_cookingCompleteSound, Owner, AudioParams.Default.WithVolume(-1f));
_audioSystem.Play(_cookingCompleteSound, Owner, AudioParams.Default.WithVolume(-1f));
SetAppearance(MicrowaveVisualState.Idle); SetAppearance(MicrowaveVisualState.Idle);
_busy = false; _busy = false;
_uiDirty = true; _uiDirty = true;
}); }));
_lostPower = false; _lostPower = false;
_uiDirty = true; _uiDirty = true;
} }
@@ -440,7 +440,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
private void ClickSound() private void ClickSound()
{ {
_audioSystem.Play("/Audio/machines/machine_switch.ogg",Owner,AudioParams.Default.WithVolume(-2f)); _audioSystem.PlayFromEntity("/Audio/machines/machine_switch.ogg",Owner,AudioParams.Default.WithVolume(-2f));
} }
public SuicideKind Suicide(IEntity victim, IChatManager chat) public SuicideKind Suicide(IEntity victim, IChatManager chat)

View File

@@ -42,7 +42,7 @@ namespace Content.Server.GameObjects.Components.Mining
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))
{ {
EntitySystem.Get<AudioSystem>().Play(pickaxeComponent.MiningSound, Owner, AudioParams.Default); EntitySystem.Get<AudioSystem>().PlayFromEntity(pickaxeComponent.MiningSound, Owner, AudioParams.Default);
} }
return true; return true;
} }

View File

@@ -170,7 +170,7 @@ namespace Content.Server.GameObjects.Components.Mobs
Timer.Spawn(((int)_helpInterval*1000), () => _canHelp = true); Timer.Spawn(((int)_helpInterval*1000), () => _canHelp = true);
EntitySystem.Get<AudioSystem>() EntitySystem.Get<AudioSystem>()
.Play("/Audio/effects/thudswoosh.ogg", Owner, AudioHelpers.WithVariation(0.25f)); .PlayFromEntity("/Audio/effects/thudswoosh.ogg", Owner, AudioHelpers.WithVariation(0.25f));
_knockdownTimer -= _helpKnockdownRemove; _knockdownTimer -= _helpKnockdownRemove;

View File

@@ -203,10 +203,10 @@ namespace Content.Server.GameObjects.Components.Movement
// Departure // Departure
// Do we need to rate-limit sounds to stop ear BLAST? // Do we need to rate-limit sounds to stop ear BLAST?
soundPlayer.Play(_departureSound, entity.Transform.GridPosition); soundPlayer.PlayAtCoords(_departureSound, entity.Transform.GridPosition);
entity.Transform.DetachParent(); entity.Transform.DetachParent();
entity.Transform.GridPosition = position; entity.Transform.GridPosition = position;
soundPlayer.Play(_arrivalSound, entity.Transform.GridPosition); soundPlayer.PlayAtCoords(_arrivalSound, entity.Transform.GridPosition);
TryChangeState(PortalState.RecentlyTeleported); TryChangeState(PortalState.RecentlyTeleported);
// To stop spam teleporting. Could potentially look at adding a timer to flush this from the portal // To stop spam teleporting. Could potentially look at adding a timer to flush this from the portal
immuneEntities.Add(entity); immuneEntities.Add(entity);

View File

@@ -144,7 +144,7 @@ namespace Content.Server.GameObjects.Components.Movement
if (_cooldownSound != null) if (_cooldownSound != null)
{ {
var soundPlayer = EntitySystem.Get<AudioSystem>(); var soundPlayer = EntitySystem.Get<AudioSystem>();
soundPlayer.Play(_cooldownSound, Owner); soundPlayer.PlayFromEntity(_cooldownSound, Owner);
} }
} }
@@ -249,12 +249,12 @@ namespace Content.Server.GameObjects.Components.Movement
else else
{ {
// Departure // Departure
soundPlayer.Play(_departureSound, user.Transform.GridPosition); soundPlayer.PlayAtCoords(_departureSound, user.Transform.GridPosition);
// Arrival // Arrival
user.Transform.DetachParent(); user.Transform.DetachParent();
user.Transform.WorldPosition = vector; user.Transform.WorldPosition = vector;
soundPlayer.Play(_arrivalSound, user.Transform.GridPosition); soundPlayer.PlayAtCoords(_arrivalSound, user.Transform.GridPosition);
} }
} }

View File

@@ -93,7 +93,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(_soundCollection); var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(_soundCollection);
var file = _random.Pick(soundCollection.PickFiles); var file = _random.Pick(soundCollection.PickFiles);
EntitySystem.Get<AudioSystem>().Play(file, args.User, AudioParams.Default); EntitySystem.Get<AudioSystem>().PlayFromEntity(file, args.User, AudioParams.Default);
_opened = true; _opened = true;
return false; return false;
} }
@@ -146,7 +146,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
if (stomachComponent.TryTransferSolution(split)) if (stomachComponent.TryTransferSolution(split))
{ {
if (_useSound == null) return false; if (_useSound == null) return false;
EntitySystem.Get<AudioSystem>().Play(_useSound, target, AudioParams.Default.WithVolume(-2f)); EntitySystem.Get<AudioSystem>().PlayFromEntity(_useSound, target, AudioParams.Default.WithVolume(-2f));
target.PopupMessage(target, Loc.GetString("Slurp")); target.PopupMessage(target, Loc.GetString("Slurp"));
UpdateAppearance(); UpdateAppearance();
return true; return true;

View File

@@ -85,7 +85,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
if (stomachComponent.TryTransferSolution(split)) if (stomachComponent.TryTransferSolution(split))
{ {
_entitySystem.GetEntitySystem<AudioSystem>() _entitySystem.GetEntitySystem<AudioSystem>()
.Play(_useSound, trueTarget, AudioParams.Default.WithVolume(-1f)); .PlayFromEntity(_useSound, trueTarget, AudioParams.Default.WithVolume(-1f));
trueTarget.PopupMessage(user, Loc.GetString("Nom")); trueTarget.PopupMessage(user, Loc.GetString("Nom"));
} }
else else

View File

@@ -87,7 +87,7 @@ namespace Content.Server.GameObjects.Components
private void Rustle() private void Rustle()
{ {
EntitySystem.Get<AudioSystem>() EntitySystem.Get<AudioSystem>()
.Play("/Audio/effects/plant_rustle.ogg", Owner, AudioHelpers.WithVariation(0.25f)); .PlayFromEntity("/Audio/effects/plant_rustle.ogg", Owner, AudioHelpers.WithVariation(0.25f));
} }
} }
} }

View File

@@ -121,7 +121,7 @@ namespace Content.Server.GameObjects.Components.Power
private void _clickSound() private void _clickSound()
{ {
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/machine_switch.ogg", AudioParams.Default.WithVolume(-2f)); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/machines/machine_switch.ogg", Owner,AudioParams.Default.WithVolume(-2f));
} }
} }
} }

View File

@@ -128,7 +128,7 @@ namespace Content.Server.GameObjects.Components.Power
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>("glassbreak"); var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>("glassbreak");
var file = _random.Pick(soundCollection.PickFiles); var file = _random.Pick(soundCollection.PickFiles);
EntitySystem.Get<AudioSystem>().Play(file, Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity(file, Owner);
State = LightBulbState.Broken; State = LightBulbState.Broken;
} }

View File

@@ -79,7 +79,7 @@ namespace Content.Server.GameObjects.Components.Power
{ {
damageableComponent.TakeDamage(DamageType.Heat, 20, Owner); damageableComponent.TakeDamage(DamageType.Heat, 20, Owner);
var audioSystem = EntitySystem.Get<AudioSystem>(); var audioSystem = EntitySystem.Get<AudioSystem>();
audioSystem.Play("/Audio/effects/lightburn.ogg", Owner); audioSystem.PlayFromEntity("/Audio/effects/lightburn.ogg", Owner);
} }
void Eject() void Eject()
@@ -172,7 +172,7 @@ namespace Content.Server.GameObjects.Components.Power
if (time > _lastThunk + _thunkDelay) if (time > _lastThunk + _thunkDelay)
{ {
_lastThunk = time; _lastThunk = time;
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/light_tube_on.ogg", Owner, AudioParams.Default.WithVolume(-10f)); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/machines/light_tube_on.ogg", Owner, AudioParams.Default.WithVolume(-10f));
} }
} }
else else

View File

@@ -122,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 = EntitySystem.Get<AudioSystem>(); var audioSystem = EntitySystem.Get<AudioSystem>();
audioSystem.Play(file,Owner,AudioParams.Default); audioSystem.PlayFromEntity(file,Owner,AudioParams.Default);
} }

View File

@@ -34,10 +34,10 @@ namespace Content.Server.GameObjects.Components.Sound
{ {
if (_pitchVariation > 0.0) if (_pitchVariation > 0.0)
{ {
EntitySystem.Get<AudioSystem>().Play(_soundName, Owner, AudioHelpers.WithVariation(_pitchVariation).WithVolume(-2f)); EntitySystem.Get<AudioSystem>().PlayFromEntity(_soundName, Owner, AudioHelpers.WithVariation(_pitchVariation).WithVolume(-2f));
return true; return true;
} }
EntitySystem.Get<AudioSystem>().Play(_soundName, Owner, AudioParams.Default.WithVolume(-2f)); EntitySystem.Get<AudioSystem>().PlayFromEntity(_soundName, Owner, AudioParams.Default.WithVolume(-2f));
return true; return true;
} }
return false; return false;

View File

@@ -41,7 +41,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);
EntitySystem.Get<AudioSystem>().Play(file, Owner, AudioParams.Default.WithVolume(-2f)); EntitySystem.Get<AudioSystem>().PlayFromEntity(file, Owner, AudioParams.Default.WithVolume(-2f));
} }
} }
} }

View File

@@ -112,7 +112,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
var audioSystem = EntitySystem.Get<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.PlayFromEntity(hitEntities.Count > 0 ? _hitSound : "/Audio/weapons/punchmiss.ogg", emitter);
if (Arc != null) if (Arc != null)
{ {

View File

@@ -86,7 +86,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;
EntitySystem.Get<AudioSystem>().Play("/Audio/weapons/egloves.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f)); EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/weapons/egloves.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
foreach (var entity in entities) foreach (var entity in entities)
{ {
@@ -101,7 +101,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
cell.DeductCharge(EnergyPerUse); cell.DeductCharge(EnergyPerUse);
if(cell.Charge < EnergyPerUse) if(cell.Charge < EnergyPerUse)
{ {
EntitySystem.Get<AudioSystem>().Play(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f)); EntitySystem.Get<AudioSystem>().PlayAtCoords(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
TurnOff(); TurnOff();
} }
@@ -132,7 +132,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>();
EntitySystem.Get<AudioSystem>().Play(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f)); EntitySystem.Get<AudioSystem>().PlayAtCoords(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 +152,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
if (cell == null) if (cell == null)
{ {
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/button.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f)); EntitySystem.Get<AudioSystem>().PlayAtCoords("/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 +160,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
if (cell.Charge < EnergyPerUse) if (cell.Charge < EnergyPerUse)
{ {
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/button.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f)); EntitySystem.Get<AudioSystem>().PlayAtCoords("/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;
} }
EntitySystem.Get<AudioSystem>().Play(AudioHelpers.GetRandomFileFromSoundCollection("sparks"), Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f)); EntitySystem.Get<AudioSystem>().PlayAtCoords(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 +192,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
return false; return false;
} }
EntitySystem.Get<AudioSystem>().Play("/Audio/items/weapons/pistol_magin.ogg"); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/items/weapons/pistol_magin.ogg", Owner);
Dirty(); Dirty();
@@ -223,7 +223,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
cell.Owner.Transform.GridPosition = user.Transform.GridPosition; cell.Owner.Transform.GridPosition = user.Transform.GridPosition;
} }
EntitySystem.Get<AudioSystem>().Play("/Audio/items/weapons/pistol_magout.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f)); EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/items/weapons/pistol_magout.ogg", Owner.Transform.GridPosition, AudioHelpers.WithVariation(0.25f));
} }
public void Examine(FormattedMessage message, bool inDetailsRange) public void Examine(FormattedMessage message, bool inDetailsRange)

View File

@@ -137,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);
EntitySystem.Get<AudioSystem>().Play(_fireSound, Owner, AudioParams.Default.WithVolume(-5)); EntitySystem.Get<AudioSystem>().PlayFromEntity(_fireSound, Owner, AudioParams.Default.WithVolume(-5));
} }
} }
} }

View File

@@ -107,7 +107,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
} }
if (_magInSound != null && playSound) if (_magInSound != null && playSound)
{ {
EntitySystem.Get<AudioSystem>().Play(_magInSound, Owner); EntitySystem.Get<AudioSystem>().PlayFromEntity(_magInSound, Owner);
} }
magazinetype.OnAmmoCountChanged += MagazineAmmoCountChanged; magazinetype.OnAmmoCountChanged += MagazineAmmoCountChanged;
if (GetChambered(0) == null) if (GetChambered(0) == null)
@@ -136,7 +136,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)
{ {
EntitySystem.Get<AudioSystem>().Play(_magOutSound, Owner, AudioParams.Default.WithVolume(20)); EntitySystem.Get<AudioSystem>().PlayFromEntity(_magOutSound, Owner, AudioParams.Default.WithVolume(20));
} }
UpdateAppearance(); UpdateAppearance();
Dirty(); Dirty();
@@ -162,7 +162,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";
EntitySystem.Get<AudioSystem>().Play(effect, Owner, AudioParams.Default.WithVolume(-3)); EntitySystem.Get<AudioSystem>().PlayFromEntity(effect, Owner, AudioParams.Default.WithVolume(-3));
if (Magazine != null) if (Magazine != null)
{ {
@@ -193,7 +193,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
EjectMagazine(); EjectMagazine();
if (_autoEjectSound != null) if (_autoEjectSound != null)
{ {
EntitySystem.Get<AudioSystem>().Play(_autoEjectSound, Owner, AudioParams.Default.WithVolume(-5)); EntitySystem.Get<AudioSystem>().PlayFromEntity(_autoEjectSound, Owner, AudioParams.Default.WithVolume(-5));
} }
Dirty(); Dirty();
} }

View File

@@ -135,7 +135,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
return true; return true;
} }
private void PlayEmptySound() => EntitySystem.Get<AudioSystem>().Play(_soundGunEmpty, Owner); private void PlayEmptySound() => EntitySystem.Get<AudioSystem>().PlayFromEntity(_soundGunEmpty, Owner);
protected sealed class Chamber protected sealed class Chamber
{ {

View File

@@ -76,7 +76,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
} }
} }
private void PlayFireSound() => EntitySystem.Get<AudioSystem>().Play(_soundGunshot, Owner); private void PlayFireSound() => EntitySystem.Get<AudioSystem>().PlayFromEntity(_soundGunshot, Owner);
/// <summary> /// <summary>
/// Gets the angle from an entity to a coordinate. /// Gets the angle from an entity to a coordinate.

View File

@@ -428,7 +428,7 @@ namespace Content.Server.GameObjects.Components
return; return;
} }
_audioSystem.Play("/Audio/effects/multitool_pulse.ogg", Owner); _audioSystem.PlayFromEntity("/Audio/effects/multitool_pulse.ogg", Owner);
break; break;
} }
@@ -474,7 +474,7 @@ namespace Content.Server.GameObjects.Components
IsPanelOpen = !IsPanelOpen; IsPanelOpen = !IsPanelOpen;
EntitySystem.Get<AudioSystem>() EntitySystem.Get<AudioSystem>()
.Play(IsPanelOpen ? "/Audio/machines/screwdriveropen.ogg" : "/Audio/machines/screwdriverclose.ogg", .PlayFromEntity(IsPanelOpen ? "/Audio/machines/screwdriveropen.ogg" : "/Audio/machines/screwdriverclose.ogg",
Owner); Owner);
return true; return true;
} }

View File

@@ -93,7 +93,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;
EntitySystem.Get<AudioSystem>().Play("/Audio/effects/alert.ogg", player.AttachedEntity); EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/effects/alert.ogg", player.AttachedEntity);
} }
} }

View File

@@ -330,7 +330,7 @@ namespace Content.Server.GameObjects.EntitySystems
{ {
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(soundCollectionName); var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(soundCollectionName);
var file = _robustRandom.Pick(soundCollection.PickFiles); var file = _robustRandom.Pick(soundCollection.PickFiles);
_audioSystem.Play(file, coordinates); _audioSystem.PlayAtCoords(file, coordinates);
} }
catch (UnknownPrototypeException) catch (UnknownPrototypeException)
{ {

View File

@@ -35,7 +35,7 @@ namespace Content.Server.Mobs
if (playSound) if (playSound)
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>() IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>()
.Play(AudioHelpers.GetRandomFileFromSoundCollection("bodyfall"), entity, AudioHelpers.WithVariation(0.25f)); .PlayFromEntity(AudioHelpers.GetRandomFileFromSoundCollection("bodyfall"), entity, AudioHelpers.WithVariation(0.25f));
if(dropItems) if(dropItems)
DropAllItemsInHands(entity); DropAllItemsInHands(entity);