removed TryGetSound + made some SoundSpecifier datafields required

This commit is contained in:
Galactic Chimp
2021-07-31 19:52:33 +02:00
parent 8ff703c338
commit 57016d14b4
114 changed files with 519 additions and 785 deletions

View File

@@ -59,10 +59,7 @@ namespace Content.Client.Disposal.Visualizers
var sound = new AnimationTrackPlaySound();
_flushAnimation.AnimationTracks.Add(sound);
if (_flushSound.TryGetSound(out var flushSound))
{
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(flushSound, 0));
}
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_flushSound.GetSound(), 0));
}
private void ChangeState(AppearanceComponent appearance)

View File

@@ -55,10 +55,7 @@ namespace Content.Client.Doors
var sound = new AnimationTrackPlaySound();
CloseAnimation.AnimationTracks.Add(sound);
if (_closeSound.TryGetSound(out var closeSound))
{
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(closeSound, 0));
}
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_closeSound.GetSound(), 0));
}
OpenAnimation = new Animation {Length = TimeSpan.FromSeconds(_delay)};
@@ -81,10 +78,7 @@ namespace Content.Client.Doors
var sound = new AnimationTrackPlaySound();
OpenAnimation.AnimationTracks.Add(sound);
if (_openSound.TryGetSound(out var openSound))
{
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(openSound, 0));
}
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_openSound.GetSound(), 0));
}
DenyAnimation = new Animation {Length = TimeSpan.FromSeconds(0.3f)};
@@ -97,10 +91,7 @@ namespace Content.Client.Doors
var sound = new AnimationTrackPlaySound();
DenyAnimation.AnimationTracks.Add(sound);
if (_denySound.TryGetSound(out var denySound))
{
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(denySound, 0, () => AudioHelpers.WithVariation(0.05f)));
}
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_denySound.GetSound(), 0, () => AudioHelpers.WithVariation(0.05f)));
}
}

View File

@@ -18,7 +18,7 @@ namespace Content.Client.Light.Visualizers
{
[DataField("minBlinkingTime")] private float _minBlinkingTime = 0.5f;
[DataField("maxBlinkingTime")] private float _maxBlinkingTime = 2;
[DataField("blinkingSound")] private SoundSpecifier _blinkingSound = default!;
[DataField("blinkingSound", required: true)] private SoundSpecifier _blinkingSound = default!;
private bool _wasBlinking;
@@ -97,7 +97,7 @@ namespace Content.Client.Light.Visualizers
var randomTime = random.NextFloat() *
(_maxBlinkingTime - _minBlinkingTime) + _minBlinkingTime;
var blinkingAnim = new Animation()
var blinkingAnim = new Animation()
{
Length = TimeSpan.FromSeconds(randomTime),
AnimationTracks =
@@ -123,18 +123,15 @@ namespace Content.Client.Light.Visualizers
}
}
}
};
};
if (_blinkingSound.TryGetSound(out var blinkingSound))
blinkingAnim.AnimationTracks.Add(new AnimationTrackPlaySound()
{
blinkingAnim.AnimationTracks.Add(new AnimationTrackPlaySound()
KeyFrames =
{
KeyFrames =
{
new AnimationTrackPlaySound.KeyFrame(blinkingSound, 0.5f)
}
});
}
new AnimationTrackPlaySound.KeyFrame(_blinkingSound.GetSound(), 0.5f)
}
});
return blinkingAnim;
}

View File

@@ -24,16 +24,14 @@ namespace Content.Client.PDA
public override void HandleNetworkMessage(ComponentMessage message, INetChannel netChannel, ICommonSession? session = null)
{
base.HandleNetworkMessage(message, netChannel, session);
switch(message)
switch (message)
{
case PDAUplinkBuySuccessMessage:
if(BuySuccessSound.TryGetSound(out var buySuccessSound))
SoundSystem.Play(Filter.Local(), buySuccessSound, Owner, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Local(), BuySuccessSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
break;
case PDAUplinkInsufficientFundsMessage:
if(InsufficientFundsSound.TryGetSound(out var insufficientFundsSound))
SoundSystem.Play(Filter.Local(), insufficientFundsSound, Owner, AudioParams.Default);
SoundSystem.Play(Filter.Local(), InsufficientFundsSound.GetSound(), Owner, AudioParams.Default);
break;
}
}

View File

@@ -15,7 +15,7 @@ namespace Content.Client.Trigger
{
private const string AnimationKey = "priming_animation";
[DataField("countdown_sound", required: true)]
[DataField("countdown_sound")]
private SoundSpecifier _countdownSound = default!;
private Animation PrimingAnimation = default!;
@@ -29,12 +29,9 @@ namespace Content.Client.Trigger
flick.LayerKey = TriggerVisualLayers.Base;
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("primed", 0f));
if (_countdownSound.TryGetSound(out var countdownSound))
{
var sound = new AnimationTrackPlaySound();
PrimingAnimation.AnimationTracks.Add(sound);
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(countdownSound, 0));
}
var sound = new AnimationTrackPlaySound();
PrimingAnimation.AnimationTracks.Add(sound);
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_countdownSound.GetSound(), 0));
}
}

View File

@@ -75,7 +75,7 @@ namespace Content.Server.AME.Components
internal void OnUpdate(float frameTime)
{
if(!_injecting)
if (!_injecting)
{
return;
}
@@ -88,11 +88,11 @@ namespace Content.Server.AME.Components
}
var jar = _jarSlot.ContainedEntity;
if(jar is null)
if (jar is null)
return;
jar.TryGetComponent<AMEFuelContainerComponent>(out var fuelJar);
if(fuelJar != null && _powerSupplier != null)
if (fuelJar != null && _powerSupplier != null)
{
var availableInject = fuelJar.FuelAmount >= InjectionAmount ? InjectionAmount : fuelJar.FuelAmount;
_powerSupplier.MaxSupply = group.InjectFuel(availableInject, out var overloading);
@@ -105,7 +105,7 @@ namespace Content.Server.AME.Components
UpdateDisplay(_stability);
if(_stability <= 0) { group.ExplodeCores(); }
if (_stability <= 0) { group.ExplodeCores(); }
}
@@ -229,7 +229,7 @@ namespace Content.Server.AME.Components
return;
var jar = _jarSlot.ContainedEntity;
if(jar is null)
if (jar is null)
return;
_jarSlot.Remove(jar);
@@ -262,7 +262,7 @@ namespace Content.Server.AME.Components
private void UpdateDisplay(int stability)
{
if(_appearance == null) { return; }
if (_appearance == null) { return; }
_appearance.TryGetData<string>(AMEControllerVisuals.DisplayState, out var state);
@@ -291,7 +291,7 @@ namespace Content.Server.AME.Components
private bool IsMasterController()
{
if(GetAMENodeGroup()?.MasterController == this)
if (GetAMENodeGroup()?.MasterController == this)
{
return true;
}
@@ -315,14 +315,12 @@ namespace Content.Server.AME.Components
private void ClickSound()
{
if(_clickSound.TryGetSound(out var clickSound))
SoundSystem.Play(Filter.Pvs(Owner), clickSound, Owner, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
}
private void InjectSound(bool overloading)
{
if(_injectSound.TryGetSound(out var injectSound))
SoundSystem.Play(Filter.Pvs(Owner), injectSound, Owner, AudioParams.Default.WithVolume(overloading ? 10f : 0f));
SoundSystem.Play(Filter.Pvs(Owner), _injectSound.GetSound(), Owner, AudioParams.Default.WithVolume(overloading ? 10f : 0f));
}
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs args)

View File

@@ -51,8 +51,7 @@ namespace Content.Server.AME.Components
var ent = _serverEntityManager.SpawnEntity("AMEShielding", mapGrid.GridTileToLocal(snapPos));
ent.Transform.LocalRotation = Owner.Transform.LocalRotation;
if(_unwrapSound.TryGetSound(out var unwrapSound))
SoundSystem.Play(Filter.Pvs(Owner), unwrapSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _unwrapSound.GetSound(), Owner);
Owner.Delete();

View File

@@ -78,8 +78,7 @@ namespace Content.Server.Actions.Actions
if (random.Prob(_failProb))
{
if(PunchMissSound.TryGetSound(out var punchMissSound))
SoundSystem.Play(Filter.Pvs(args.Performer), punchMissSound, args.Performer, AudioHelpers.WithVariation(0.025f));
SoundSystem.Play(Filter.Pvs(args.Performer), PunchMissSound.GetSound(), args.Performer, AudioHelpers.WithVariation(0.025f));
args.Performer.PopupMessageOtherClients(Loc.GetString("disarm-action-popup-message-other-clients",
("performerName", args.Performer.Name),
@@ -90,9 +89,9 @@ namespace Content.Server.Actions.Actions
return;
}
system.SendAnimation("disarm", angle, args.Performer, args.Performer, new []{ args.Target });
system.SendAnimation("disarm", angle, args.Performer, args.Performer, new[] { args.Target });
var eventArgs = new DisarmedActEventArgs() {Target = args.Target, Source = args.Performer, PushProbability = _pushProb};
var eventArgs = new DisarmedActEventArgs() { Target = args.Target, Source = args.Performer, PushProbability = _pushProb };
// Sort by priority.
Array.Sort(disarmedActs, (a, b) => a.Priority.CompareTo(b.Priority));
@@ -103,8 +102,7 @@ namespace Content.Server.Actions.Actions
return;
}
if(DisarmSuccessSound.TryGetSound(out var disarmSuccessSound))
SoundSystem.Play(Filter.Pvs(args.Performer), disarmSuccessSound, args.Performer.Transform.Coordinates, AudioHelpers.WithVariation(0.025f));
SoundSystem.Play(Filter.Pvs(args.Performer), DisarmSuccessSound.GetSound(), args.Performer.Transform.Coordinates, AudioHelpers.WithVariation(0.025f));
}
}
}

View File

@@ -26,9 +26,9 @@ namespace Content.Server.Actions.Actions
[Dependency] private readonly IRobustRandom _random = default!;
[DataField("male")] private SoundSpecifier _male = default!;
[DataField("female")] private SoundSpecifier _female = default!;
[DataField("wilhelm")] private SoundSpecifier _wilhelm = default!;
[DataField("male", required: true)] private SoundSpecifier _male = default!;
[DataField("female", required: true)] private SoundSpecifier _female = default!;
[DataField("wilhelm", required: true)] private SoundSpecifier _wilhelm = default!;
/// seconds
[DataField("cooldown")] private float _cooldown = 10;
@@ -44,21 +44,19 @@ namespace Content.Server.Actions.Actions
if (!args.Performer.TryGetComponent<HumanoidAppearanceComponent>(out var humanoid)) return;
if (!args.Performer.TryGetComponent<SharedActionsComponent>(out var actions)) return;
if (_random.Prob(.01f) && _wilhelm.TryGetSound(out var wilhelm))
if (_random.Prob(.01f))
{
SoundSystem.Play(Filter.Pvs(args.Performer), wilhelm, args.Performer, AudioParams.Default.WithVolume(Volume));
SoundSystem.Play(Filter.Pvs(args.Performer), _wilhelm.GetSound(), args.Performer, AudioParams.Default.WithVolume(Volume));
}
else
{
switch (humanoid.Sex)
{
case Sex.Male:
if (_male.TryGetSound(out var male))
SoundSystem.Play(Filter.Pvs(args.Performer), male, args.Performer, AudioHelpers.WithVariation(Variation).WithVolume(Volume));
SoundSystem.Play(Filter.Pvs(args.Performer), _male.GetSound(), args.Performer, AudioHelpers.WithVariation(Variation).WithVolume(Volume));
break;
case Sex.Female:
if (_female.TryGetSound(out var female))
SoundSystem.Play(Filter.Pvs(args.Performer), female, args.Performer, AudioHelpers.WithVariation(Variation).WithVolume(Volume));
SoundSystem.Play(Filter.Pvs(args.Performer), _female.GetSound(), args.Performer, AudioHelpers.WithVariation(Variation).WithVolume(Volume));
break;
default:
throw new ArgumentOutOfRangeException();

View File

@@ -28,7 +28,7 @@ namespace Content.Server.Actions.Spells
[ViewVariables] [DataField("cooldown")] public float CoolDown { get; set; } = 1f;
[ViewVariables] [DataField("spellItem")] public string ItemProto { get; set; } = default!;
[ViewVariables] [DataField("castSound")] public SoundSpecifier CastSound { get; set; } = default!;
[ViewVariables] [DataField("castSound", required: true)] public SoundSpecifier CastSound { get; set; } = default!;
//Rubber-band snapping items into player's hands, originally was a workaround, later found it works quite well with stuns
//Not sure if needs fixing
@@ -69,8 +69,7 @@ namespace Content.Server.Actions.Spells
handsComponent.PutInHandOrDrop(itemComponent);
if (CastSound.TryGetSound(out var castSound))
SoundSystem.Play(Filter.Pvs(caster), castSound, caster);
SoundSystem.Play(Filter.Pvs(caster), CastSound.GetSound(), caster);
}
}
}

View File

