Owner Transform to Owner in SoundSystem calls (#4460)

* Owner Transform to Owner

* Owner Transform to Owner minor fixes
This commit is contained in:
ColdAutumnRain
2021-08-18 23:36:57 +02:00
committed by GitHub
parent 77d7d3c383
commit db48f0cc2d
12 changed files with 35 additions and 35 deletions

View File

@@ -12,7 +12,7 @@ namespace Content.Server.Chemistry.EntitySystems
{ {
base.OnReaction(reaction, owner, unitReactions); base.OnReaction(reaction, owner, unitReactions);
SoundSystem.Play(Filter.Pvs(owner), reaction.Sound.GetSound(), owner.Transform.Coordinates); SoundSystem.Play(Filter.Pvs(owner), reaction.Sound.GetSound(), owner);
} }
} }
} }

View File

@@ -266,7 +266,7 @@ namespace Content.Server.Disposal.Tube.Components
} }
_lastClang = _gameTiming.CurTime; _lastClang = _gameTiming.CurTime;
SoundSystem.Play(Filter.Pvs(Owner), _clangSound.GetSound(), Owner.Transform.Coordinates); SoundSystem.Play(Filter.Pvs(Owner), _clangSound.GetSound(), Owner);
break; break;
} }
} }

View File

@@ -92,7 +92,7 @@ namespace Content.Server.Flash
}); });
} }
SoundSystem.Play(Filter.Pvs(comp.Owner), comp.Sound.GetSound(), comp.Owner.Transform.Coordinates, AudioParams.Default); SoundSystem.Play(Filter.Pvs(comp.Owner), comp.Sound.GetSound(), comp.Owner, AudioParams.Default);
return true; return true;
} }

View File

@@ -190,7 +190,7 @@ namespace Content.Server.Fluids.Components
return true; return true;
} }
SoundSystem.Play(Filter.Pvs(Owner), _spillSound.GetSound(), Owner.Transform.Coordinates); SoundSystem.Play(Filter.Pvs(Owner), _spillSound.GetSound(), Owner);
return true; return true;
} }

View File

@@ -93,7 +93,7 @@ namespace Content.Server.Radiation
_endTime = currentTime + TimeSpan.FromSeconds(_duration); _endTime = currentTime + TimeSpan.FromSeconds(_duration);
} }
SoundSystem.Play(Filter.Pvs(Owner), Sound.GetSound(), Owner.Transform.Coordinates); SoundSystem.Play(Filter.Pvs(Owner), Sound.GetSound(), Owner);
Dirty(); Dirty();
} }

View File

