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
};
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.

View File

@@ -323,7 +323,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
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

@@ -492,7 +492,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
}
//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>

View File

@@ -130,9 +130,9 @@ namespace Content.Server.GameObjects.Components.Construction
return false;
}
if (matStep.Material == MaterialType.Cable)
sound.Play("/Audio/items/zip.ogg", Transform.GridPosition);
sound.PlayAtCoords("/Audio/items/zip.ogg", Transform.GridPosition);
else
sound.Play("/Audio/items/deconstruct.ogg", Transform.GridPosition);
sound.PlayAtCoords("/Audio/items/deconstruct.ogg", Transform.GridPosition);
return true;
case ConstructionStepTool toolStep:
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.
EntitySystem.Get<AudioSystem>().Play("/Audio/items/deconstruct.ogg", loc);
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/items/deconstruct.ogg", loc);
if (prototype.Stages.Count == 2)
{
// 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);
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;
}
EntitySystem.Get<AudioSystem>().Play(_sound, Owner);
EntitySystem.Get<AudioSystem>().PlayFromEntity(_sound, Owner);
return true;
}
@@ -113,7 +113,7 @@ namespace Content.Server.GameObjects.Components.Fluids
return true;
}
EntitySystem.Get<AudioSystem>().Play(_sound, Owner);
EntitySystem.Get<AudioSystem>().PlayFromEntity(_sound, Owner);
return true;

View File

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

View File

@@ -68,7 +68,7 @@ namespace Content.Server.GameObjects.Components.Interactable
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();
@@ -132,7 +132,7 @@ namespace Content.Server.GameObjects.Components.Interactable
SetState(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)
{
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..."));
return;
@@ -158,7 +158,7 @@ namespace Content.Server.GameObjects.Components.Interactable
// Simple enough.
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..."));
return;
}
@@ -166,7 +166,7 @@ namespace Content.Server.GameObjects.Components.Interactable
Activated = 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;
}
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();
var current = _tools[_currentTool];
if(!string.IsNullOrEmpty(current.ChangeSound))
_audioSystem.Play(current.ChangeSound, Owner);
_audioSystem.PlayFromEntity(current.ChangeSound, Owner);
}
private void SetTool()

View File

@@ -127,13 +127,13 @@ namespace Content.Server.GameObjects.Components.Interactable
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(name);
var file = _robustRandom.Pick(soundCollection.PickFiles);
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)
{
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
PlaySoundCollection(UseSoundCollection, volume);
}

View File

@@ -64,7 +64,7 @@ namespace Content.Server.GameObjects.Components.Items
{
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(_soundCollectionName);
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];
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){
Owner.Delete();
}

View File

@@ -166,7 +166,7 @@ namespace Content.Server.GameObjects.Components
}
ModifyComponents();
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/closetclose.ogg", Owner);
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/machines/closetclose.ogg", Owner);
_lastInternalOpenAttempt = default;
}
@@ -175,7 +175,7 @@ namespace Content.Server.GameObjects.Components
Open = true;
EmptyContents();
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;
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)
@@ -116,7 +116,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
if (CheckAccess(user)) return;
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)

View File

@@ -301,8 +301,8 @@ namespace Content.Server.GameObjects.Components.Kitchen
&&
(_currentCookTimerTime == (uint)recipeToCook.CookTime);
SetAppearance(MicrowaveVisualState.Cooking);
_audioSystem.Play(_startCookingSound, Owner, AudioParams.Default);
Timer.Spawn((int)(_currentCookTimerTime * _cookTimeMultiplier), () =>
_audioSystem.PlayFromEntity(_startCookingSound, Owner, AudioParams.Default);
Timer.Spawn((int)(_currentCookTimerTime * _cookTimeMultiplier), (System.Action)(() =>
{
if (_lostPower)
{
@@ -332,13 +332,13 @@ namespace Content.Server.GameObjects.Components.Kitchen
_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);
_busy = false;
_uiDirty = true;
});
}));
_lostPower = false;
_uiDirty = true;
}
@@ -440,7 +440,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
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)

View File

@@ -42,7 +42,7 @@ namespace Content.Server.GameObjects.Components.Mining
if (!item.TryGetComponent(out PickaxeComponent pickaxeComponent)) return true;
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;
}

View File

@@ -170,7 +170,7 @@ namespace Content.Server.GameObjects.Components.Mobs
Timer.Spawn(((int)_helpInterval*1000), () => _canHelp = true);
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;

View File