@@ -45,18 +45,26 @@ namespace Content.Server.Arcade.Components
[DataField("winSound")] private SoundSpecifier _winSound = new SoundPathSpecifier("/Audio/Effects/Arcade/win.ogg");
[DataField("gameOverSound")] private SoundSpecifier _gameOverSound = new SoundPathSpecifier("/Audio/Effects/Arcade/gameover.ogg");
[ViewVariables(VVAccess.ReadWrite)] [DataField("possibleFightVerbs")] private List<string> _possibleFightVerbs = new List<string>()
[ViewVariables(VVAccess.ReadWrite)]
[DataField("possibleFightVerbs")]
private List<string> _possibleFightVerbs = new List<string>()
{"Defeat", "Annihilate", "Save", "Strike", "Stop", "Destroy", "Robust", "Romance", "Pwn", "Own"};
[ViewVariables(VVAccess.ReadWrite)] [DataField("possibleFirstEnemyNames")] private List<string> _possibleFirstEnemyNames = new List<string>(){
[ViewVariables(VVAccess.ReadWrite)]
[DataField("possibleFirstEnemyNames")]
private List<string> _possibleFirstEnemyNames = new List<string>(){
"the Automatic", "Farmer", "Lord", "Professor", "the Cuban", "the Evil", "the Dread King",
"the Space", "Lord", "the Great", "Duke", "General"
};
[ViewVariables(VVAccess.ReadWrite)] [DataField("possibleLastEnemyNames")] private List<string> _possibleLastEnemyNames = new List<string>()
[ViewVariables(VVAccess.ReadWrite)]
[DataField("possibleLastEnemyNames")]
private List<string> _possibleLastEnemyNames = new List<string>()
{
"Melonoid", "Murdertron", "Sorcerer", "Ruin", "Jeff", "Ectoplasm", "Crushulon", "Uhangoid",
"Vhakoid", "Peteoid", "slime", "Griefer", "ERPer", "Lizard Man", "Unicorn"
};
[ViewVariables(VVAccess.ReadWrite)] [DataField("possibleRewards")] private List<string> _possibleRewards = new List<string>()
[ViewVariables(VVAccess.ReadWrite)]
[DataField("possibleRewards")]
private List<string> _possibleRewards = new List<string>()
{
"ToyMouse", "ToyAi", "ToyNuke", "ToyAssistant", "ToyGriffin", "ToyHonk", "ToyIan",
"ToyMarauder", "ToyMauler", "ToyGygax", "ToyOdysseus", "ToyOwlman", "ToyDeathRipley",
@@ -65,10 +73,10 @@ namespace Content.Server.Arcade.Components
void IActivate.Activate(ActivateEventArgs eventArgs)
{
if(!Powered || !eventArgs.User.TryGetComponent(out ActorComponent? actor))
if (!Powered || !eventArgs.User.TryGetComponent(out ActorComponent? actor))
return;
if(!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
return;
_game ??= new SpaceVillainGame(this);
@@ -76,7 +84,8 @@ namespace Content.Server.Arcade.Components
if (_wiresComponent?.IsPanelOpen == true)
{
_wiresComponent.OpenInterface(actor.PlayerSession);
} else
}
else
{
UserInterface?.Toggle(actor.PlayerSession);
}
@@ -105,7 +114,7 @@ namespace Content.Server.Arcade.Components
private void OnOnPowerStateChanged(PowerChangedMessage e)
{
if(e.Powered) return;
if (e.Powered) return;
UserInterface?.CloseAll();
}
@@ -130,8 +139,7 @@ namespace Content.Server.Arcade.Components
_game?.ExecutePlayerAction(msg.PlayerAction);
break;
case PlayerAction.NewGame:
if(_newGameSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioParams.Default.WithVolume(-4f));
SoundSystem.Play(Filter.Pvs(Owner), _newGameSound.GetSound(), Owner, AudioParams.Default.WithVolume(-4f));
_game = new SpaceVillainGame(this);
UserInterface?.SendMessage(_game.GenerateMetaDataMessage());
@@ -260,7 +268,7 @@ namespace Content.Server.Arcade.Components
private string _latestPlayerActionMessage = "";
private string _latestEnemyActionMessage = "";
public SpaceVillainGame(SpaceVillainArcadeComponent owner) : this(owner, owner.GenerateFightVerb(), owner.GenerateEnemyName()){}
public SpaceVillainGame(SpaceVillainArcadeComponent owner) : this(owner, owner.GenerateFightVerb(), owner.GenerateEnemyName()) { }
public SpaceVillainGame(SpaceVillainArcadeComponent owner, string fightVerb, string enemyName)
{
@@ -277,7 +285,7 @@ namespace Content.Server.Arcade.Components
/// </summary>
private void ValidateVars()
{
if(_owner._overflowFlag) return;
if (_owner._overflowFlag) return;
if (_playerHp > _playerHpMax) _playerHp = _playerHpMax;
if (_playerMp > _playerMpMax) _playerMp = _playerMpMax;
@@ -300,9 +308,8 @@ namespace Content.Server.Arcade.Components
_latestPlayerActionMessage = Loc.GetString("space-villain-game-player-attack-message",
("enemyName", _enemyName),
("attackAmount", attackAmount));
if(_owner._playerAttackSound.TryGetSound(out var playerAttackSound))
SoundSystem.Play(Filter.Pvs(_owner.Owner), playerAttackSound, _owner.Owner, AudioParams.Default.WithVolume(-4f));
if(!_owner._enemyInvincibilityFlag)
SoundSystem.Play(Filter.Pvs(_owner.Owner), _owner._playerAttackSound.GetSound(), _owner.Owner, AudioParams.Default.WithVolume(-4f));
if (!_owner._enemyInvincibilityFlag)
_enemyHp -= attackAmount;
_turtleTracker -= _turtleTracker > 0 ? 1 : 0;
break;
@@ -312,18 +319,16 @@ namespace Content.Server.Arcade.Components
_latestPlayerActionMessage = Loc.GetString("space-villain-game-player-heal-message",
("magicPointAmount", pointAmount),
("healAmount", healAmount));
if(_owner._playerHealSound.TryGetSound(out var playerHealSound))
SoundSystem.Play(Filter.Pvs(_owner.Owner), playerHealSound, _owner.Owner, AudioParams.Default.WithVolume(-4f));
if(!_owner._playerInvincibilityFlag)
SoundSystem.Play(Filter.Pvs(_owner.Owner), _owner._playerHealSound.GetSound(), _owner.Owner, AudioParams.Default.WithVolume(-4f));
if (!_owner._playerInvincibilityFlag)
_playerMp -= pointAmount;
_playerHp += healAmount;
_turtleTracker++;
break;
case PlayerAction.Recharge:
var chargeAmount = _random.Next(4, 7);
_latestPlayerActionMessage = Loc.GetString("space-villain-game-player-recharge-message",("regainedPoints", chargeAmount));
if(_owner._playerChargeSound.TryGetSound(out var playerChargeSound))
SoundSystem.Play(Filter.Pvs(_owner.Owner), playerChargeSound, _owner.Owner, AudioParams.Default.WithVolume(-4f));
_latestPlayerActionMessage = Loc.GetString("space-villain-game-player-recharge-message", ("regainedPoints", chargeAmount));
SoundSystem.Play(Filter.Pvs(_owner.Owner), _owner._playerChargeSound.GetSound(), _owner.Owner, AudioParams.Default.WithVolume(-4f));
_playerMp += chargeAmount;
_turtleTracker -= _turtleTracker > 0 ? 1 : 0;
break;
@@ -355,10 +360,9 @@ namespace Content.Server.Arcade.Components
{
_running = false;
UpdateUi(Loc.GetString("space-villain-game-player-wins-message"),
Loc.GetString("space-villain-game-enemy-dies-message",("enemyName", _enemyName)),
Loc.GetString("space-villain-game-enemy-dies-message", ("enemyName", _enemyName)),
true);
if(_owner._winSound.TryGetSound(out var winSound))
SoundSystem.Play(Filter.Pvs(_owner.Owner), winSound, _owner.Owner, AudioParams.Default.WithVolume(-4f));
SoundSystem.Play(Filter.Pvs(_owner.Owner), _owner._winSound.GetSound(), _owner.Owner, AudioParams.Default.WithVolume(-4f));
_owner.ProcessWin();
return false;
}
@@ -369,10 +373,9 @@ namespace Content.Server.Arcade.Components
{
_running = false;
UpdateUi(Loc.GetString("space-villain-game-player-loses-message"),
Loc.GetString("space-villain-game-enemy-cheers-message",("enemyName", _enemyName)),
Loc.GetString("space-villain-game-enemy-cheers-message", ("enemyName", _enemyName)),
true);
if(_owner._gameOverSound.TryGetSound(out var gameOverSound))
SoundSystem.Play(Filter.Pvs(_owner.Owner), gameOverSound, _owner.Owner, AudioParams.Default.WithVolume(-4f));
SoundSystem.Play(Filter.Pvs(_owner.Owner), _owner._gameOverSound.GetSound(), _owner.Owner, AudioParams.Default.WithVolume(-4f));
return false;
}
if (_enemyHp <= 0 || _enemyMp <= 0)
@@ -381,8 +384,7 @@ namespace Content.Server.Arcade.Components
UpdateUi(Loc.GetString("space-villain-game-player-loses-message"),
Loc.GetString("space-villain-game-enemy-dies-with-player-message ", ("enemyName", _enemyName)),
true);
if (_owner._gameOverSound.TryGetSound(out var gameOverSound))
SoundSystem.Play(Filter.Pvs(_owner.Owner), gameOverSound, _owner.Owner, AudioParams.Default.WithVolume(-4f));
SoundSystem.Play(Filter.Pvs(_owner.Owner), _owner._gameOverSound.GetSound(), _owner.Owner, AudioParams.Default.WithVolume(-4f));
return false;
}
@@ -419,7 +421,8 @@ namespace Content.Server.Arcade.Components
if (_owner._playerInvincibilityFlag) return;
_playerHp -= boomAmount;
_turtleTracker--;
}else if (_enemyMp <= 5 && _random.Prob(0.7f))
}
else if (_enemyMp <= 5 && _random.Prob(0.7f))
{
var stealAmount = _random.Next(2, 3);
_latestEnemyActionMessage = Loc.GetString("space-villain-game-enemy-steals-player-power-message",
@@ -428,7 +431,8 @@ namespace Content.Server.Arcade.Components
if (_owner._playerInvincibilityFlag) return;
_playerMp -= stealAmount;
_enemyMp += stealAmount;
}else if (_enemyHp <= 10 && _enemyMp > 4)
}
else if (_enemyHp <= 10 && _enemyMp > 4)
{
_enemyHp += 4;
_enemyMp -= 4;

View File

@@ -284,8 +284,7 @@ namespace Content.Server.Atmos.Components
if(environment != null)
atmosphereSystem.Merge(environment, Air);
if(_ruptureSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.125f));
SoundSystem.Play(Filter.Pvs(Owner), _ruptureSound.GetSound(), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.125f));
Owner.QueueDelete();
return;

View File

@@ -104,8 +104,7 @@ namespace Content.Server.Body
{
base.Gib(gibParts);
if(_gibSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.025f));
SoundSystem.Play(Filter.Pvs(Owner), _gibSound.GetSound(), Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.025f));
if (Owner.TryGetComponent(out ContainerManagerComponent? container))
{

View File

@@ -723,10 +723,7 @@ namespace Content.Server.Botany.Components
sprayed = true;
amount = ReagentUnit.New(1);
if (spray.SpraySound.TryGetSound(out var spraySound))
{
SoundSystem.Play(Filter.Pvs(usingItem), spraySound, usingItem, AudioHelpers.WithVariation(0.125f));
}
SoundSystem.Play(Filter.Pvs(usingItem), spray.SpraySound.GetSound(), usingItem, AudioHelpers.WithVariation(0.125f));
}
var split = solution.Drain(amount);

View File

@@ -50,7 +50,7 @@ namespace Content.Server.Buckle.Components
/// </summary>
[DataField("delay")]
[ViewVariables]
private TimeSpan _unbuckleDelay = TimeSpan.FromSeconds(0.25f);
private TimeSpan _unbuckleDelay = TimeSpan.FromSeconds(0.25f);
/// <summary>
/// The time that this entity buckled at.
@@ -199,7 +199,7 @@ namespace Content.Server.Buckle.Components
{
var message = Loc.GetString(Owner == user
? "buckle-component-already-buckled-message"
: "buckle-component-other-already-buckled-message",("owner", Owner));
: "buckle-component-other-already-buckled-message", ("owner", Owner));
Owner.PopupMessage(user, message);
return false;
@@ -212,7 +212,7 @@ namespace Content.Server.Buckle.Components
{
var message = Loc.GetString(Owner == user
? "buckle-component-cannot-buckle-message"
: "buckle-component-other-cannot-buckle-message",("owner", Owner));
: "buckle-component-other-cannot-buckle-message", ("owner", Owner));
Owner.PopupMessage(user, message);
return false;
@@ -225,7 +225,7 @@ namespace Content.Server.Buckle.Components
{
var message = Loc.GetString(Owner == user
? "buckle-component-cannot-fit-message"
: "buckle-component-other-cannot-fit-message",("owner", Owner));
: "buckle-component-other-cannot-fit-message", ("owner", Owner));
Owner.PopupMessage(user, message);
return false;
@@ -241,16 +241,13 @@ namespace Content.Server.Buckle.Components
return false;
}
if(strap.BuckleSound.TryGetSound(out var buckleSound))
{
SoundSystem.Play(Filter.Pvs(Owner), buckleSound, Owner);
}
SoundSystem.Play(Filter.Pvs(Owner), strap.BuckleSound.GetSound(), Owner);
if (!strap.TryAdd(this))
{
var message = Loc.GetString(Owner == user
? "buckle-component-cannot-buckle-message"
: "buckle-component-other-cannot-buckle-message",("owner", Owner));
: "buckle-component-other-cannot-buckle-message", ("owner", Owner));
Owner.PopupMessage(user, message);
return false;
}
@@ -352,11 +349,8 @@ namespace Content.Server.Buckle.Components
UpdateBuckleStatus();
oldBuckledTo.Remove(this);
if (oldBuckledTo.UnbuckleSound.TryGetSound(out var unbuckleSound))
{
SoundSystem.Play(Filter.Pvs(Owner), unbuckleSound, Owner);
}
SoundSystem.Play(Filter.Pvs(Owner), oldBuckledTo.UnbuckleSound.GetSound(), Owner);
SendMessage(new UnbuckleMessage(Owner, oldBuckledTo.Owner));
return true;