@@ -119,7 +119,7 @@ namespace Content.Server.Stunnable
{ {
if (!entity.TryGetComponent(out StunnableComponent? stunnable) || !comp.Activated) return; if (!entity.TryGetComponent(out StunnableComponent? stunnable) || !comp.Activated) return;
SoundSystem.Play(Filter.Pvs(comp.Owner), comp.StunSound.GetSound(), comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); SoundSystem.Play(Filter.Pvs(comp.Owner), comp.StunSound.GetSound(), comp.Owner, AudioHelpers.WithVariation(0.25f));
if (!stunnable.SlowedDown) if (!stunnable.SlowedDown)
{ {
if (_robustRandom.Prob(comp.ParalyzeChanceNoSlowdown)) if (_robustRandom.Prob(comp.ParalyzeChanceNoSlowdown))
@@ -139,7 +139,7 @@ namespace Content.Server.Stunnable
if (!comp.Owner.TryGetComponent<PowerCellSlotComponent>(out var slot) || slot.Cell == null || !(slot.Cell.CurrentCharge < comp.EnergyPerUse)) if (!comp.Owner.TryGetComponent<PowerCellSlotComponent>(out var slot) || slot.Cell == null || !(slot.Cell.CurrentCharge < comp.EnergyPerUse))
return; return;
SoundSystem.Play(Filter.Pvs(comp.Owner), comp.SparksSound.GetSound(), comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); SoundSystem.Play(Filter.Pvs(comp.Owner), comp.SparksSound.GetSound(), comp.Owner, AudioHelpers.WithVariation(0.25f));
TurnOff(comp); TurnOff(comp);
} }
@@ -153,7 +153,7 @@ namespace Content.Server.Stunnable
if (!comp.Owner.TryGetComponent<SpriteComponent>(out var sprite) || if (!comp.Owner.TryGetComponent<SpriteComponent>(out var sprite) ||
!comp.Owner.TryGetComponent<ItemComponent>(out var item)) return; !comp.Owner.TryGetComponent<ItemComponent>(out var item)) return;
SoundSystem.Play(Filter.Pvs(comp.Owner), comp.SparksSound.GetSound(), comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); SoundSystem.Play(Filter.Pvs(comp.Owner), comp.SparksSound.GetSound(), comp.Owner, AudioHelpers.WithVariation(0.25f));
item.EquippedPrefix = "off"; item.EquippedPrefix = "off";
// TODO stunbaton visualizer // TODO stunbaton visualizer
sprite.LayerSetState(0, "stunbaton_off"); sprite.LayerSetState(0, "stunbaton_off");
@@ -177,19 +177,19 @@ namespace Content.Server.Stunnable
if (slot.Cell == null) if (slot.Cell == null)
{ {
SoundSystem.Play(playerFilter, comp.TurnOnFailSound.GetSound(), comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); SoundSystem.Play(playerFilter, comp.TurnOnFailSound.GetSound(), comp.Owner, AudioHelpers.WithVariation(0.25f));
user.PopupMessage(Loc.GetString("comp-stunbaton-activated-missing-cell")); user.PopupMessage(Loc.GetString("comp-stunbaton-activated-missing-cell"));
return; return;
} }
if (slot.Cell != null && slot.Cell.CurrentCharge < comp.EnergyPerUse) if (slot.Cell != null && slot.Cell.CurrentCharge < comp.EnergyPerUse)
{ {
SoundSystem.Play(playerFilter, comp.TurnOnFailSound.GetSound(), comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); SoundSystem.Play(playerFilter, comp.TurnOnFailSound.GetSound(), comp.Owner, AudioHelpers.WithVariation(0.25f));
user.PopupMessage(Loc.GetString("comp-stunbaton-activated-dead-cell")); user.PopupMessage(Loc.GetString("comp-stunbaton-activated-dead-cell"));
return; return;
} }
SoundSystem.Play(playerFilter, comp.SparksSound.GetSound(), comp.Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f)); SoundSystem.Play(playerFilter, comp.SparksSound.GetSound(), comp.Owner, AudioHelpers.WithVariation(0.25f));
item.EquippedPrefix = "on"; item.EquippedPrefix = "on";
sprite.LayerSetState(0, "stunbaton_on"); sprite.LayerSetState(0, "stunbaton_on");

View File

@@ -75,12 +75,12 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
if (value) if (value)
{ {
TryEjectChamber(); TryEjectChamber();
SoundSystem.Play(Filter.Pvs(Owner), _soundBoltOpen.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundBoltOpen.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
} }
else else
{ {
TryFeedChamber(); TryFeedChamber();
SoundSystem.Play(Filter.Pvs(Owner), _soundBoltClosed.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundBoltClosed.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
} }
_boltOpen = value; _boltOpen = value;
@@ -219,7 +219,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
} }
else else
{ {
SoundSystem.Play(Filter.Pvs(Owner), _soundCycle.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundCycle.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
} }
Dirty(); Dirty();
@@ -248,7 +248,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
if (_chamberContainer.ContainedEntity == null) if (_chamberContainer.ContainedEntity == null)
{ {
_chamberContainer.Insert(ammo); _chamberContainer.Insert(ammo);
SoundSystem.Play(Filter.Pvs(Owner), _soundInsert.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundInsert.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
Dirty(); Dirty();
UpdateAppearance(); UpdateAppearance();
return true; return true;
@@ -258,7 +258,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
{ {
_ammoContainer.Insert(ammo); _ammoContainer.Insert(ammo);
_spawnedAmmo.Push(ammo); _spawnedAmmo.Push(ammo);
SoundSystem.Play(Filter.Pvs(Owner), _soundInsert.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundInsert.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
Dirty(); Dirty();
UpdateAppearance(); UpdateAppearance();
return true; return true;

View File

@@ -190,7 +190,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
if (manual) if (manual)
{ {
SoundSystem.Play(Filter.Pvs(Owner), _soundCycle.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundCycle.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
} }
Dirty(); Dirty();
@@ -216,7 +216,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
_spawnedAmmo.Push(eventArgs.Using); _spawnedAmmo.Push(eventArgs.Using);
Dirty(); Dirty();
UpdateAppearance(); UpdateAppearance();
SoundSystem.Play(Filter.Pvs(Owner), _soundInsert.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundInsert.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
return true; return true;
} }

View File

@@ -165,7 +165,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
_currentSlot = i; _currentSlot = i;
_ammoSlots[i] = entity; _ammoSlots[i] = entity;
_ammoContainer.Insert(entity); _ammoContainer.Insert(entity);
SoundSystem.Play(Filter.Pvs(Owner), _soundInsert.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundInsert.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
Dirty(); Dirty();
UpdateAppearance(); UpdateAppearance();
@@ -192,7 +192,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
{ {
var random = _random.Next(_ammoSlots.Length - 1); var random = _random.Next(_ammoSlots.Length - 1);
_currentSlot = random; _currentSlot = random;
SoundSystem.Play(Filter.Pvs(Owner), _soundSpin.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundSpin.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
Dirty(); Dirty();
} }
@@ -243,7 +243,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
if (_ammoContainer.ContainedEntities.Count > 0) if (_ammoContainer.ContainedEntities.Count > 0)
{ {
SoundSystem.Play(Filter.Pvs(Owner), _soundEject.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-1)); SoundSystem.Play(Filter.Pvs(Owner), _soundEject.GetSound(), Owner, AudioParams.Default.WithVolume(-1));
} }
// May as well point back at the end? // May as well point back at the end?

View File

@@ -223,7 +223,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
return false; return false;
} }
SoundSystem.Play(Filter.Pvs(Owner), _soundPowerCellInsert.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundPowerCellInsert.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
_powerCellContainer.Insert(entity); _powerCellContainer.Insert(entity);
@@ -273,7 +273,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
cell.Owner.Transform.Coordinates = user.Transform.Coordinates; cell.Owner.Transform.Coordinates = user.Transform.Coordinates;
} }
SoundSystem.Play(Filter.Pvs(Owner), _soundPowerCellEject.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundPowerCellEject.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
return true; return true;
} }

View File

@@ -98,12 +98,12 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
if (value) if (value)
{ {
TryEjectChamber(); TryEjectChamber();
SoundSystem.Play(Filter.Pvs(Owner), _soundBoltOpen.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundBoltOpen.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
} }
else else
{ {
TryFeedChamber(); TryFeedChamber();
SoundSystem.Play(Filter.Pvs(Owner), _soundBoltClosed.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundBoltClosed.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
} }
_boltOpen = value; _boltOpen = value;
@@ -223,7 +223,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
if (_chamberContainer.ContainedEntity == null && !BoltOpen) if (_chamberContainer.ContainedEntity == null && !BoltOpen)
{ {
SoundSystem.Play(Filter.Pvs(Owner), _soundBoltOpen.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-5)); SoundSystem.Play(Filter.Pvs(Owner), _soundBoltOpen.GetSound(), Owner, AudioParams.Default.WithVolume(-5));
if (Owner.TryGetContainer(out var container)) if (Owner.TryGetContainer(out var container))
{ {
@@ -235,7 +235,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
if (manual) if (manual)
{ {
SoundSystem.Play(Filter.Pvs(Owner), _soundRack.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundRack.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
} }
Dirty(); Dirty();
@@ -260,7 +260,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
if (BoltOpen) if (BoltOpen)
{ {
SoundSystem.Play(Filter.Pvs(Owner), _soundBoltClosed.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-5)); SoundSystem.Play(Filter.Pvs(Owner), _soundBoltClosed.GetSound(), Owner, AudioParams.Default.WithVolume(-5));
Owner.PopupMessage(eventArgs.User, Loc.GetString("server-magazine-barrel-component-use-entity-bolt-closed")); Owner.PopupMessage(eventArgs.User, Loc.GetString("server-magazine-barrel-component-use-entity-bolt-closed"));
BoltOpen = false; BoltOpen = false;
return true; return true;
@@ -311,7 +311,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
if (_autoEjectMag && magazine != null && magazine.GetComponent<RangedMagazineComponent>().ShotsLeft == 0) if (_autoEjectMag && magazine != null && magazine.GetComponent<RangedMagazineComponent>().ShotsLeft == 0)
{ {
SoundSystem.Play(Filter.Pvs(Owner), _soundAutoEject.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundAutoEject.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
_magazineContainer.Remove(magazine); _magazineContainer.Remove(magazine);
SendNetworkMessage(new MagazineAutoEjectMessage()); SendNetworkMessage(new MagazineAutoEjectMessage());
@@ -335,7 +335,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
} }
_magazineContainer.Remove(mag); _magazineContainer.Remove(mag);
SoundSystem.Play(Filter.Pvs(Owner), _soundMagEject.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundMagEject.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
if (user.TryGetComponent(out HandsComponent? handsComponent)) if (user.TryGetComponent(out HandsComponent? handsComponent))
{ {
@@ -371,7 +371,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
if (_magazineContainer.ContainedEntity == null) if (_magazineContainer.ContainedEntity == null)
{ {
SoundSystem.Play(Filter.Pvs(Owner), _soundMagInsert.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2)); SoundSystem.Play(Filter.Pvs(Owner), _soundMagInsert.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
Owner.PopupMessage(eventArgs.User, Loc.GetString("server-magazine-barrel-component-interact-using-success")); Owner.PopupMessage(eventArgs.User, Loc.GetString("server-magazine-barrel-component-interact-using-success"));
_magazineContainer.Insert(eventArgs.Using); _magazineContainer.Insert(eventArgs.Using);
Dirty(); Dirty();

View File

@@ -197,7 +197,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
{ {
if (ShotsLeft == 0) if (ShotsLeft == 0)
{ {
SoundSystem.Play(Filter.Broadcast(), SoundEmpty.GetSound(), Owner.Transform.Coordinates); SoundSystem.Play(Filter.Broadcast(), SoundEmpty.GetSound(), Owner);
return; return;
} }
@@ -205,7 +205,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
var projectile = TakeProjectile(shooter.Transform.Coordinates); var projectile = TakeProjectile(shooter.Transform.Coordinates);
if (projectile == null) if (projectile == null)
{ {
SoundSystem.Play(Filter.Broadcast(), SoundEmpty.GetSound(), Owner.Transform.Coordinates); SoundSystem.Play(Filter.Broadcast(), SoundEmpty.GetSound(), Owner);
return; return;
} }
@@ -245,7 +245,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
SoundSystem.Play(Filter.Broadcast(), SoundGunshot.GetSound(), Owner.Transform.Coordinates); SoundSystem.Play(Filter.Broadcast(), SoundGunshot.GetSound(), Owner);
_lastFire = _gameTiming.CurTime; _lastFire = _gameTiming.CurTime;
} }
@@ -276,7 +276,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
entity.Transform.Coordinates = entity.Transform.Coordinates.Offset(offsetPos); entity.Transform.Coordinates = entity.Transform.Coordinates.Offset(offsetPos);
entity.Transform.LocalRotation = robustRandom.Pick(ejectDirections).ToAngle(); entity.Transform.LocalRotation = robustRandom.Pick(ejectDirections).ToAngle();
SoundSystem.Play(Filter.Broadcast(), ammo.SoundCollectionEject.GetSound(), entity.Transform.Coordinates, AudioParams.Default.WithVolume(-1)); SoundSystem.Play(Filter.Broadcast(), ammo.SoundCollectionEject.GetSound(), entity.Transform.Coordinates, AudioParams.Default.WithVolume(-1));
} }
/// <summary> /// <summary>