@@ -203,10 +203,10 @@ namespace Content.Server.GameObjects.Components.Movement
// Departure
// 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.GridPosition = position;
soundPlayer.Play(_arrivalSound, entity.Transform.GridPosition);
soundPlayer.PlayAtCoords(_arrivalSound, entity.Transform.GridPosition);
TryChangeState(PortalState.RecentlyTeleported);
// To stop spam teleporting. Could potentially look at adding a timer to flush this from the portal
immuneEntities.Add(entity);

View File

@@ -144,7 +144,7 @@ namespace Content.Server.GameObjects.Components.Movement
if (_cooldownSound != null)
{
var soundPlayer = EntitySystem.Get<AudioSystem>();
soundPlayer.Play(_cooldownSound, Owner);
soundPlayer.PlayFromEntity(_cooldownSound, Owner);
}
}
@@ -249,12 +249,12 @@ namespace Content.Server.GameObjects.Components.Movement
else
{
// Departure
soundPlayer.Play(_departureSound, user.Transform.GridPosition);
soundPlayer.PlayAtCoords(_departureSound, user.Transform.GridPosition);
// Arrival
user.Transform.DetachParent();
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 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;
return false;
}
@@ -146,7 +146,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
if (stomachComponent.TryTransferSolution(split))
{
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"));
UpdateAppearance();
return true;

View File

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

View File

@@ -87,7 +87,7 @@ namespace Content.Server.GameObjects.Components
private void Rustle()
{
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()
{
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 file = _random.Pick(soundCollection.PickFiles);
EntitySystem.Get<AudioSystem>().Play(file, Owner);
EntitySystem.Get<AudioSystem>().PlayFromEntity(file, Owner);
State = LightBulbState.Broken;
}

View File

@@ -79,7 +79,7 @@ namespace Content.Server.GameObjects.Components.Power
{
damageableComponent.TakeDamage(DamageType.Heat, 20, Owner);
var audioSystem = EntitySystem.Get<AudioSystem>();
audioSystem.Play("/Audio/effects/lightburn.ogg", Owner);
audioSystem.PlayFromEntity("/Audio/effects/lightburn.ogg", Owner);
}
void Eject()
@@ -172,7 +172,7 @@ namespace Content.Server.GameObjects.Components.Power
if (time > _lastThunk + _thunkDelay)
{
_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

View File

@@ -122,7 +122,7 @@ namespace Content.Server.GameObjects.Components.Research
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(_soundCollectionName);
var file = _random.Pick(soundCollection.PickFiles);
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)
{
EntitySystem.Get<AudioSystem>().Play(_soundName, Owner, AudioHelpers.WithVariation(_pitchVariation).WithVolume(-2f));
EntitySystem.Get<AudioSystem>().PlayFromEntity(_soundName, Owner, AudioHelpers.WithVariation(_pitchVariation).WithVolume(-2f));
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 false;

View File

@@ -41,7 +41,7 @@ namespace Content.Server.GameObjects.Components.Sound
{
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(_soundCollectionName);
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 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)
{

View File

@@ -86,7 +86,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
if (!Activated || entities.Count == 0 || cell == null || !cell.CanDeductCharge(EnergyPerUse))
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)
{
@@ -101,7 +101,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
cell.DeductCharge(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();
}
@@ -132,7 +132,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
var sprite = Owner.GetComponent<SpriteComponent>();
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";
sprite.LayerSetState(0, "stunbaton_off");
@@ -152,7 +152,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
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..."));
return;
@@ -160,12 +160,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
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..."));
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";
sprite.LayerSetState(0, "stunbaton_on");
@@ -192,7 +192,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
return false;
}
EntitySystem.Get<AudioSystem>().Play("/Audio/items/weapons/pistol_magin.ogg");
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/items/weapons/pistol_magin.ogg", Owner);
Dirty();
@@ -223,7 +223,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
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)

View File

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

View File

@@ -135,7 +135,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
return true;
}
private void PlayEmptySound() => EntitySystem.Get<AudioSystem>().Play(_soundGunEmpty, Owner);
private void PlayEmptySound() => EntitySystem.Get<AudioSystem>().PlayFromEntity(_soundGunEmpty, Owner);
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>
/// Gets the angle from an entity to a coordinate.

View File

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

View File

@@ -93,7 +93,7 @@ namespace Content.Server.GameObjects.EntitySystems
{
if (player.AttachedEntity == null
|| 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 file = _robustRandom.Pick(soundCollection.PickFiles);
_audioSystem.Play(file, coordinates);
_audioSystem.PlayAtCoords(file, coordinates);
}
catch (UnknownPrototypeException)
{

View File

@@ -35,7 +35,7 @@ namespace Content.Server.Mobs
if (playSound)
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)
DropAllItemsInHands(entity);