View File

@@ -24,7 +24,7 @@ namespace Content.Server.Cabinet
/// Sound to be played when the cabinet door is opened.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("doorSound")]
[DataField("doorSound", required: true)]
public SoundSpecifier DoorSound { get; set; } = default!;
/// <summary>

View File

@@ -36,7 +36,7 @@ namespace Content.Server.Cabinet
comp.ItemContainer =
owner.EnsureContainer<ContainerSlot>("item_cabinet", out _);
if(comp.SpawnPrototype != null)
if (comp.SpawnPrototype != null)
comp.ItemContainer.Insert(EntityManager.SpawnEntity(comp.SpawnPrototype, owner.Transform.Coordinates));
UpdateVisuals(comp);
@@ -146,10 +146,7 @@ namespace Content.Server.Cabinet
private static void ClickLatchSound(ItemCabinetComponent comp)
{
if(comp.DoorSound.TryGetSound(out var doorSound))
{
SoundSystem.Play(Filter.Pvs(comp.Owner), doorSound, comp.Owner, AudioHelpers.WithVariation(0.15f));
}
SoundSystem.Play(Filter.Pvs(comp.Owner), comp.DoorSound.GetSound(), comp.Owner, AudioHelpers.WithVariation(0.15f));
}
}

View File

@@ -115,10 +115,9 @@ namespace Content.Server.Cargo.Components
}
if (!_cargoConsoleSystem.AddOrder(orders.Database.Id, msg.Requester, msg.Reason, msg.ProductId,
msg.Amount, _bankAccount.Id) &&
_errorSound.TryGetSound(out var errorSound))
msg.Amount, _bankAccount.Id))
{
SoundSystem.Play(Filter.Local(), errorSound, Owner, AudioParams.Default);
SoundSystem.Play(Filter.Local(), _errorSound.GetSound(), Owner, AudioParams.Default);
}
break;
}
@@ -146,11 +145,9 @@ namespace Content.Server.Cargo.Components
|| !_cargoConsoleSystem.CheckBalance(_bankAccount.Id, (-product.PointCost) * order.Amount)
|| !_cargoConsoleSystem.ApproveOrder(orders.Database.Id, msg.OrderNumber)
|| !_cargoConsoleSystem.ChangeBalance(_bankAccount.Id, (-product.PointCost) * order.Amount))
&&
_errorSound.TryGetSound(out var errorSound)
)
{
SoundSystem.Play(Filter.Local(), errorSound, Owner, AudioParams.Default);
SoundSystem.Play(Filter.Local(), _errorSound.GetSound(), Owner, AudioParams.Default);
break;
}
UpdateUIState();

View File

@@ -74,8 +74,7 @@ namespace Content.Server.Cargo.Components
{
if (!Deleted && !Owner.Deleted && _currentState == CargoTelepadState.Teleporting && _teleportQueue.Count > 0)
{
if (_teleportSound.TryGetSound(out var teleportSound))
SoundSystem.Play(Filter.Pvs(Owner), teleportSound, Owner, AudioParams.Default.WithVolume(-8f));
SoundSystem.Play(Filter.Pvs(Owner), _teleportSound.GetSound(), Owner, AudioParams.Default.WithVolume(-8f));
Owner.EntityManager.SpawnEntity(_teleportQueue[0].Product, Owner.Transform.Coordinates);
_teleportQueue.RemoveAt(0);
if (Owner.TryGetComponent<SpriteComponent>(out var spriteComponent) && spriteComponent.LayerCount > 0)

View File

@@ -420,8 +420,7 @@ namespace Content.Server.Chemistry.Components
private void ClickSound()
{
if(_clickSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
}
[Verb]

View File

@@ -72,8 +72,7 @@ namespace Content.Server.Chemistry.Components
meleeSys.SendLunge(angle, user);
}
if(_injectSound.TryGetSound(out var injectSound))
SoundSystem.Play(Filter.Pvs(user), injectSound, user);
SoundSystem.Play(Filter.Pvs(user), _injectSound.GetSound(), user);
var targetSolution = target.GetComponent<SolutionContainerComponent>();

View File

@@ -23,7 +23,7 @@ namespace Content.Server.Chemistry.Components
public override string Name => "Pill";
[ViewVariables]
[DataField("useSound")]
[DataField("useSound", required: true)]
protected override SoundSpecifier UseSound { get; set; } = default!;
[ViewVariables]
@@ -99,10 +99,7 @@ namespace Content.Server.Chemistry.Components
firstStomach.TryTransferSolution(split);
if (UseSound.TryGetSound(out var sound))
{
SoundSystem.Play(Filter.Pvs(trueTarget), sound, trueTarget, AudioParams.Default.WithVolume(-1f));
}
SoundSystem.Play(Filter.Pvs(trueTarget), UseSound.GetSound(), trueTarget, AudioParams.Default.WithVolume(-1f));
trueTarget.PopupMessage(user, Loc.GetString("pill-component-swallow-success-message"));

View File

@@ -47,7 +47,8 @@ namespace Content.Server.Chemistry.Components
[ViewVariables] private ContainerSlot _beakerContainer = default!;
[ViewVariables] [DataField("pack")] private string _packPrototypeId = "";
[DataField("clickSound")] private SoundSpecifier _clickSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
[DataField("clickSound")]
private SoundSpecifier _clickSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
[ViewVariables] private bool HasBeaker => _beakerContainer.ContainedEntity != null;
[ViewVariables] private ReagentUnit _dispenseAmount = ReagentUnit.New(10);
@@ -361,8 +362,7 @@ namespace Content.Server.Chemistry.Components
private void ClickSound()
{
if(_clickSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
}
[Verb]

View File

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

View File

@@ -80,7 +80,7 @@ namespace Content.Server.Chemistry.ReactionEffects
/// <summary>
/// Sound that will get played when this reaction effect occurs.
/// </summary>
[DataField("sound")] private SoundSpecifier _sound = default!;
[DataField("sound", required: true)] private SoundSpecifier _sound = default!;
protected AreaReactionEffect()
{
@@ -136,10 +136,7 @@ namespace Content.Server.Chemistry.ReactionEffects
areaEffectComponent.TryAddSolution(solution);
areaEffectComponent.Start(amount, _duration, _spreadDelay, _removeDelay);
if (_sound.TryGetSound(out var sound))
{
SoundSystem.Play(Filter.Pvs(solutionEntity), sound, solutionEntity, AudioHelpers.WithVariation(0.125f));
}
SoundSystem.Play(Filter.Pvs(solutionEntity), _sound.GetSound(), solutionEntity, AudioHelpers.WithVariation(0.125f));
}
protected abstract SolutionAreaEffectComponent? GetAreaEffectComponent(IEntity entity);

View File

@@ -14,12 +14,11 @@ namespace Content.Server.Construction.Completions
[DataDefinition]
public class PlaySound : IGraphAction
{
[DataField("sound")] public SoundSpecifier Sound { get; private set; } = default!;
[DataField("sound", required: true)] public SoundSpecifier Sound { get; private set; } = default!;
public async Task PerformAction(IEntity entity, IEntity? user)
{
if(Sound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(entity), sound, entity, AudioHelpers.WithVariation(0.125f));
SoundSystem.Play(Filter.Pvs(entity), Sound.GetSound(), entity, AudioHelpers.WithVariation(0.125f));
}
}
}

View File

@@ -30,7 +30,7 @@ namespace Content.Server.Crayon
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
//TODO: useSound
[DataField("useSound")]
[DataField("useSound", required: true)]
private SoundSpecifier _useSound = default!;
[ViewVariables]
@@ -139,10 +139,7 @@ namespace Content.Server.Crayon
appearance.SetData(CrayonVisuals.Rotation, eventArgs.User.Transform.LocalRotation);
}
if (_useSound.TryGetSound(out var useSound))
{
SoundSystem.Play(Filter.Pvs(Owner), useSound, Owner, AudioHelpers.WithVariation(0.125f));
}
SoundSystem.Play(Filter.Pvs(Owner), _useSound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f));
// Decrease "Ammo"
Charges--;

View File

@@ -231,13 +231,11 @@ namespace Content.Server.Cuffs.Components
if (isOwner)
{
if (cuff.StartBreakoutSound.TryGetSound(out var startBreakoutSound))
SoundSystem.Play(Filter.Pvs(Owner), startBreakoutSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), cuff.StartBreakoutSound.GetSound(), Owner);
}
else
{
if (cuff.StartUncuffSound.TryGetSound(out var startUncuffSound))
SoundSystem.Play(Filter.Pvs(Owner), startUncuffSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), cuff.StartUncuffSound.GetSound(), Owner);
}
var uncuffTime = isOwner ? cuff.BreakoutTime : cuff.UncuffTime;
@@ -258,8 +256,7 @@ namespace Content.Server.Cuffs.Components
if (result != DoAfterStatus.Cancelled)
{
if (cuff.EndUncuffSound.TryGetSound(out var endUncuffSound))
SoundSystem.Play(Filter.Pvs(Owner), endUncuffSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), cuff.EndUncuffSound.GetSound(), Owner);
Container.ForceRemove(cuffsToRemove);
cuffsToRemove.Transform.AttachToGridOrMap();
@@ -289,7 +286,7 @@ namespace Content.Server.Cuffs.Components
if (!isOwner)
{
user.PopupMessage(Owner, Loc.GetString("cuffable-component-remove-cuffs-by-other-success-message",("otherName", user)));
user.PopupMessage(Owner, Loc.GetString("cuffable-component-remove-cuffs-by-other-success-message", ("otherName", user)));
}
}
else
@@ -305,7 +302,7 @@ namespace Content.Server.Cuffs.Components
}
else
{
user.PopupMessage(Loc.GetString("cuffable-component-remove-cuffs-partial-success-message",("cuffedHandCount", CuffedHandCount)));
user.PopupMessage(Loc.GetString("cuffable-component-remove-cuffs-partial-success-message", ("cuffedHandCount", CuffedHandCount)));
}
}
}

View File

