replacing sound (collection) names with SoundSpecifier - part 1

This commit is contained in:
Galactic Chimp
2021-07-10 17:35:33 +02:00
parent 4500b66f28
commit ce3c59e0e6
131 changed files with 934 additions and 587 deletions

View File

@@ -6,6 +6,7 @@ using Content.Server.UserInterface;
using Content.Shared.Cargo;
using Content.Shared.Cargo.Components;
using Content.Shared.Interaction;
using Content.Shared.Sound;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
@@ -59,6 +60,9 @@ namespace Content.Server.Cargo.Components
[DataField("requestOnly")]
private bool _requestOnly = false;
[DataField("errorSound")]
private SoundSpecifier _errorSound = new SoundPathSpecifier("/Audio/Effects/error.ogg");
private bool Powered => !Owner.TryGetComponent(out ApcPowerReceiverComponent? receiver) || receiver.Powered;
private CargoConsoleSystem _cargoConsoleSystem = default!;
@@ -112,9 +116,10 @@ namespace Content.Server.Cargo.Components
}
if (!_cargoConsoleSystem.AddOrder(orders.Database.Id, msg.Requester, msg.Reason, msg.ProductId,
msg.Amount, _bankAccount.Id))
msg.Amount, _bankAccount.Id) &&
_errorSound.TryGetSound(out var errorSound))
{
SoundSystem.Play(Filter.Local(), "/Audio/Effects/error.ogg", Owner, AudioParams.Default);
SoundSystem.Play(Filter.Local(), errorSound, Owner, AudioParams.Default);
}
break;
}
@@ -137,14 +142,16 @@ namespace Content.Server.Cargo.Components
break;
var capacity = _cargoConsoleSystem.GetCapacity(orders.Database.Id);
if (
capacity.CurrentCapacity == capacity.MaxCapacity
(capacity.CurrentCapacity == capacity.MaxCapacity
|| capacity.CurrentCapacity + order.Amount > capacity.MaxCapacity
|| !_cargoConsoleSystem.CheckBalance(_bankAccount.Id, (-product.PointCost) * order.Amount)
|| !_cargoConsoleSystem.ApproveOrder(orders.Database.Id, msg.OrderNumber)
|| !_cargoConsoleSystem.ChangeBalance(_bankAccount.Id, (-product.PointCost) * order.Amount)
|| !_cargoConsoleSystem.ChangeBalance(_bankAccount.Id, (-product.PointCost) * order.Amount))
&&
_errorSound.TryGetSound(out var errorSound)
)
{
SoundSystem.Play(Filter.Local(), "/Audio/Effects/error.ogg", Owner, AudioParams.Default);
SoundSystem.Play(Filter.Local(), errorSound, Owner, AudioParams.Default);
break;
}
UpdateUIState();