From 0c09d4d7e2da487a95c16fdc58cb4e3b2d1fad96 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Tue, 10 Aug 2021 16:18:57 -0700 Subject: [PATCH] Fix stuff --- .../Cuffs/Components/HandcuffComponent.cs | 3 +- .../Components/SoundOnTriggerComponent.cs | 2 +- .../Nutrition/Components/CreamPieComponent.cs | 2 +- Content.Server/PDA/PDAComponent.cs | 66 ++++----- .../Physics/Controllers/MoverController.cs | 3 +- .../Components/EmitterComponent.cs | 2 +- .../EntitySystems/EmitterSystem.cs | 2 +- .../StationEvents/Events/GasLeak.cs | 1 - .../Components/ServerStorageComponent.cs | 132 +++++++++--------- Content.Server/Window/WindowComponent.cs | 10 +- 10 files changed, 111 insertions(+), 112 deletions(-) diff --git a/Content.Server/Cuffs/Components/HandcuffComponent.cs b/Content.Server/Cuffs/Components/HandcuffComponent.cs index c652e00e2e..24cedb9a26 100644 --- a/Content.Server/Cuffs/Components/HandcuffComponent.cs +++ b/Content.Server/Cuffs/Components/HandcuffComponent.cs @@ -116,7 +116,8 @@ namespace Content.Server.Cuffs.Components [DataField("startCuffSound")] public SoundSpecifier StartCuffSound { get; set; } = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_start.ogg"); - [DataField("endCuffSound")] public SoundSpecifier EndCuffSound { get; set; } = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_end.ogg"); + [DataField("endCuffSound")] + public SoundSpecifier EndCuffSound { get; set; } = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_end.ogg"); [DataField("startBreakoutSound")] public SoundSpecifier StartBreakoutSound { get; set; } = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_breakout_start.ogg"); diff --git a/Content.Server/Explosion/Components/SoundOnTriggerComponent.cs b/Content.Server/Explosion/Components/SoundOnTriggerComponent.cs index 83ea9bca05..ac25afb8e9 100644 --- a/Content.Server/Explosion/Components/SoundOnTriggerComponent.cs +++ b/Content.Server/Explosion/Components/SoundOnTriggerComponent.cs @@ -15,6 +15,6 @@ namespace Content.Server.Explosion.Components [ViewVariables(VVAccess.ReadWrite)] [DataField("sound", required: true)] - public SoundSpecifier? Sound { get; set; } = null; + public SoundSpecifier Sound { get; set; } = default!; } } diff --git a/Content.Server/Nutrition/Components/CreamPieComponent.cs b/Content.Server/Nutrition/Components/CreamPieComponent.cs index 97b46fd83a..2cf0349582 100644 --- a/Content.Server/Nutrition/Components/CreamPieComponent.cs +++ b/Content.Server/Nutrition/Components/CreamPieComponent.cs @@ -21,7 +21,7 @@ namespace Content.Server.Nutrition.Components public float ParalyzeTime { get; set; } = 1f; [DataField("sound")] - private SoundSpecifier _sound = new SoundCollectionSpecifier("desacration"); + private SoundSpecifier _sound = new SoundCollectionSpecifier("desecration"); public void PlaySound() { diff --git a/Content.Server/PDA/PDAComponent.cs b/Content.Server/PDA/PDAComponent.cs index a2ffba3a95..6f528af652 100644 --- a/Content.Server/PDA/PDAComponent.cs +++ b/Content.Server/PDA/PDAComponent.cs @@ -104,49 +104,49 @@ namespace Content.Server.PDA switch (message.Message) { case PDARequestUpdateInterfaceMessage _: - { - UpdatePDAUserInterface(); - break; - } + { + UpdatePDAUserInterface(); + break; + } case PDAToggleFlashlightMessage _: - { - ToggleLight(); - break; - } + { + ToggleLight(); + break; + } case PDAEjectIDMessage _: - { - HandleIDEjection(message.Session.AttachedEntity!); - break; - } + { + HandleIDEjection(message.Session.AttachedEntity!); + break; + } case PDAEjectPenMessage _: - { - HandlePenEjection(message.Session.AttachedEntity!); - break; - } + { + 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)) { - 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); + 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; + } } } diff --git a/Content.Server/Physics/Controllers/MoverController.cs b/Content.Server/Physics/Controllers/MoverController.cs index 386a79af1f..e01b80327f 100644 --- a/Content.Server/Physics/Controllers/MoverController.cs +++ b/Content.Server/Physics/Controllers/MoverController.cs @@ -226,7 +226,8 @@ namespace Content.Server.Physics.Controllers // Walking on a tile. var def = (ContentTileDefinition) _tileDefinitionManager[tile.Tile.TypeId]; soundToPlay = def.FootstepSounds.GetSound(); - return; + if (string.IsNullOrEmpty(soundToPlay)) + return; } if (string.IsNullOrWhiteSpace(soundToPlay)) diff --git a/Content.Server/Singularity/Components/EmitterComponent.cs b/Content.Server/Singularity/Components/EmitterComponent.cs index 5b2b27191f..27748e96b0 100644 --- a/Content.Server/Singularity/Components/EmitterComponent.cs +++ b/Content.Server/Singularity/Components/EmitterComponent.cs @@ -35,7 +35,7 @@ namespace Content.Server.Singularity.Components [ViewVariables] public int FireShotCounter; - [ViewVariables] [DataField("fireSound")] public string FireSound = "/Audio/Weapons/emitter.ogg"; + [ViewVariables] [DataField("fireSound")] public SoundSpecifier FireSound = new SoundPathSpecifier("/Audio/Weapons/emitter.ogg"); [ViewVariables] [DataField("boltType")] public string BoltType = "EmitterBolt"; [ViewVariables] [DataField("powerUseActive")] public int PowerUseActive = 500; [ViewVariables] [DataField("fireBurstSize")] public int FireBurstSize = 3; diff --git a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs index fd5d157a11..75950f6866 100644 --- a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs +++ b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs @@ -222,7 +222,7 @@ namespace Content.Server.Singularity.EntitySystems // TODO: Move to projectile's code. Timer.Spawn(3000, () => projectile.Delete()); - SoundSystem.Play(Filter.Pvs(component.Owner), component.FireSound, component.Owner, + SoundSystem.Play(Filter.Pvs(component.Owner), component.FireSound.GetSound(), component.Owner, AudioHelpers.WithVariation(EmitterComponent.Variation).WithVolume(EmitterComponent.Volume).WithMaxDistance(EmitterComponent.Distance)); } diff --git a/Content.Server/StationEvents/Events/GasLeak.cs b/Content.Server/StationEvents/Events/GasLeak.cs index f41e9b398b..b1108edcae 100644 --- a/Content.Server/StationEvents/Events/GasLeak.cs +++ b/Content.Server/StationEvents/Events/GasLeak.cs @@ -2,7 +2,6 @@ using Content.Server.Atmos.Components; using Content.Server.Atmos.EntitySystems; using Content.Server.GameTicking; using Content.Shared.Atmos; -using Content.Shared.Sound; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; diff --git a/Content.Server/Storage/Components/ServerStorageComponent.cs b/Content.Server/Storage/Components/ServerStorageComponent.cs index 86a4ff89f3..25df3277c6 100644 --- a/Content.Server/Storage/Components/ServerStorageComponent.cs +++ b/Content.Server/Storage/Components/ServerStorageComponent.cs @@ -1,3 +1,8 @@ +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; @@ -24,11 +29,6 @@ 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 { @@ -387,79 +387,77 @@ 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(); - 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(); + 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; + } } } diff --git a/Content.Server/Window/WindowComponent.cs b/Content.Server/Window/WindowComponent.cs index fb83630d11..9eeca09d67 100644 --- a/Content.Server/Window/WindowComponent.cs +++ b/Content.Server/Window/WindowComponent.cs @@ -48,11 +48,11 @@ namespace Content.Server.Window switch (message) { case DamageChangedMessage msg: - { - var current = msg.Damageable.TotalDamage; - UpdateVisuals(current); - break; - } + { + var current = msg.Damageable.TotalDamage; + UpdateVisuals(current); + break; + } } }