@@ -184,8 +184,7 @@ namespace Content.Server.Cuffs.Components
eventArgs.User.PopupMessage(Loc.GetString("handcuff-component-start-cuffing-target-message",("targetName", eventArgs.Target)));
eventArgs.User.PopupMessage(eventArgs.Target, Loc.GetString("handcuff-component-start-cuffing-by-other-message",("otherName", eventArgs.User)));
if (StartCuffSound.TryGetSound(out var startCuffSound))
SoundSystem.Play(Filter.Pvs(Owner), startCuffSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), StartCuffSound.GetSound(), Owner);
TryUpdateCuff(eventArgs.User, eventArgs.Target, cuffed);
return true;
@@ -222,8 +221,7 @@ namespace Content.Server.Cuffs.Components
{
if (cuffs.TryAddNewCuffs(user, Owner))
{
if (EndCuffSound.TryGetSound(out var endCuffSound))
SoundSystem.Play(Filter.Pvs(Owner), endCuffSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), EndCuffSound.GetSound(), Owner);
user.PopupMessage(Loc.GetString("handcuff-component-cuff-other-success-message",("otherName", target)));
target.PopupMessage(Loc.GetString("handcuff-component-cuff-by-other-success-message", ("otherName", user)));

View File

@@ -22,7 +22,7 @@ namespace Content.Server.Damage.Components
public int BaseDamage { get; set; } = 5;
[DataField("factor")]
public float Factor { get; set; } = 1f;
[DataField("soundHit")]
[DataField("soundHit", required: true)]
public SoundSpecifier SoundHit { get; set; } = default!;
[DataField("stunChance")]
public float StunChance { get; set; } = 0.25f;

View File

@@ -34,8 +34,7 @@ namespace Content.Server.Damage
if (speed < component.MinimumSpeed) return;
if (component.SoundHit.TryGetSound(out var soundHit))
SoundSystem.Play(Filter.Pvs(otherBody), soundHit, otherBody, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
SoundSystem.Play(Filter.Pvs(otherBody), component.SoundHit.GetSound(), otherBody, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
if ((_gameTiming.CurTime - component.LastHit).TotalSeconds < component.DamageCooldown)
return;

View File

@@ -15,15 +15,12 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
/// <summary>
/// Sound played upon destruction.
/// </summary>
[DataField("sound")] public SoundSpecifier Sound { get; set; } = default!;
[DataField("sound", required: true)] public SoundSpecifier Sound { get; set; } = default!;
public void Execute(IEntity owner, DestructibleSystem system)
{
if (Sound.TryGetSound(out var sound))
{
var pos = owner.Transform.Coordinates;
SoundSystem.Play(Filter.Pvs(pos), sound, pos, AudioHelpers.WithVariation(0.125f));
}
var pos = owner.Transform.Coordinates;
SoundSystem.Play(Filter.Pvs(pos), Sound.GetSound(), pos, AudioHelpers.WithVariation(0.125f));
}
}
}

View File

@@ -64,8 +64,7 @@ namespace Content.Server.Dice
public void PlayDiceEffect()
{
if(_sound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioParams.Default);
SoundSystem.Play(Filter.Pvs(Owner), _sound.GetSound(), Owner, AudioParams.Default);
}
void IActivate.Activate(ActivateEventArgs eventArgs)

View File

@@ -435,8 +435,7 @@ namespace Content.Server.Disposal.Mailing
break;
case UiButton.Power:
TogglePower();
if(_receivedMessageSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(Owner), _receivedMessageSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
break;
default:
throw new ArgumentOutOfRangeException();

View File

@@ -127,7 +127,7 @@ namespace Content.Server.Disposal.Tube.Components
/// <returns>Returns a <see cref="DisposalRouterUserInterfaceState"/></returns>
private DisposalRouterUserInterfaceState GetUserInterfaceState()
{
if(_tags.Count <= 0)
if (_tags.Count <= 0)
{
return new DisposalRouterUserInterfaceState("");
}
@@ -153,8 +153,7 @@ namespace Content.Server.Disposal.Tube.Components
private void ClickSound()
{
if(_clickSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
}
/// <summary>

View File

@@ -119,8 +119,7 @@ namespace Content.Server.Disposal.Tube.Components
private void ClickSound()
{
if(_clickSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
}
/// <summary>

View File

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

View File

@@ -373,8 +373,7 @@ namespace Content.Server.Disposal.Unit.Components
break;
case UiButton.Power:
TogglePower();
if(_clickSound.TryGetSound(out var clickSound))
SoundSystem.Play(Filter.Pvs(Owner), clickSound, Owner, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
break;
default:
throw new ArgumentOutOfRangeException();

View File

@@ -359,7 +359,7 @@ namespace Content.Server.Doors.Components
public void WiresUpdate(WiresUpdateEventArgs args)
{
if(_doorComponent == null)
if (_doorComponent == null)
{
return;
}
@@ -463,13 +463,11 @@ namespace Content.Server.Doors.Components
if (newBolts)
{
if (_setBoltsDownSound.TryGetSound(out var boltsDownSound))
SoundSystem.Play(Filter.Broadcast(), boltsDownSound, Owner);
SoundSystem.Play(Filter.Broadcast(), _setBoltsDownSound.GetSound(), Owner);
}
else
{
if (_setBoltsUpSound.TryGetSound(out var boltsUpSound))
SoundSystem.Play(Filter.Broadcast(), boltsUpSound, Owner);
SoundSystem.Play(Filter.Broadcast(), _setBoltsUpSound.GetSound(), Owner);
}
}
}

View File

@@ -222,10 +222,9 @@ namespace Content.Server.Doors.Components
{
Open();
if (user.TryGetComponent(out HandsComponent? hands) && hands.Count == 0
&& _tryOpenDoorSound.TryGetSound(out var tryOpenDoorSound))
if (user.TryGetComponent(out HandsComponent? hands) && hands.Count == 0)
{
SoundSystem.Play(Filter.Pvs(Owner), tryOpenDoorSound, Owner, AudioParams.Default.WithVolume(-2));
SoundSystem.Play(Filter.Pvs(Owner), _tryOpenDoorSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2));
}
}
else

View File

@@ -14,7 +14,7 @@ namespace Content.Server.Explosion.Components
public override string Name => "SoundOnTrigger";
[ViewVariables(VVAccess.ReadWrite)]
[DataField("sound")]
[DataField("sound", required: true)]
public SoundSpecifier? Sound { get; set; } = null;
}
}

View File

@@ -314,8 +314,7 @@ namespace Content.Server.Explosion
var boundingBox = new Box2(epicenterMapPos - new Vector2(maxRange, maxRange),
epicenterMapPos + new Vector2(maxRange, maxRange));
if(_explosionSound.TryGetSound(out var explosionSound))
SoundSystem.Play(Filter.Broadcast(), explosionSound, epicenter);
SoundSystem.Play(Filter.Broadcast(), _explosionSound.GetSound(), epicenter);
DamageEntitiesInRange(epicenter, boundingBox, devastationRange, heavyImpactRange, maxRange, mapId);
var mapGridsNear = mapManager.FindGridsIntersecting(mapId, boundingBox);

View File

@@ -43,8 +43,7 @@ namespace Content.Server.Extinguisher
var drained = targetSolution.Drain(trans);
container.TryAddSolution(drained);
if(_refillSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _refillSound.GetSound(), Owner);
eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("fire-extinguisher-component-after-interact-refilled-message",("owner", Owner)));
}

View File

@@ -42,9 +42,9 @@ namespace Content.Server.Flash.Components
flashable.Flash(duration);
}
if (sound != null && sound.TryGetSound(out var soundName))
if (sound != null)
{
SoundSystem.Play(Filter.Pvs(source), soundName, source.Transform.Coordinates);
SoundSystem.Play(Filter.Pvs(source), sound.GetSound(), source.Transform.Coordinates);
}
}
}

View File

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

View File

@@ -114,10 +114,7 @@ namespace Content.Server.Fluids.Components
return false;
}
if (_sound.TryGetSound(out var sound))
{
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner);
}
SoundSystem.Play(Filter.Pvs(Owner), _sound.GetSound(), Owner);
return true;
}

View File

@@ -163,10 +163,7 @@ namespace Content.Server.Fluids.Components
contents.SplitSolution(transferAmount);
}
if (_pickupSound.TryGetSound(out var pickupSound))
{
SoundSystem.Play(Filter.Pvs(Owner), pickupSound, Owner);
}
SoundSystem.Play(Filter.Pvs(Owner), _pickupSound.GetSound(), Owner);
return true;
}

View File

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

View File

@@ -76,7 +76,7 @@ namespace Content.Server.Fluids.Components
set => _sprayVelocity = value;
}
[DataField("spraySound")]
[DataField("spraySound", required: true)]
public SoundSpecifier SpraySound { get; } = default!;
public ReagentUnit CurrentVolume => Owner.GetComponentOrNull<SolutionContainerComponent>()?.CurrentVolume ?? ReagentUnit.Zero;
@@ -173,11 +173,7 @@ namespace Content.Server.Fluids.Components
}
}
//Play sound
if (SpraySound.TryGetSound(out var spraySound))
{
SoundSystem.Play(Filter.Pvs(Owner), spraySound, Owner, AudioHelpers.WithVariation(0.125f));
}
SoundSystem.Play(Filter.Pvs(Owner), SpraySound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f));
_lastUseTime = curTime;
_cooldownEnd = _lastUseTime + TimeSpan.FromSeconds(_cooldownTime);

View File

@@ -52,10 +52,9 @@ namespace Content.Server.GameTicking.Rules
_chatManager.DispatchServerAnnouncement(Loc.GetString("rule-suspicion-added-announcement"));
var filter = Filter.Empty()
.AddWhere(session => ((IPlayerSession)session).ContentData()?.Mind?.HasRole<SuspicionTraitorRole>() ?? false);
.AddWhere(session => ((IPlayerSession) session).ContentData()?.Mind?.HasRole<SuspicionTraitorRole>() ?? false);
if(_addedSound.TryGetSound(out var addedSound))
SoundSystem.Play(filter, addedSound, AudioParams.Default);
SoundSystem.Play(filter, _addedSound.GetSound(), AudioParams.Default);
EntitySystem.Get<SuspicionEndTimerSystem>().EndTime = _endTime;
EntitySystem.Get<DoorSystem>().AccessType = DoorSystem.AccessTypes.AllowAllNoExternal;
@@ -160,7 +159,7 @@ namespace Content.Server.GameTicking.Rules
var gameTicker = EntitySystem.Get<GameTicker>();
gameTicker.EndRound(text);
_chatManager.DispatchServerAnnouncement(Loc.GetString("rule-restarting-in-seconds",("seconds", (int) RoundEndDelay.TotalSeconds)));
_chatManager.DispatchServerAnnouncement(Loc.GetString("rule-restarting-in-seconds", ("seconds", (int) RoundEndDelay.TotalSeconds)));
_checkTimerCancel.Cancel();
Timer.Spawn(RoundEndDelay, () => gameTicker.RestartRound());

View File

@@ -24,8 +24,7 @@ namespace Content.Server.GameTicking.Rules
var filter = Filter.Empty()
.AddWhere(session => ((IPlayerSession)session).ContentData()?.Mind?.HasRole<TraitorRole>() ?? false);
if(_addedSound.TryGetSound(out var addedSound))
SoundSystem.Play(filter, addedSound, AudioParams.Default);
SoundSystem.Play(filter, _addedSound.GetSound(), AudioParams.Default);
}
}
}

View File

@@ -144,8 +144,7 @@ namespace Content.Server.Gravity.EntitySystems
|| player.AttachedEntity.Transform.GridID != gridId)
continue;
if(comp.GravityShakeSound.TryGetSound(out var gravityShakeSound))
SoundSystem.Play(Filter.Pvs(player.AttachedEntity), gravityShakeSound, player.AttachedEntity);
SoundSystem.Play(Filter.Pvs(player.AttachedEntity), comp.GravityShakeSound.GetSound(), player.AttachedEntity);
}
}

View File

@@ -143,8 +143,7 @@ namespace Content.Server.Hands.Components
if (source != null)
{
if(_disarmedSound.TryGetSound(out var disarmedSound))
SoundSystem.Play(Filter.Pvs(source), disarmedSound, source, AudioHelpers.WithVariation(0.025f));
SoundSystem.Play(Filter.Pvs(source), _disarmedSound.GetSound(), source, AudioHelpers.WithVariation(0.025f));
if (target != null)
{

View File

@@ -160,8 +160,7 @@ namespace Content.Server.Kitchen.Components
// TODO: Need to be able to leave them on the spike to do DoT, see ss13.
victim.Delete();
if (SpikeSound.TryGetSound(out var spikeSound))
SoundSystem.Play(Filter.Pvs(Owner), spikeSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), SpikeSound.GetSound(), Owner);
}
SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat)

View File

@@ -107,10 +107,10 @@ namespace Content.Server.Kitchen.Components
switch (message.Message)
{
case MicrowaveStartCookMessage msg :
case MicrowaveStartCookMessage msg:
Wzhzhzh();
break;
case MicrowaveEjectMessage msg :
case MicrowaveEjectMessage msg:
if (_hasContents)
{
VaporizeReagents();
@@ -271,7 +271,7 @@ namespace Content.Server.Kitchen.Components
}
Owner.PopupMessage(eventArgs.User, Loc.GetString("microwave-component-interact-using-transfer-success",
("amount",removedSolution.TotalVolume)));
("amount", removedSolution.TotalVolume)));
return true;
}
@@ -300,14 +300,14 @@ namespace Content.Server.Kitchen.Components
_busy = true;
// Convert storage into Dictionary of ingredients
var solidsDict = new Dictionary<string, int>();
foreach(var item in _storage.ContainedEntities)
foreach (var item in _storage.ContainedEntities)
{
if (item.Prototype == null)
{
continue;
}
if(solidsDict.ContainsKey(item.Prototype.ID))
if (solidsDict.ContainsKey(item.Prototype.ID))
{
solidsDict[item.Prototype.ID]++;
}
@@ -318,9 +318,9 @@ namespace Content.Server.Kitchen.Components
}
var failState = MicrowaveSuccessState.RecipeFail;
foreach(var id in solidsDict.Keys)
foreach (var id in solidsDict.Keys)
{
if(_recipeManager.SolidAppears(id))
if (_recipeManager.SolidAppears(id))
{
continue;
}
@@ -337,43 +337,41 @@ namespace Content.Server.Kitchen.Components
}
SetAppearance(MicrowaveVisualState.Cooking);
if(_startCookingSound.TryGetSound(out var startCookingSound))
SoundSystem.Play(Filter.Pvs(Owner), startCookingSound, Owner, AudioParams.Default);
Owner.SpawnTimer((int)(_currentCookTimerTime * _cookTimeMultiplier), (Action)(() =>
{
if (_lostPower)
{
return;
}
SoundSystem.Play(Filter.Pvs(Owner), _startCookingSound.GetSound(), Owner, AudioParams.Default);
Owner.SpawnTimer((int) (_currentCookTimerTime * _cookTimeMultiplier), (Action) (() =>
{
if (_lostPower)
{
return;
}
if(failState == MicrowaveSuccessState.UnwantedForeignObject)
{
VaporizeReagents();
EjectSolids();
}
else
{
if (recipeToCook != null)
{
SubtractContents(recipeToCook);
Owner.EntityManager.SpawnEntity(recipeToCook.Result, Owner.Transform.Coordinates);
}
else
{
VaporizeReagents();
VaporizeSolids();
Owner.EntityManager.SpawnEntity(_badRecipeName, Owner.Transform.Coordinates);
}
}
if (failState == MicrowaveSuccessState.UnwantedForeignObject)
{
VaporizeReagents();
EjectSolids();
}
else
{
if (recipeToCook != null)
{
SubtractContents(recipeToCook);
Owner.EntityManager.SpawnEntity(recipeToCook.Result, Owner.Transform.Coordinates);
}
else
{
VaporizeReagents();
VaporizeSolids();
Owner.EntityManager.SpawnEntity(_badRecipeName, Owner.Transform.Coordinates);
}
}
if(_cookingCompleteSound.TryGetSound(out var cookingCompleteSound))
SoundSystem.Play(Filter.Pvs(Owner), cookingCompleteSound, Owner, AudioParams.Default.WithVolume(-1f));
SoundSystem.Play(Filter.Pvs(Owner), _cookingCompleteSound.GetSound(), Owner, AudioParams.Default.WithVolume(-1f));
SetAppearance(MicrowaveVisualState.Idle);
_busy = false;
SetAppearance(MicrowaveVisualState.Idle);
_busy = false;
_uiDirty = true;
}));
_uiDirty = true;
}));
_lostPower = false;
_uiDirty = true;
}
@@ -396,7 +394,7 @@ namespace Content.Server.Kitchen.Components
private void VaporizeSolids()
{
for(var i = _storage.ContainedEntities.Count-1; i>=0; i--)
for (var i = _storage.ContainedEntities.Count - 1; i >= 0; i--)
{
var item = _storage.ContainedEntities.ElementAt(i);
_storage.Remove(item);
@@ -407,7 +405,7 @@ namespace Content.Server.Kitchen.Components
private void EjectSolids()
{
for(var i = _storage.ContainedEntities.Count-1; i>=0; i--)
for (var i = _storage.ContainedEntities.Count - 1; i >= 0; i--)
{
_storage.Remove(_storage.ContainedEntities.ElementAt(i));
}
@@ -429,7 +427,7 @@ namespace Content.Server.Kitchen.Components
return;
}
foreach(var recipeReagent in recipe.IngredientsReagents)
foreach (var recipeReagent in recipe.IngredientsReagents)
{
solution?.TryRemoveReagent(recipeReagent.Key, ReagentUnit.New(recipeReagent.Value));
}
@@ -457,7 +455,7 @@ namespace Content.Server.Kitchen.Components
}
private MicrowaveSuccessState CanSatisfyRecipe(FoodRecipePrototype recipe, Dictionary<string,int> solids)
private MicrowaveSuccessState CanSatisfyRecipe(FoodRecipePrototype recipe, Dictionary<string, int> solids)
{
if (_currentCookTimerTime != (uint) recipe.CookTime)
{
@@ -500,8 +498,7 @@ namespace Content.Server.Kitchen.Components
private void ClickSound()
{
if(_clickSound.TryGetSound(out var clickSound))
SoundSystem.Play(Filter.Pvs(Owner), clickSound, Owner,AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(Owner), _clickSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
}
SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat)
@@ -537,7 +534,7 @@ namespace Content.Server.Kitchen.Components
var othersMessage = headCount > 1
? Loc.GetString("microwave-component-suicide-multi-head-others-message", ("victim", victim))
: Loc.GetString("microwave-component-suicide-others-message",("victim", victim));
: Loc.GetString("microwave-component-suicide-others-message", ("victim", victim));
victim.PopupMessageOtherClients(othersMessage);

View File

@@ -39,8 +39,8 @@ namespace Content.Server.Kitchen.Components
//YAML serialization vars
[ViewVariables(VVAccess.ReadWrite)] [DataField("chamberCapacity")] public int StorageCap = 16;
[ViewVariables(VVAccess.ReadWrite)] [DataField("workTime")] public int WorkTime = 3500; //3.5 seconds, completely arbitrary for now.
[DataField("clickSound")] private SoundSpecifier _clickSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
[DataField("grindSound")] private SoundSpecifier _grindSound = new SoundPathSpecifier("/Audio/Machines/blender.ogg");
[DataField("juiceSound")] private SoundSpecifier _juiceSound = new SoundPathSpecifier("/Audio/Machines/juicer.ogg");
[DataField("clickSound")] public SoundSpecifier ClickSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
[DataField("grindSound")] public SoundSpecifier GrindSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/blender.ogg");
[DataField("juiceSound")] public SoundSpecifier JuiceSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/juicer.ogg");
}
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.Chemistry.Components;
@@ -270,7 +270,7 @@ namespace Content.Server.Kitchen.EntitySystems
switch (program)
{
case SharedReagentGrinderComponent.GrinderProgram.Grind:
SoundSystem.Play(Filter.Pvs(component.Owner), "/Audio/Machines/blender.ogg", component.Owner, AudioParams.Default);
SoundSystem.Play(Filter.Pvs(component.Owner), component.GrindSound.GetSound(), component.Owner, AudioParams.Default);
//Get each item inside the chamber and get the reagents it contains. Transfer those reagents to the beaker, given we have one in.
component.Owner.SpawnTimer(component.WorkTime, (Action) (() =>
{
@@ -291,7 +291,7 @@ namespace Content.Server.Kitchen.EntitySystems
break;
case SharedReagentGrinderComponent.GrinderProgram.Juice:
SoundSystem.Play(Filter.Pvs(component.Owner), "/Audio/Machines/juicer.ogg", component.Owner, AudioParams.Default);
SoundSystem.Play(Filter.Pvs(component.Owner), component.JuiceSound.GetSound(), component.Owner, AudioParams.Default);
component.Owner.SpawnTimer(component.WorkTime, (Action) (() =>
{
foreach (var item in component.Chamber.ContainedEntities.ToList())
@@ -311,7 +311,7 @@ namespace Content.Server.Kitchen.EntitySystems
private void ClickSound(ReagentGrinderComponent component)
{
SoundSystem.Play(Filter.Pvs(component.Owner), "/Audio/Machines/machine_switch.ogg", component.Owner, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(component.Owner), component.ClickSound.GetSound(), component.Owner, AudioParams.Default.WithVolume(-2f));
}
}
}

View File

@@ -100,11 +100,8 @@ namespace Content.Server.Light.Components
switch (CurrentState)
{
case ExpendableLightState.Lit:
if (LitSound.TryGetSound(out var litSound))
{
SoundSystem.Play(Filter.Pvs(Owner), litSound, Owner);
}
SoundSystem.Play(Filter.Pvs(Owner), LitSound.GetSound(), Owner);
if (IconStateLit != string.Empty)
{
sprite.LayerSetState(2, IconStateLit);
@@ -119,11 +116,7 @@ namespace Content.Server.Light.Components
default:
case ExpendableLightState.Dead:
if (DieSound.TryGetSound(out var dieSound))
{
SoundSystem.Play(Filter.Pvs(Owner), dieSound, Owner);
}
SoundSystem.Play(Filter.Pvs(Owner), DieSound.GetSound(), Owner);
sprite.LayerSetState(0, IconStateSpent);
sprite.LayerSetShader(0, "shaded");

View File

@@ -120,9 +120,9 @@ namespace Content.Server.Light.Components
UpdateLightAction();
Owner.EntityManager.EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
if (makeNoise && TurnOffSound.TryGetSound(out var turnOffSound))
if (makeNoise)
{
SoundSystem.Play(Filter.Pvs(Owner), turnOffSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), TurnOffSound.GetSound(), Owner);
}
return true;
@@ -137,8 +137,7 @@ namespace Content.Server.Light.Components
if (Cell == null)
{
if (TurnOnFailSound.TryGetSound(out var turnOnFailSound))
SoundSystem.Play(Filter.Pvs(Owner), turnOnFailSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), TurnOnFailSound.GetSound(), Owner);
Owner.PopupMessage(user, Loc.GetString("handheld-light-component-cell-missing-message"));
UpdateLightAction();
return false;
@@ -149,8 +148,7 @@ namespace Content.Server.Light.Components
// Simple enough.
if (Wattage > Cell.CurrentCharge)
{
if (TurnOnFailSound.TryGetSound(out var turnOnFailSound))
SoundSystem.Play(Filter.Pvs(Owner), turnOnFailSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), TurnOnFailSound.GetSound(), Owner);
Owner.PopupMessage(user, Loc.GetString("handheld-light-component-cell-dead-message"));
UpdateLightAction();
return false;
@@ -161,8 +159,7 @@ namespace Content.Server.Light.Components
SetState(true);
Owner.EntityManager.EventBus.QueueEvent(EventSource.Local, new ActivateHandheldLightMessage(this));
if (TurnOnSound.TryGetSound(out var turnOnSound))
SoundSystem.Play(Filter.Pvs(Owner), turnOnSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), TurnOnSound.GetSound(), Owner);
return true;
}

View File

@@ -47,7 +47,8 @@ namespace Content.Server.Light.Components
[DataField("color")]
private Color _color = Color.White;
[ViewVariables(VVAccess.ReadWrite)] public Color Color
[ViewVariables(VVAccess.ReadWrite)]
public Color Color
{
get { return _color; }
set
@@ -78,7 +79,8 @@ namespace Content.Server.Light.Components
/// The current state of the light bulb. Invokes the OnLightBulbStateChange event when set.
/// It also updates the bulb's sprite accordingly.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)] public LightBulbState State
[ViewVariables(VVAccess.ReadWrite)]
public LightBulbState State
{
get { return _state; }
set
@@ -132,8 +134,7 @@ namespace Content.Server.Light.Components
public void PlayBreakSound()
{
if(_breakSound.TryGetSound(out var breakSound))
SoundSystem.Play(Filter.Pvs(Owner), breakSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _breakSound.GetSound(), Owner);
}
}
}

View File

@@ -24,13 +24,14 @@ namespace Content.Server.Light.Components
/// <summary>
/// How long will matchstick last in seconds.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)] [DataField("duration")]
[ViewVariables(VVAccess.ReadOnly)]
[DataField("duration")]
private int _duration = 10;
/// <summary>
/// Sound played when you ignite the matchstick.
/// </summary>
[DataField("igniteSound")] private SoundSpecifier _igniteSound = default!;
[DataField("igniteSound", required: true)] private SoundSpecifier _igniteSound = default!;
/// <summary>
/// Point light component. Gives matches a glow in dark effect.
@@ -69,11 +70,9 @@ namespace Content.Server.Light.Components
public void Ignite(IEntity user)
{
// Play Sound
if (_igniteSound.TryGetSound(out var igniteSound))
{
SoundSystem.Play(Filter.Pvs(Owner), igniteSound, Owner,
AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
}
SoundSystem.Play(
Filter.Pvs(Owner), _igniteSound.GetSound(), Owner,
AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
// Change state
CurrentState = SharedBurningStates.Lit;

View File

@@ -58,7 +58,8 @@ namespace Content.Server.Light.Components
[DataField("hasLampOnSpawn")]
private bool _hasLampOnSpawn = true;
[ViewVariables] [DataField("on")]
[ViewVariables]
[DataField("on")]
private bool _on = true;
[ViewVariables]
@@ -67,7 +68,8 @@ namespace Content.Server.Light.Components
[ViewVariables]
private bool _isBlinking;
[ViewVariables] [DataField("ignoreGhostsBoo")]
[ViewVariables]
[DataField("ignoreGhostsBoo")]
private bool _ignoreGhostsBoo;
[DataField("bulb")] private LightBulbType _bulbType = LightBulbType.Tube;
@@ -102,9 +104,9 @@ namespace Content.Server.Light.Components
Eject();
return false;
}
if(eventArgs.User.TryGetComponent(out HeatResistanceComponent? heatResistanceComponent))
if (eventArgs.User.TryGetComponent(out HeatResistanceComponent? heatResistanceComponent))
{
if(CanBurn(heatResistanceComponent.GetHeatResistance()))
if (CanBurn(heatResistanceComponent.GetHeatResistance()))
{
Burn();
return true;
@@ -125,8 +127,7 @@ namespace Content.Server.Light.Components
{
Owner.PopupMessage(eventArgs.User, Loc.GetString("powered-light-component-burn-hand"));
damageableComponent.ChangeDamage(DamageType.Heat, 20, false, Owner);
if(_burnHandSound.TryGetSound(out var burnHandSound))
SoundSystem.Play(Filter.Pvs(Owner), burnHandSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _burnHandSound.GetSound(), Owner);
}
void Eject()
@@ -228,8 +229,7 @@ namespace Content.Server.Light.Components
if (time > _lastThunk + _thunkDelay)
{
_lastThunk = time;
if(_turnOnSound.TryGetSound(out var turnOnSound))
SoundSystem.Play(Filter.Pvs(Owner), turnOnSound, Owner, AudioParams.Default.WithVolume(-10f));
SoundSystem.Play(Filter.Pvs(Owner), _turnOnSound.GetSound(), Owner, AudioParams.Default.WithVolume(-10f));
}
}
else
@@ -338,7 +338,8 @@ namespace Content.Server.Light.Components
_lastGhostBlink = time;
ToggleBlinkingLight(true);
Owner.SpawnTimer(ghostBlinkingTime, () => {
Owner.SpawnTimer(ghostBlinkingTime, () =>
{
ToggleBlinkingLight(false);
});

View File

@@ -20,8 +20,8 @@ namespace Content.Server.Storage.Components
public override string Name => "Lock";
[ViewVariables(VVAccess.ReadWrite)] [DataField("locked")] public bool Locked { get; set; } = true;
[ViewVariables(VVAccess.ReadWrite)] [DataField("unlockingSound")] public SoundSpecifier? UnlockSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/door_lock_off.ogg");
[ViewVariables(VVAccess.ReadWrite)] [DataField("lockingSound")] public SoundSpecifier? LockSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/door_lock_off.ogg");
[ViewVariables(VVAccess.ReadWrite)] [DataField("unlockingSound")] public SoundSpecifier UnlockSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/door_lock_off.ogg");
[ViewVariables(VVAccess.ReadWrite)] [DataField("lockingSound")] public SoundSpecifier LockSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/door_lock_off.ogg");
[Verb]
private sealed class ToggleLockVerb : Verb<LockComponent>

View File

@@ -42,10 +42,7 @@ namespace Content.Server.Mining.Components
if (!item.TryGetComponent(out PickaxeComponent? pickaxeComponent))
return true;
if (pickaxeComponent.MiningSound.TryGetSound(out var miningSound))
{
SoundSystem.Play(Filter.Pvs(Owner), miningSound, Owner, AudioParams.Default);
}
SoundSystem.Play(Filter.Pvs(Owner), pickaxeComponent.MiningSound.GetSound(), Owner, AudioParams.Default);
return true;
}
}

View File

@@ -120,8 +120,7 @@ namespace Content.Server.Morgue.Components
TryOpenStorage(Owner);
if (_cremateFinishSound.TryGetSound(out var cremateFinishSound))
SoundSystem.Play(Filter.Pvs(Owner), cremateFinishSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _cremateFinishSound.GetSound(), Owner);
}, _cremateCancelToken.Token);
}

View File

@@ -146,10 +146,9 @@ namespace Content.Server.Morgue.Components
{
CheckContents();
if (DoSoulBeep && Appearance != null && Appearance.TryGetData(MorgueVisuals.HasSoul, out bool hasSoul) && hasSoul &&
_occupantHasSoulAlarmSound.TryGetSound(out var occupantHasSoulAlarmSound))
if (DoSoulBeep && Appearance != null && Appearance.TryGetData(MorgueVisuals.HasSoul, out bool hasSoul) && hasSoul)
{
SoundSystem.Play(Filter.Pvs(Owner), occupantHasSoulAlarmSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _occupantHasSoulAlarmSound.GetSound(), Owner);
}
}

View File

@@ -15,13 +15,12 @@ namespace Content.Server.Movement.Components
/// <inheritdoc />
public override string Name => "FootstepModifier";
[DataField("footstepSoundCollection")]
public SoundSpecifier _soundCollection = default!;
[DataField("footstepSoundCollection", required: true)]
public SoundSpecifier SoundCollection = default!;
public void PlayFootstep()
{
if (_soundCollection.TryGetSound(out var footstepSound))
SoundSystem.Play(Filter.Pvs(Owner), footstepSound, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(Owner), SoundCollection.GetSound(), Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2f));
}
}
}

View File

@@ -25,8 +25,7 @@ namespace Content.Server.Nutrition.Components
public void PlaySound()
{
if(_sound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioHelpers.WithVariation(0.125f));
SoundSystem.Play(Filter.Pvs(Owner), _sound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f));
}
void IThrowCollide.DoHit(ThrowCollideEventArgs eventArgs)

View File

@@ -127,8 +127,7 @@ namespace Content.Server.Nutrition.Components
if (!Opened)
{
//Do the opening stuff like playing the sounds.
if(_openSounds.TryGetSound(out var openSound))
SoundSystem.Play(Filter.Pvs(args.User), openSound, args.User, AudioParams.Default);
SoundSystem.Play(Filter.Pvs(args.User), _openSounds.GetSound(), args.User, AudioParams.Default);
Opened = true;
return false;
@@ -137,7 +136,7 @@ namespace Content.Server.Nutrition.Components
if (!Owner.TryGetComponent(out ISolutionInteractionsComponent? contents) ||
contents.DrainAvailable <= 0)
{
args.User.PopupMessage(Loc.GetString("drink-component-on-use-is-empty",("owner", Owner)));
args.User.PopupMessage(Loc.GetString("drink-component-on-use-is-empty", ("owner", Owner)));
return true;
}
@@ -163,14 +162,14 @@ namespace Content.Server.Nutrition.Components
}
var color = Empty ? "gray" : "yellow";
var openedText = Loc.GetString(Empty ? "drink-component-on-examine-is-empty" : "drink-component-on-examine-is-opened");
message.AddMarkup(Loc.GetString("drink-component-on-examine-details-text",("colorName", color),("text", openedText)));
message.AddMarkup(Loc.GetString("drink-component-on-examine-details-text", ("colorName", color), ("text", openedText)));
}
private bool TryUseDrink(IEntity user, IEntity target, bool forced = false)
{
if (!Opened)
{
target.PopupMessage(Loc.GetString("drink-component-try-use-drink-not-open",("owner", Owner)));
target.PopupMessage(Loc.GetString("drink-component-try-use-drink-not-open", ("owner", Owner)));
return false;
}
@@ -180,7 +179,7 @@ namespace Content.Server.Nutrition.Components
{
if (!forced)
{
target.PopupMessage(Loc.GetString("drink-component-try-use-drink-is-empty", ("entity",Owner)));
target.PopupMessage(Loc.GetString("drink-component-try-use-drink-is-empty", ("entity", Owner)));
}
return false;
@@ -189,7 +188,7 @@ namespace Content.Server.Nutrition.Components
if (!target.TryGetComponent(out SharedBodyComponent? body) ||
!body.TryGetMechanismBehaviors<StomachBehavior>(out var stomachs))
{
target.PopupMessage(Loc.GetString("drink-component-try-use-drink-cannot-drink",("owner", Owner)));
target.PopupMessage(Loc.GetString("drink-component-try-use-drink-cannot-drink", ("owner", Owner)));
return false;
}
@@ -207,7 +206,7 @@ namespace Content.Server.Nutrition.Components
// All stomach are full or can't handle whatever solution we have.
if (firstStomach == null)
{
target.PopupMessage(Loc.GetString("drink-component-try-use-drink-had-enough",("owner", Owner)));
target.PopupMessage(Loc.GetString("drink-component-try-use-drink-had-enough", ("owner", Owner)));
if (!interactions.CanRefill)
{
@@ -219,10 +218,7 @@ namespace Content.Server.Nutrition.Components
return false;
}
if (_useSound.TryGetSound(out var useSound))
{
SoundSystem.Play(Filter.Pvs(target), useSound, target, AudioParams.Default.WithVolume(-2f));
}
SoundSystem.Play(Filter.Pvs(target), _useSound.GetSound(), target, AudioParams.Default.WithVolume(-2f));
target.PopupMessage(Loc.GetString("drink-component-try-use-drink-success-slurp"));
UpdateAppearance();
@@ -253,8 +249,7 @@ namespace Content.Server.Nutrition.Components
var solution = interactions.Drain(interactions.DrainAvailable);
solution.SpillAt(Owner, "PuddleSmear");
if(_burstSound.TryGetSound(out var burstSound))
SoundSystem.Play(Filter.Pvs(Owner), burstSound, Owner, AudioParams.Default.WithVolume(-4));
SoundSystem.Play(Filter.Pvs(Owner), _burstSound.GetSound(), Owner, AudioParams.Default.WithVolume(-4));
}
}
}

View File

@@ -50,7 +50,7 @@ namespace Content.Server.Nutrition.Components
return solution.CurrentVolume == 0
? 0
: Math.Max(1, (int)Math.Ceiling((solution.CurrentVolume / TransferAmount).Float()));
: Math.Max(1, (int) Math.Ceiling((solution.CurrentVolume / TransferAmount).Float()));
}
}
@@ -110,7 +110,7 @@ namespace Content.Server.Nutrition.Components
}
var utensils = utensilUsed != null
? new List<UtensilComponent> {utensilUsed}
? new List<UtensilComponent> { utensilUsed }
: null;
if (_utensilsNeeded != UtensilType.None)
@@ -160,10 +160,7 @@ namespace Content.Server.Nutrition.Components
firstStomach.TryTransferSolution(split);
if (UseSound.TryGetSound(out var useSound))
{
SoundSystem.Play(Filter.Pvs(trueTarget), useSound, trueTarget, AudioParams.Default.WithVolume(-1f));
}
SoundSystem.Play(Filter.Pvs(trueTarget), UseSound.GetSound(), trueTarget, AudioParams.Default.WithVolume(-1f));
trueTarget.PopupMessage(user, Loc.GetString("food-nom"));

View File

@@ -24,13 +24,16 @@ namespace Content.Server.Nutrition.Components
int IInteractUsing.Priority => 1; // take priority over eating with utensils
[DataField("slice")] [ViewVariables(VVAccess.ReadWrite)]
[DataField("slice")]
[ViewVariables(VVAccess.ReadWrite)]
private string _slice = string.Empty;
[DataField("sound")] [ViewVariables(VVAccess.ReadWrite)]
[DataField("sound")]
[ViewVariables(VVAccess.ReadWrite)]
private SoundSpecifier _sound = new SoundPathSpecifier("/Audio/Items/Culinary/chop.ogg");
[DataField("count")] [ViewVariables(VVAccess.ReadWrite)]
[DataField("count")]
[ViewVariables(VVAccess.ReadWrite)]
private ushort _totalCount = 5;
[ViewVariables(VVAccess.ReadWrite)] public ushort Count;
@@ -67,9 +70,8 @@ namespace Content.Server.Nutrition.Components
}
}
if(_sound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner.Transform.Coordinates,
AudioParams.Default.WithVolume(-2));
SoundSystem.Play(Filter.Pvs(Owner), _sound.GetSound(), Owner.Transform.Coordinates,
AudioParams.Default.WithVolume(-2));
Count--;
if (Count < 1)

View File

@@ -71,9 +71,9 @@ namespace Content.Server.Nutrition.Components
internal void TryBreak(IEntity user)
{
if (_breakSound.TryGetSound(out var breakSound) && IoCManager.Resolve<IRobustRandom>().Prob(_breakChance))
if (IoCManager.Resolve<IRobustRandom>().Prob(_breakChance))
{
SoundSystem.Play(Filter.Pvs(user), breakSound, user, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(user), _breakSound.GetSound(), user, AudioParams.Default.WithVolume(-2f));
Owner.Delete();
}
}

View File

@@ -104,49 +104,49 @@ namespace Content.Server.PDA
switch (message.Message)
{
case PDARequestUpdateInterfaceMessage _:
{
UpdatePDAUserInterface();
break;
}
case PDAToggleFlashlightMessage _:
{
ToggleLight();
break;
}
case PDAEjectIDMessage _:
{
HandleIDEjection(message.Session.AttachedEntity!);
break;
}
case PDAEjectPenMessage _:
{
HandlePenEjection(message.Session.AttachedEntity!);
break;
}
case PDAUplinkBuyListingMessage buyMsg:
{
var player = message.Session.AttachedEntity;
if (player == null)
break;
if (!_uplinkManager.TryPurchaseItem(_syndicateUplinkAccount, buyMsg.ItemId,
player.Transform.Coordinates, out var entity))
{
SendNetworkMessage(new PDAUplinkInsufficientFundsMessage(), message.Session.ConnectedClient);
UpdatePDAUserInterface();
break;
}
case PDAToggleFlashlightMessage _:
{
ToggleLight();
break;
}
if (!player.TryGetComponent(out HandsComponent? hands) || !entity.TryGetComponent(out ItemComponent? item))
case PDAEjectIDMessage _:
{
HandleIDEjection(message.Session.AttachedEntity!);
break;
}
hands.PutInHandOrDrop(item);
case PDAEjectPenMessage _:
{
HandlePenEjection(message.Session.AttachedEntity!);
break;
}
SendNetworkMessage(new PDAUplinkBuySuccessMessage(), message.Session.ConnectedClient);
break;
}
case PDAUplinkBuyListingMessage buyMsg:
{
var player = message.Session.AttachedEntity;
if (player == null)
break;
if (!_uplinkManager.TryPurchaseItem(_syndicateUplinkAccount, buyMsg.ItemId,
player.Transform.Coordinates, out var entity))
{
SendNetworkMessage(new PDAUplinkInsufficientFundsMessage(), message.Session.ConnectedClient);
break;
}
if (!player.TryGetComponent(out HandsComponent? hands) || !entity.TryGetComponent(out ItemComponent? item))
break;
hands.PutInHandOrDrop(item);
SendNetworkMessage(new PDAUplinkBuySuccessMessage(), message.Session.ConnectedClient);
break;
}
}
}
@@ -305,8 +305,7 @@ namespace Content.Server.PDA
{
_idSlot.Insert(card.Owner);
ContainedID = card;
if(_insertIdSound.TryGetSound(out var insertIdSound))
SoundSystem.Play(Filter.Pvs(Owner), insertIdSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _insertIdSound.GetSound(), Owner);
}
/// <summary>
@@ -335,8 +334,7 @@ namespace Content.Server.PDA
_lightOn = !_lightOn;
light.Enabled = _lightOn;
if(_toggleFlashlightSound.TryGetSound(out var toggleFlashlightSound))
SoundSystem.Play(Filter.Pvs(Owner), toggleFlashlightSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _toggleFlashlightSound.GetSound(), Owner);
UpdatePDAUserInterface();
}
@@ -355,8 +353,7 @@ namespace Content.Server.PDA
hands.PutInHandOrDrop(cardItemComponent);
ContainedID = null;
if(_ejectIdSound.TryGetSound(out var ejectIdSound))
SoundSystem.Play(Filter.Pvs(Owner), ejectIdSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _ejectIdSound.GetSound(), Owner);
UpdatePDAUserInterface();
}

View File

@@ -214,10 +214,9 @@ namespace Content.Server.Physics.Controllers
string? soundToPlay = null;
foreach (var maybeFootstep in grid.GetAnchoredEntities(tile.GridIndices))
{
if (EntityManager.ComponentManager.TryGetComponent(maybeFootstep, out FootstepModifierComponent? footstep) &&
footstep._soundCollection.TryGetSound(out var footstepSound))
if (EntityManager.ComponentManager.TryGetComponent(maybeFootstep, out FootstepModifierComponent? footstep))
{
soundToPlay = footstepSound;
soundToPlay = footstep.SoundCollection.GetSound();
break;
}
}
@@ -226,11 +225,8 @@ namespace Content.Server.Physics.Controllers
{
// Walking on a tile.
var def = (ContentTileDefinition) _tileDefinitionManager[tile.Tile.TypeId];
if (def.FootstepSounds.TryGetSound(out var footstepSound))
{
soundToPlay = footstepSound;
return;
}
soundToPlay = def.FootstepSounds.GetSound();
return;
}
if (string.IsNullOrWhiteSpace(soundToPlay))

View File

@@ -49,8 +49,7 @@ namespace Content.Server.Plants.Components
private void Rustle()
{
if(_rustleSound.TryGetSound(out var rustleSound))
SoundSystem.Play(Filter.Pvs(Owner), rustleSound, Owner, AudioHelpers.WithVariation(0.25f));
SoundSystem.Play(Filter.Pvs(Owner), _rustleSound.GetSound(), Owner, AudioHelpers.WithVariation(0.25f));
}
}
}

View File

@@ -123,8 +123,7 @@ namespace Content.Server.Pointing.Components
}
Owner.SpawnExplosion(0, 2, 1, 1);
if(_explosionSound.TryGetSound(out var explosionSound))
SoundSystem.Play(Filter.Pvs(Owner), explosionSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _explosionSound.GetSound(), Owner);
Owner.Delete();
}

View File

@@ -85,7 +85,7 @@ namespace Content.Server.Power.Components
if (serverMsg.Message is ApcToggleMainBreakerMessage)
{
var user = serverMsg.Session.AttachedEntity;
if(user == null) return;
if (user == null) return;
if (_accessReader == null || _accessReader.IsAllowed(user))
{
@@ -93,8 +93,7 @@ namespace Content.Server.Power.Components
Owner.GetComponent<PowerNetworkBatteryComponent>().CanDischarge = MainBreakerEnabled;
_uiDirty = true;
if(_onReceiveMessageSound.TryGetSound(out var onReceiveMessageSound))
SoundSystem.Play(Filter.Pvs(Owner), onReceiveMessageSound, Owner, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(Owner), _onReceiveMessageSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
}
else
{

View File

@@ -144,9 +144,9 @@ namespace Content.Server.PowerCell.Components
cell.Owner.Transform.Coordinates = Owner.Transform.Coordinates;
}
if (playSound && CellRemoveSound.TryGetSound(out var cellRemoveSound))
if (playSound)
{
SoundSystem.Play(Filter.Pvs(Owner), cellRemoveSound, Owner, AudioHelpers.WithVariation(0.125f));
SoundSystem.Play(Filter.Pvs(Owner), CellRemoveSound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f));
}
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new PowerCellChangedEvent(true), false);
@@ -167,9 +167,9 @@ namespace Content.Server.PowerCell.Components
if (cellComponent.CellSize != SlotSize) return false;
if (!_cellContainer.Insert(cell)) return false;
//Dirty();
if (playSound && CellInsertSound.TryGetSound(out var cellInsertSound))
if (playSound)
{
SoundSystem.Play(Filter.Pvs(Owner), cellInsertSound, Owner, AudioHelpers.WithVariation(0.125f));
SoundSystem.Play(Filter.Pvs(Owner), CellInsertSound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f));
}
Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new PowerCellChangedEvent(false), false);

View File

@@ -86,8 +86,7 @@ namespace Content.Server.Projectiles.Components
// TODO: No wall component so ?
var offset = angle.ToVec().Normalized / 2;
var coordinates = user.Transform.Coordinates.Offset(offset);
if(_soundHitWall.TryGetSound(out var soundHitWall))
SoundSystem.Play(Filter.Pvs(coordinates), soundHitWall, coordinates);
SoundSystem.Play(Filter.Pvs(coordinates), _soundHitWall.GetSound(), coordinates);
}
Owner.SpawnTimer((int) _deathTime.TotalMilliseconds, () =>

View File

@@ -26,8 +26,8 @@ namespace Content.Server.Projectiles.Components
public bool DeleteOnCollide { get; } = true;
// Get that juicy FPS hit sound
[DataField("soundHit")] public SoundSpecifier SoundHit = default!;
[DataField("soundHitSpecies")] public SoundSpecifier SoundHitSpecies = default!;
[DataField("soundHit", required: true)] public SoundSpecifier SoundHit = default!;
[DataField("soundHitSpecies", required: true)] public SoundSpecifier SoundHitSpecies = default!;
public bool DamagedEntity;

View File

@@ -32,14 +32,13 @@ namespace Content.Server.Projectiles
var coordinates = args.OtherFixture.Body.Owner.Transform.Coordinates;
var playerFilter = Filter.Pvs(coordinates);
if (!otherEntity.Deleted &&
otherEntity.HasComponent<SharedBodyComponent>() && component.SoundHitSpecies.TryGetSound(out var soundHitSpecies))
if (!otherEntity.Deleted && otherEntity.HasComponent<SharedBodyComponent>())
{
SoundSystem.Play(playerFilter, soundHitSpecies, coordinates);
SoundSystem.Play(playerFilter, component.SoundHitSpecies.GetSound(), coordinates);
}
else if (component.SoundHit.TryGetSound(out var soundHit))
else
{
SoundSystem.Play(playerFilter, soundHit, coordinates);
SoundSystem.Play(playerFilter, component.SoundHit.GetSound(), coordinates);
}
if (!otherEntity.Deleted && otherEntity.TryGetComponent(out IDamageableComponent? damage))

View File

@@ -33,7 +33,7 @@ namespace Content.Server.RCD.Components
public override string Name => "RCD";
private RcdMode _mode = 0; //What mode are we on? Can be floors, walls, deconstruct.
private readonly RcdMode[] _modes = (RcdMode[]) Enum.GetValues(typeof(RcdMode));
private readonly RcdMode[] _modes = (RcdMode[]) Enum.GetValues(typeof(RcdMode));
[ViewVariables(VVAccess.ReadWrite)] [DataField("maxAmmo")] public int MaxAmmo = 5;
public int _ammo; //How much "ammo" we have left. You can refill this with RCD ammo.
[ViewVariables(VVAccess.ReadWrite)] [DataField("delay")] private float _delay = 2f;
@@ -77,8 +77,7 @@ namespace Content.Server.RCD.Components
public void SwapMode(UseEntityEventArgs eventArgs)
{
if(_swapModeSound.TryGetSound(out var swapModeSound))
SoundSystem.Play(Filter.Pvs(Owner), swapModeSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _swapModeSound.GetSound(), Owner);
var mode = (int) _mode; //Firstly, cast our RCDmode mode to an int (enums are backed by ints anyway by default)
mode = (++mode) % _modes.Length; //Then, do a rollover on the value so it doesnt hit an invalid state
_mode = (RcdMode) mode; //Finally, cast the newly acquired int mode to an RCDmode so we can use it.
@@ -104,7 +103,7 @@ namespace Content.Server.RCD.Components
}
}
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
{
// FIXME: Make this work properly. Right now it relies on the click location being on a grid, which is bad.
if (!eventArgs.ClickLocation.IsValid(Owner.EntityManager) || !eventArgs.ClickLocation.GetGridId(Owner.EntityManager).IsValid())
@@ -163,8 +162,7 @@ namespace Content.Server.RCD.Components
return true; //I don't know why this would happen, but sure I guess. Get out of here invalid state!
}
if(_successSound.TryGetSound(out var successSound))
SoundSystem.Play(Filter.Pvs(Owner), successSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _successSound.GetSound(), Owner);
_ammo--;
return true;
}

View File

@@ -93,8 +93,7 @@ namespace Content.Server.Radiation
_endTime = currentTime + TimeSpan.FromSeconds(_duration);
}
if(Sound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner.Transform.Coordinates);
SoundSystem.Play(Filter.Pvs(Owner), Sound.GetSound(), Owner.Transform.Coordinates);
Dirty();
}
@@ -109,7 +108,7 @@ namespace Content.Server.Radiation
if (!Decay || Owner.Deleted)
return;
if(_duration <= 0f)
if (_duration <= 0f)
Owner.QueueDelete();
_duration -= frameTime;

View File

@@ -125,8 +125,7 @@ namespace Content.Server.Research.Components
private void PlayKeyboardSound()
{
if (_soundCollectionName.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioParams.Default);
SoundSystem.Play(Filter.Pvs(Owner), _soundCollectionName.GetSound(), Owner, AudioParams.Default);
}
}
}

View File

@@ -89,9 +89,8 @@ namespace Content.Server.Singularity.Components
audioParams.Loop = true;
audioParams.MaxDistance = 20f;
audioParams.Volume = 5;
if(_singularityFormingSound.TryGetSound(out var singuloFormingSound))
SoundSystem.Play(Filter.Pvs(Owner), singuloFormingSound, Owner);
Timer.Spawn(5200,() => _playingSound = SoundSystem.Play(Filter.Pvs(Owner), _singularitySound.GetSound(), Owner, audioParams));
SoundSystem.Play(Filter.Pvs(Owner), _singularityFormingSound.GetSound(), Owner);
Timer.Spawn(5200, () => _playingSound = SoundSystem.Play(Filter.Pvs(Owner), _singularitySound.GetSound(), Owner, audioParams));
_singularitySystem.ChangeSingularityLevel(this, 1);
}
@@ -104,8 +103,7 @@ namespace Content.Server.Singularity.Components
protected override void OnRemove()
{
_playingSound?.Stop();
if(_singularityCollapsingSound.TryGetSound(out var singuloCollapseSound))
SoundSystem.Play(Filter.Pvs(Owner), singuloCollapseSound, Owner.Transform.Coordinates);
SoundSystem.Play(Filter.Pvs(Owner), _singularityCollapsingSound.GetSound(), Owner.Transform.Coordinates);
base.OnRemove();
}
}

View File

@@ -9,10 +9,7 @@ namespace Content.Server.Slippery
{
protected override void PlaySound(SlipperyComponent component)
{
if (component.SlipSound.TryGetSound(out var slipSound))
{
SoundSystem.Play(Filter.Pvs(component.Owner), slipSound, component.Owner, AudioHelpers.WithVariation(0.2f));
}
SoundSystem.Play(Filter.Pvs(component.Owner), component.SlipSound.GetSound(), component.Owner, AudioHelpers.WithVariation(0.2f));
}
}
}

View File

@@ -12,7 +12,7 @@ namespace Content.Server.Sound.Components
public abstract class BaseEmitSoundComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField("sound")]
[DataField("sound", required: true)]
public SoundSpecifier Sound { get; set; } = default!;
[ViewVariables(VVAccess.ReadWrite)]

View File

@@ -7,7 +7,6 @@ using Content.Shared.Throwing;
using JetBrains.Annotations;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.Log;
using Robust.Shared.Player;
namespace Content.Server.Sound
@@ -50,14 +49,7 @@ namespace Content.Server.Sound
private static void TryEmitSound(BaseEmitSoundComponent component)
{
if (component.Sound.TryGetSound(out var sound))
{
SoundSystem.Play(Filter.Pvs(component.Owner), sound, component.Owner, AudioHelpers.WithVariation(component.PitchVariation).WithVolume(-2f));
}
else
{
Logger.Warning($"{nameof(component)} Uid:{component.Owner.Uid} has no {nameof(component.Sound)} to play.");
}
SoundSystem.Play(Filter.Pvs(component.Owner), component.Sound.GetSound(), component.Owner, AudioHelpers.WithVariation(component.PitchVariation).WithVolume(-2f));
}
}
}

View File

@@ -17,7 +17,7 @@ namespace Content.Server.Storage.Components
[RegisterComponent]
public class CursedEntityStorageComponent : EntityStorageComponent
{
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;
public override string Name => "CursedEntityStorage";
@@ -42,7 +42,7 @@ namespace Content.Server.Storage.Components
var locker = lockerEnt.GetComponent<EntityStorageComponent>();
if(locker.Open)
if (locker.Open)
locker.TryCloseStorage(Owner);
foreach (var entity in Contents.ContainedEntities.ToArray())
@@ -51,10 +51,8 @@ namespace Content.Server.Storage.Components
locker.Insert(entity);
}
if(_cursedSound.TryGetSound(out var cursedSound))
SoundSystem.Play(Filter.Pvs(Owner), cursedSound, Owner, AudioHelpers.WithVariation(0.125f));
if(_cursedLockerSound.TryGetSound(out var cursedLockerSound))
SoundSystem.Play(Filter.Pvs(lockerEnt), cursedLockerSound, lockerEnt, AudioHelpers.WithVariation(0.125f));
SoundSystem.Play(Filter.Pvs(Owner), _cursedSound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f));
SoundSystem.Play(Filter.Pvs(lockerEnt), _cursedLockerSound.GetSound(), lockerEnt, AudioHelpers.WithVariation(0.125f));
}
}
}

View File

@@ -226,8 +226,7 @@ namespace Content.Server.Storage.Components
}
ModifyComponents();
if(_closeSound.TryGetSound(out var closeSound))
SoundSystem.Play(Filter.Pvs(Owner), closeSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _closeSound.GetSound(), Owner);
_lastInternalOpenAttempt = default;
}
@@ -236,8 +235,7 @@ namespace Content.Server.Storage.Components
Open = true;
EmptyContents();
ModifyComponents();
if(_openSound.TryGetSound(out var openSound))
SoundSystem.Play(Filter.Pvs(Owner), openSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), _openSound.GetSound(), Owner);
}
private void UpdateAppearance()

View File

@@ -1,18 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Content.Server.DoAfter;
using Content.Server.Hands.Components;
using Content.Server.Items;
using Content.Server.Placeable;
using Content.Shared.Acts;
using Content.Shared.Audio;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Item;
using Content.Shared.Notification;
using Content.Shared.Notification.Managers;
using Content.Shared.Sound;
using Content.Shared.Storage;
@@ -31,6 +24,11 @@ using Robust.Shared.Player;
using Robust.Shared.Players;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Content.Server.Storage.Components
{
@@ -66,7 +64,7 @@ namespace Content.Server.Storage.Components
public readonly HashSet<IPlayerSession> SubscribedSessions = new();
[DataField("storageSoundCollection")]
public SoundSpecifier StorageSoundCollection { get; set; } = default!;
public SoundSpecifier StorageSoundCollection { get; set; } = new SoundCollectionSpecifier("storageRustle");
[ViewVariables]
public override IReadOnlyList<IEntity>? StoredEntities => _storage?.ContainedEntities;
@@ -389,79 +387,79 @@ namespace Content.Server.Storage.Components
switch (message)
{
case RemoveEntityMessage remove:
{
EnsureInitialCalculated();
var player = session.AttachedEntity;
if (player == null)
{
EnsureInitialCalculated();
var player = session.AttachedEntity;
if (player == null)
{
break;
}
var ownerTransform = Owner.Transform;
var playerTransform = player.Transform;
if (!playerTransform.Coordinates.InRange(Owner.EntityManager, ownerTransform.Coordinates, 2) ||
!ownerTransform.IsMapTransform &&
!playerTransform.ContainsEntity(ownerTransform))
{
break;
}
var entity = Owner.EntityManager.GetEntity(remove.EntityUid);
if (entity == null || _storage?.Contains(entity) == false)
{
break;
}
var item = entity.GetComponent<ItemComponent>();
if (item == null ||
!player.TryGetComponent(out HandsComponent? hands))
{
break;
}
if (!hands.CanPutInHand(item))
{
break;
}
hands.PutInHand(item);
break;
}
var ownerTransform = Owner.Transform;
var playerTransform = player.Transform;
if (!playerTransform.Coordinates.InRange(Owner.EntityManager, ownerTransform.Coordinates, 2) ||
!ownerTransform.IsMapTransform &&
!playerTransform.ContainsEntity(ownerTransform))
{
break;
}
var entity = Owner.EntityManager.GetEntity(remove.EntityUid);
if (entity == null || _storage?.Contains(entity) == false)
{
break;
}
var item = entity.GetComponent<ItemComponent>();
if (item == null ||
!player.TryGetComponent(out HandsComponent? hands))
{
break;
}
if (!hands.CanPutInHand(item))
{
break;
}
hands.PutInHand(item);
break;
}
case InsertEntityMessage _:
{
EnsureInitialCalculated();
var player = session.AttachedEntity;
if (player == null)
{
EnsureInitialCalculated();
var player = session.AttachedEntity;
if (player == null)
{
break;
}
if (!player.InRangeUnobstructed(Owner, popup: true))
{
break;
}
PlayerInsertHeldEntity(player);
break;
}
if (!player.InRangeUnobstructed(Owner, popup: true))
{
break;
}
PlayerInsertHeldEntity(player);
break;
}
case CloseStorageUIMessage _:
{
if (session is not IPlayerSession playerSession)
{
if (session is not IPlayerSession playerSession)
{
break;
}
UnsubscribeSession(playerSession);
break;
}
UnsubscribeSession(playerSession);
break;
}
}
}
@@ -511,7 +509,7 @@ namespace Content.Server.Storage.Components
// Pick up all entities in a radius around the clicked location.
// The last half of the if is because carpets exist and this is terrible
if(_areaInsert && (eventArgs.Target == null || !eventArgs.Target.HasComponent<SharedItemComponent>()))
if (_areaInsert && (eventArgs.Target == null || !eventArgs.Target.HasComponent<SharedItemComponent>()))
{
var validStorables = new List<IEntity>();
foreach (var entity in IoCManager.Resolve<IEntityLookup>().GetEntitiesInRange(eventArgs.ClickLocation, 1))
@@ -556,7 +554,7 @@ namespace Content.Server.Storage.Components
}
// If we picked up atleast one thing, play a sound and do a cool animation!
if (successfullyInserted.Count>0)
if (successfullyInserted.Count > 0)
{
PlaySoundCollection();
SendNetworkMessage(
@@ -569,7 +567,7 @@ namespace Content.Server.Storage.Components
return true;
}
// Pick up the clicked entity
else if(_quickInsert)
else if (_quickInsert)
{
if (eventArgs.Target == null
|| !eventArgs.Target.Transform.IsMapTransform
@@ -577,7 +575,7 @@ namespace Content.Server.Storage.Components
|| !eventArgs.Target.HasComponent<SharedItemComponent>())
return false;
var position = eventArgs.Target.Transform.Coordinates;
if(PlayerInsertEntityInWorld(eventArgs.User, eventArgs.Target))
if (PlayerInsertEntityInWorld(eventArgs.User, eventArgs.Target))
{
SendNetworkMessage(new AnimateInsertingEntitiesMessage(
new List<EntityUid>() { eventArgs.Target.Uid },
@@ -631,9 +629,7 @@ namespace Content.Server.Storage.Components
private void PlaySoundCollection()
{
// TODO this doesn't compile or work
if(StorageSoundCollection?.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioParams.Default);
SoundSystem.Play(Filter.Pvs(Owner), StorageSoundCollection.GetSound(), Owner, AudioParams.Default);
}
}
}

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Content.Shared.Sound;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
@@ -23,7 +23,7 @@ namespace Content.Server.Storage.Components
/// <summary>
/// A sound to play when the items are spawned. For example, gift boxes being unwrapped.
/// </summary>
[DataField("sound")]
[DataField("sound", required: true)]
public SoundSpecifier? Sound = null;
/// <summary>

View File

@@ -29,7 +29,7 @@ namespace Content.Server.Stunnable.Components
protected override void OnKnockdownEnd()
{
if(Owner.TryGetComponent(out IMobStateComponent? mobState) && !mobState.IsIncapacitated())
if (Owner.TryGetComponent(out IMobStateComponent? mobState) && !mobState.IsIncapacitated())
EntitySystem.Get<StandingStateSystem>().Stand(Owner);
}
@@ -57,8 +57,7 @@ namespace Content.Server.Stunnable.Components
protected override void OnInteractHand()
{
if(_stunAttemptSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioHelpers.WithVariation(0.05f));
SoundSystem.Play(Filter.Pvs(Owner), _stunAttemptSound.GetSound(), Owner, AudioHelpers.WithVariation(0.05f));
}
bool IDisarmedAct.Disarmed(DisarmedActEventArgs eventArgs)
@@ -73,12 +72,11 @@ namespace Content.Server.Stunnable.Components
if (source != null)
{
if (_stunAttemptSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(source), sound, source, AudioHelpers.WithVariation(0.025f));
SoundSystem.Play(Filter.Pvs(source), _stunAttemptSound.GetSound(), source, AudioHelpers.WithVariation(0.025f));
if (target != null)
{
source.PopupMessageOtherClients(Loc.GetString("stunnable-component-disarm-success-others", ("source", source.Name),("target", target.Name)));
source.PopupMessageCursor(Loc.GetString("stunnable-component-disarm-success",("target", target.Name)));
source.PopupMessageOtherClients(Loc.GetString("stunnable-component-disarm-success-others", ("source", source.Name), ("target", target.Name)));
source.PopupMessageCursor(Loc.GetString("stunnable-component-disarm-success", ("target", target.Name)));
}
}

View File

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

View File

@@ -23,7 +23,7 @@ namespace Content.Server.Tiles
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
public override string Name => "FloorTile";
[DataField("outputs", customTypeSerializer:typeof(PrototypeIdListSerializer<ContentTileDefinition>))]
[DataField("outputs", customTypeSerializer: typeof(PrototypeIdListSerializer<ContentTileDefinition>))]
private List<string>? _outputTiles;
[DataField("placeTileSound")] SoundSpecifier _placeTileSound = new SoundPathSpecifier("/Audio/Items/genhit.ogg");
@@ -50,8 +50,7 @@ namespace Content.Server.Tiles
private void PlaceAt(IMapGrid mapGrid, EntityCoordinates location, ushort tileId, float offset = 0)
{
mapGrid.SetTile(location.Offset(new Vector2(offset, offset)), new Tile(tileId));
if(_placeTileSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(location), sound, location, AudioHelpers.WithVariation(0.125f));
SoundSystem.Play(Filter.Pvs(location), _placeTileSound.GetSound(), location, AudioHelpers.WithVariation(0.125f));
}
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)

View File

@@ -130,8 +130,7 @@ namespace Content.Server.Toilet
public void ToggleToiletSeat()
{
IsSeatUp = !IsSeatUp;
if(_toggleSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioHelpers.WithVariation(0.05f));
SoundSystem.Play(Filter.Pvs(Owner), _toggleSound.GetSound(), Owner, AudioHelpers.WithVariation(0.05f));
UpdateSprite();
}

View File

@@ -33,10 +33,10 @@ namespace Content.Server.Tools.Components
[DataField("sprite")]
public string Sprite { get; } = string.Empty;
[DataField("useSound")]
[DataField("useSound", required: true)]
public SoundSpecifier Sound { get; } = default!;
[DataField("changeSound")]
[DataField("changeSound", required: true)]
public SoundSpecifier ChangeSound { get; } = default!;
}
@@ -60,8 +60,7 @@ namespace Content.Server.Tools.Components
_currentTool = (_currentTool + 1) % _tools.Count;
SetTool();
var current = _tools[_currentTool];
if(current.ChangeSound.TryGetSound(out var changeSound))
SoundSystem.Play(Filter.Pvs(Owner), changeSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), current.ChangeSound.GetSound(), Owner);
}
private void SetTool()

View File

@@ -44,7 +44,7 @@ namespace Content.Server.Tools.Components
[DataField("speed")]
public float SpeedModifier { get; set; } = 1;
[DataField("useSound")]
[DataField("useSound", required: true)]
public SoundSpecifier UseSound { get; set; } = default!;
public void AddQuality(ToolQuality quality)
@@ -96,8 +96,7 @@ namespace Content.Server.Tools.Components
public void PlayUseSound(float volume = -5f)
{
if(UseSound.TryGetSound(out var useSound))
SoundSystem.Play(Filter.Pvs(Owner), useSound, Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume));
SoundSystem.Play(Filter.Pvs(Owner), UseSound.GetSound(), Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume));
}
}
}

View File

@@ -60,7 +60,7 @@ namespace Content.Server.Tools.Components
private SolutionContainerComponent? _solutionComponent;
private PointLightComponent? _pointLightComponent;
[DataField("weldSounds")]
[DataField("weldSounds", required: true)]
private SoundSpecifier WeldSounds { get; set; } = default!;
[DataField("welderOffSounds")]
@@ -171,9 +171,9 @@ namespace Content.Server.Tools.Components
var succeeded = _solutionComponent.TryRemoveReagent("WeldingFuel", ReagentUnit.New(value));
if (succeeded && !silent && WeldSounds.TryGetSound(out var weldSounds))
if (succeeded && !silent)
{
PlaySound(weldSounds);
PlaySound(WeldSounds);
}
return succeeded;
}
@@ -204,8 +204,7 @@ namespace Content.Server.Tools.Components
if (_pointLightComponent != null) _pointLightComponent.Enabled = false;
if(WelderOffSounds.TryGetSound(out var welderOffSOunds))
PlaySound(welderOffSOunds, -5);
PlaySound(WelderOffSounds, -5);
_welderSystem.Unsubscribe(this);
return true;
}
@@ -222,8 +221,7 @@ namespace Content.Server.Tools.Components
if (_pointLightComponent != null) _pointLightComponent.Enabled = true;
if (WelderOnSounds.TryGetSound(out var welderOnSOunds))
PlaySound(welderOnSOunds, -5);
PlaySound(WelderOnSounds, -5);
_welderSystem.Subscribe(this);
EntitySystem.Get<AtmosphereSystem>().HotspotExpose(Owner.Transform.Coordinates, 700, 50, true);
@@ -283,8 +281,7 @@ namespace Content.Server.Tools.Components
if (TryWeld(5, victim, silent: true))
{
if(WeldSounds.TryGetSound(out var weldSound))
PlaySound(weldSound);
PlaySound(WeldSounds);
othersMessage =
Loc.GetString("welder-component-suicide-lit-others-message",
@@ -337,8 +334,7 @@ namespace Content.Server.Tools.Components
{
var drained = targetSolution.Drain(trans);
_solutionComponent.TryAddSolution(drained);
if(WelderRefill.TryGetSound(out var welderRefillSound))
SoundSystem.Play(Filter.Pvs(Owner), welderRefillSound, Owner);
SoundSystem.Play(Filter.Pvs(Owner), WelderRefill.GetSound(), Owner);
eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("welder-component-after-interact-refueled-message"));
}
}
@@ -346,9 +342,9 @@ namespace Content.Server.Tools.Components
return true;
}
private void PlaySound(string soundName, float volume = -5f)
private void PlaySound(SoundSpecifier sound, float volume = -5f)
{
SoundSystem.Play(Filter.Pvs(Owner), soundName, Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume));
SoundSystem.Play(Filter.Pvs(Owner), sound.GetSound(), Owner, AudioHelpers.WithVariation(0.15f).WithVolume(volume));
}
}
}

View File

@@ -202,8 +202,7 @@ namespace Content.Server.VendingMachines
Owner.EntityManager.SpawnEntity(id, Owner.Transform.Coordinates);
});
if(_soundVend.TryGetSound(out var soundVend))
SoundSystem.Play(Filter.Pvs(Owner), soundVend, Owner, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(Owner), _soundVend.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
}
private void TryEject(string id, IEntity? sender)
@@ -222,8 +221,7 @@ namespace Content.Server.VendingMachines
private void Deny()
{
if(_soundDeny.TryGetSound(out var soundDeny))
SoundSystem.Play(Filter.Pvs(Owner), soundDeny, Owner, AudioParams.Default.WithVolume(-2f));
SoundSystem.Play(Filter.Pvs(Owner), _soundDeny.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
// Play the Deny animation
TrySetVisualState(VendingMachineVisualState.Deny);

Some files were not shown because too many files have changed in this diff Show More