diff --git a/Content.Client/Atmos/Components/PipeColorVisualsComponent.cs b/Content.Client/Atmos/Components/PipeColorVisualsComponent.cs index 99d27b12c7..b6eb361553 100644 --- a/Content.Client/Atmos/Components/PipeColorVisualsComponent.cs +++ b/Content.Client/Atmos/Components/PipeColorVisualsComponent.cs @@ -3,6 +3,6 @@ using Robust.Shared.GameObjects; namespace Content.Client.Atmos.Components; [RegisterComponent] -public class PipeColorVisualsComponent : Component +public sealed class PipeColorVisualsComponent : Component { } diff --git a/Content.Client/Commands/DebugCommands.cs b/Content.Client/Commands/DebugCommands.cs index c098cecc3b..a29a090ce0 100644 --- a/Content.Client/Commands/DebugCommands.cs +++ b/Content.Client/Commands/DebugCommands.cs @@ -17,8 +17,7 @@ namespace Content.Client.Commands public void Execute(IConsoleShell shell, string argStr, string[] args) { - EntitySystem.Get() - .MarkersVisible ^= true; + IoCManager.Resolve().GetEntitySystem().MarkersVisible ^= true; } } @@ -31,7 +30,7 @@ namespace Content.Client.Commands public void Execute(IConsoleShell shell, string argStr, string[] args) { - EntitySystem.Get().ShowAll ^= true; + IoCManager.Resolve().GetEntitySystem().ShowAll ^= true; } } @@ -47,14 +46,11 @@ namespace Content.Client.Commands EntitySystem.Get().ShowAll = true; var entMan = IoCManager.Resolve(); - var components = entMan.EntityQuery(true); + var components = entMan.EntityQuery(true); - foreach (var component in components) + foreach (var (_, sprite) in components) { - if (entMan.TryGetComponent(component.Owner, out ISpriteComponent? sprite)) - { - sprite.DrawDepth = (int) DrawDepth.Overlays; - } + sprite.DrawDepth = (int) DrawDepth.Overlays; } } } @@ -69,7 +65,7 @@ namespace Content.Client.Commands { var message = args[0]; - EntitySystem.Get().PopupCursor(message); + IoCManager.Resolve().GetEntitySystem().PopupCursor(message); } } } diff --git a/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs b/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs index bd02f5558c..e9b75ef3ec 100644 --- a/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs +++ b/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs @@ -90,7 +90,7 @@ namespace Content.Client.HealthOverlay.UI var mobStateSystem = _entities.EntitySysManager.GetEntitySystem(); FixedPoint2 threshold; - if (mobState.IsAlive()) + if (mobStateSystem.IsAlive(mobState.Owner, mobState)) { if (!mobStateSystem.TryGetEarliestCriticalState(mobState, damageable.TotalDamage, out _, out threshold)) { @@ -104,7 +104,7 @@ namespace Content.Client.HealthOverlay.UI HealthBar.Ratio = 1 - (damageable.TotalDamage / threshold).Float(); HealthBar.Visible = true; } - else if (mobState.IsCritical()) + else if (mobStateSystem.IsCritical(mobState.Owner, mobState)) { HealthBar.Ratio = 0; HealthBar.Visible = false; @@ -121,7 +121,7 @@ namespace Content.Client.HealthOverlay.UI ((damageable.TotalDamage - critThreshold) / (deadThreshold - critThreshold)).Float(); } - else if (mobState.IsDead()) + else if (mobStateSystem.IsDead(mobState.Owner, mobState)) { CritBar.Ratio = 0; CritBar.Visible = false; @@ -158,7 +158,8 @@ namespace Content.Client.HealthOverlay.UI { base.Dispose(disposing); - if (!disposing) return; + if (!disposing) + return; HealthBar.Dispose(); } diff --git a/Content.Client/IdentityManagement/IdentitySystem.cs b/Content.Client/IdentityManagement/IdentitySystem.cs index a43fc72084..15d4ee20e9 100644 --- a/Content.Client/IdentityManagement/IdentitySystem.cs +++ b/Content.Client/IdentityManagement/IdentitySystem.cs @@ -2,6 +2,6 @@ using Content.Shared.IdentityManagement; namespace Content.Client.IdentityManagement; -public class IdentitySystem : SharedIdentitySystem +public sealed class IdentitySystem : SharedIdentitySystem { } diff --git a/Content.Client/Info/InfoSystem.cs b/Content.Client/Info/InfoSystem.cs index 82dd95ee67..4572f3afdc 100644 --- a/Content.Client/Info/InfoSystem.cs +++ b/Content.Client/Info/InfoSystem.cs @@ -16,7 +16,7 @@ public sealed class InfoSystem : EntitySystem RaiseNetworkEvent(new RequestRulesMessage()); } - protected void OnRulesReceived(RulesMessage message, EntitySessionEventArgs eventArgs) + private void OnRulesReceived(RulesMessage message, EntitySessionEventArgs eventArgs) { Logger.DebugS("info", "Received server rules."); Rules = message; diff --git a/Content.Client/Info/RulesAndInfoWindow.cs b/Content.Client/Info/RulesAndInfoWindow.cs index b93db9300e..d231aeceb1 100644 --- a/Content.Client/Info/RulesAndInfoWindow.cs +++ b/Content.Client/Info/RulesAndInfoWindow.cs @@ -11,8 +11,6 @@ namespace Content.Client.Info public sealed class RulesAndInfoWindow : DefaultWindow { [Dependency] private readonly IResourceCache _resourceManager = default!; - [Dependency] private readonly IConfigurationManager _cfgManager = default!; - [Dependency] private readonly IEntitySystemManager _sysMan = default!; [Dependency] private readonly RulesManager _rules = default!; public RulesAndInfoWindow() diff --git a/Content.Client/Info/RulesControl.xaml.cs b/Content.Client/Info/RulesControl.xaml.cs index dda96dbe24..6086735e0e 100644 --- a/Content.Client/Info/RulesControl.xaml.cs +++ b/Content.Client/Info/RulesControl.xaml.cs @@ -11,9 +11,6 @@ namespace Content.Client.Info; [GenerateTypedNameReferences] public sealed partial class RulesControl : BoxContainer { - [Dependency] private readonly IResourceCache _resourceManager = default!; - [Dependency] private readonly IConfigurationManager _cfgManager = default!; - [Dependency] private readonly IEntitySystemManager _sysMan = default!; [Dependency] private readonly RulesManager _rules = default!; public RulesControl() diff --git a/Content.Client/Lobby/LobbyState.cs b/Content.Client/Lobby/LobbyState.cs index 204a055e83..185f129e42 100644 --- a/Content.Client/Lobby/LobbyState.cs +++ b/Content.Client/Lobby/LobbyState.cs @@ -24,10 +24,7 @@ namespace Content.Client.Lobby { [Dependency] private readonly IBaseClient _baseClient = default!; [Dependency] private readonly IClientConsoleHost _consoleHost = default!; - [Dependency] private readonly IChatManager _chatManager = default!; - [Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!; - [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IResourceCache _resourceCache = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; @@ -43,7 +40,7 @@ namespace Content.Client.Lobby protected override void Startup() { - _gameTicker = EntitySystem.Get(); + _gameTicker = _entityManager.System(); _characterSetup = new CharacterSetupGui(_entityManager, _resourceCache, _preferencesManager, _prototypeManager, _configurationManager); LayoutContainer.SetAnchorPreset(_characterSetup, LayoutContainer.LayoutPreset.Wide); @@ -113,10 +110,10 @@ namespace Content.Client.Lobby public override void FrameUpdate(FrameEventArgs e) { - if (_lobby == null) return; + if (_lobby == null) + return; - var gameTicker = EntitySystem.Get(); - if (gameTicker.IsGameStarted) + if (_gameTicker.IsGameStarted) { _lobby.StartTime.Text = string.Empty; _lobby.StationTime.Text = Loc.GetString("lobby-state-player-status-station-time", ("stationTime", _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan).ToString("hh\\:mm"))); @@ -125,13 +122,13 @@ namespace Content.Client.Lobby string text; - if (gameTicker.Paused) + if (_gameTicker.Paused) { text = Loc.GetString("lobby-state-paused"); } else { - var difference = gameTicker.StartTime - _gameTiming.CurTime; + var difference = _gameTicker.StartTime - _gameTiming.CurTime; var seconds = difference.TotalSeconds; if (seconds < 0) { @@ -156,16 +153,15 @@ namespace Content.Client.Lobby private void LobbyLateJoinStatusUpdated() { if (_lobby == null) return; - _lobby.ReadyButton.Disabled = EntitySystem.Get().DisallowedLateJoin; + _lobby.ReadyButton.Disabled = _gameTicker.DisallowedLateJoin; } private void UpdateLobbyUi() { - if (_lobby == null) return; + if (_lobby == null) + return; - var gameTicker = EntitySystem.Get(); - - if (gameTicker.IsGameStarted) + if (_gameTicker.IsGameStarted) { _lobby.ReadyButton.Text = Loc.GetString("lobby-state-ready-button-join-state"); _lobby.ReadyButton.ToggleMode = false; @@ -178,19 +174,21 @@ namespace Content.Client.Lobby _lobby.ReadyButton.Text = Loc.GetString("lobby-state-ready-button-ready-up-state"); _lobby.ReadyButton.ToggleMode = true; _lobby.ReadyButton.Disabled = false; - _lobby.ReadyButton.Pressed = gameTicker.AreWeReady; + _lobby.ReadyButton.Pressed = _gameTicker.AreWeReady; _lobby.ObserveButton.Disabled = true; } - if (gameTicker.ServerInfoBlob != null) + if (_gameTicker.ServerInfoBlob != null) { - _lobby.ServerInfo.SetInfoBlob(gameTicker.ServerInfoBlob); + _lobby.ServerInfo.SetInfoBlob(_gameTicker.ServerInfoBlob); } } private void UpdateLobbyBackground() { - if (_lobby == null) return; + if (_lobby == null) + return; + if (_gameTicker.LobbyBackground != null) { _lobby.Background.Texture = _resourceCache.GetResource(_gameTicker.LobbyBackground ); @@ -204,7 +202,7 @@ namespace Content.Client.Lobby private void SetReady(bool newReady) { - if (EntitySystem.Get().IsGameStarted) + if (_gameTicker.IsGameStarted) { return; } diff --git a/Content.Client/Pinpointer/ClientPinpointerSystem.cs b/Content.Client/Pinpointer/ClientPinpointerSystem.cs index 066624dbe2..d31aad8432 100644 --- a/Content.Client/Pinpointer/ClientPinpointerSystem.cs +++ b/Content.Client/Pinpointer/ClientPinpointerSystem.cs @@ -11,6 +11,7 @@ namespace Content.Client.Pinpointer public sealed class ClientPinpointerSystem : SharedPinpointerSystem { [Dependency] private readonly IEyeManager _eyeManager = default!; + [Dependency] private readonly AppearanceSystem _appearance = default!; public override void Initialize() { @@ -36,7 +37,9 @@ namespace Content.Client.Pinpointer private void HandleCompState(EntityUid uid, PinpointerComponent pinpointer, ref ComponentHandleState args) { - if (args.Current is not PinpointerComponentState state) return; + if (args.Current is not PinpointerComponentState state) + return; + SetActive(uid, state.IsActive, pinpointer); SetDirection(uid, state.DirectionToTarget, pinpointer); SetDistance(uid, state.DistanceToTarget, pinpointer); @@ -48,8 +51,8 @@ namespace Content.Client.Pinpointer if (!Resolve(uid, ref pinpointer, ref appearance)) return; - appearance.SetData(PinpointerVisuals.IsActive, pinpointer.IsActive); - appearance.SetData(PinpointerVisuals.TargetDistance, pinpointer.DistanceToTarget); + _appearance.SetData(uid, PinpointerVisuals.IsActive, pinpointer.IsActive, appearance); + _appearance.SetData(uid, PinpointerVisuals.TargetDistance, pinpointer.DistanceToTarget, appearance); } private void UpdateDirAppearance(EntityUid uid, Direction dir,PinpointerComponent? pinpointer = null, @@ -58,7 +61,7 @@ namespace Content.Client.Pinpointer if (!Resolve(uid, ref pinpointer, ref appearance)) return; - appearance.SetData(PinpointerVisuals.TargetDirection, dir); + _appearance.SetData(uid, PinpointerVisuals.TargetDirection, dir, appearance); } /// diff --git a/Content.Client/Preferences/ClientPreferencesManager.cs b/Content.Client/Preferences/ClientPreferencesManager.cs index 6119ee93dc..bafcfc08a0 100644 --- a/Content.Client/Preferences/ClientPreferencesManager.cs +++ b/Content.Client/Preferences/ClientPreferencesManager.cs @@ -38,8 +38,10 @@ namespace Content.Client.Preferences public void SelectCharacter(int slot) { Preferences = new PlayerPreferences(Preferences.Characters, slot, Preferences.AdminOOCColor); - var msg = _netManager.CreateNetMessage(); - msg.SelectedCharacterIndex = slot; + var msg = new MsgSelectCharacter + { + SelectedCharacterIndex = slot + }; _netManager.ClientSendMessage(msg); } @@ -48,9 +50,11 @@ namespace Content.Client.Preferences profile.EnsureValid(); var characters = new Dictionary(Preferences.Characters) {[slot] = profile}; Preferences = new PlayerPreferences(characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor); - var msg = _netManager.CreateNetMessage(); - msg.Profile = profile; - msg.Slot = slot; + var msg = new MsgUpdateCharacter + { + Profile = profile, + Slot = slot + }; _netManager.ClientSendMessage(msg); } @@ -82,8 +86,10 @@ namespace Content.Client.Preferences { var characters = Preferences.Characters.Where(p => p.Key != slot); Preferences = new PlayerPreferences(characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor); - var msg = _netManager.CreateNetMessage(); - msg.Slot = slot; + var msg = new MsgDeleteCharacter + { + Slot = slot + }; _netManager.ClientSendMessage(msg); } diff --git a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs index 6b624ab771..67d50e3f0d 100644 --- a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs @@ -187,7 +187,7 @@ public sealed partial class GunSystem : SharedGunSystem { SetCartridgeSpent(cartridge, true); MuzzleFlash(gun.Owner, cartridge, user); - PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user); + Audio.PlayPredicted(gun.SoundGunshot, gun.Owner, user); Recoil(user, direction); // TODO: Can't predict entity deletions. //if (cartridge.DeleteOnSpawn) @@ -195,7 +195,7 @@ public sealed partial class GunSystem : SharedGunSystem } else { - PlaySound(gun.Owner, gun.SoundEmpty?.GetSound(Random, ProtoManager), user); + Audio.PlayPredicted(gun.SoundEmpty, gun.Owner, user); } if (cartridge.Owner.IsClientSide()) @@ -204,7 +204,7 @@ public sealed partial class GunSystem : SharedGunSystem break; case AmmoComponent newAmmo: MuzzleFlash(gun.Owner, newAmmo, user); - PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user); + Audio.PlayPredicted(gun.SoundGunshot, gun.Owner, user); Recoil(user, direction); if (newAmmo.Owner.IsClientSide()) Del(newAmmo.Owner); @@ -212,7 +212,7 @@ public sealed partial class GunSystem : SharedGunSystem RemComp(newAmmo.Owner); break; case HitscanPrototype: - PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user); + Audio.PlayPredicted(gun.SoundGunshot, gun.Owner, user); Recoil(user, direction); break; } @@ -225,12 +225,6 @@ public sealed partial class GunSystem : SharedGunSystem _recoil.KickCamera(user.Value, recoil.Normalized * 0.5f); } - protected override void PlaySound(EntityUid gun, string? sound, EntityUid? user = null) - { - if (string.IsNullOrEmpty(sound) || user == null || !Timing.IsFirstTimePredicted) return; - SoundSystem.Play(sound, Filter.Local(), gun); - } - protected override void Popup(string message, EntityUid? uid, EntityUid? user) { if (uid == null || user == null || !Timing.IsFirstTimePredicted) return; diff --git a/Content.Server/Toilet/ToiletSystem.cs b/Content.Server/Toilet/ToiletSystem.cs index a702097c14..1b0975784f 100644 --- a/Content.Server/Toilet/ToiletSystem.cs +++ b/Content.Server/Toilet/ToiletSystem.cs @@ -23,6 +23,8 @@ namespace Content.Server.Toilet public sealed class ToiletSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SecretStashSystem _secretStash = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly ToolSystem _toolSystem = default!; @@ -42,7 +44,8 @@ namespace Content.Server.Toilet private void OnSuicide(EntityUid uid, ToiletComponent component, SuicideEvent args) { - if (args.Handled) return; + if (args.Handled) + return; // Check that victim has a head if (EntityManager.TryGetComponent(args.Victim, out var body) && @@ -180,19 +183,17 @@ namespace Content.Server.Toilet return; component.IsSeatUp = !component.IsSeatUp; - SoundSystem.Play(component.ToggleSound.GetSound(), Filter.Pvs(uid), - uid, AudioHelpers.WithVariation(0.05f)); - + _audio.PlayPvs(component.ToggleSound, uid, AudioParams.Default.WithVariation(0.05f)); UpdateSprite(uid, component); } private void UpdateSprite(EntityUid uid, ToiletComponent component) { - if (!EntityManager.TryGetComponent(uid,out AppearanceComponent? appearance)) + if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; - appearance.SetData(ToiletVisuals.LidOpen, component.LidOpen); - appearance.SetData(ToiletVisuals.SeatUp, component.IsSeatUp); + _appearance.SetData(uid, ToiletVisuals.LidOpen, component.LidOpen, appearance); + _appearance.SetData(uid, ToiletVisuals.SeatUp, component.IsSeatUp, appearance); } } diff --git a/Content.Server/UserInterface/IntrinsicUISystem.cs b/Content.Server/UserInterface/IntrinsicUISystem.cs index 6acb6bd21f..9811e9c6bc 100644 --- a/Content.Server/UserInterface/IntrinsicUISystem.cs +++ b/Content.Server/UserInterface/IntrinsicUISystem.cs @@ -51,7 +51,8 @@ public sealed class IntrinsicUISystem : EntitySystem var attempt = new IntrinsicUIOpenAttemptEvent(uid, key); RaiseLocalEvent(uid, attempt, false); - if (attempt.Cancelled) return false; + if (attempt.Cancelled) + return false; ui.Toggle(actor.PlayerSession); return true; diff --git a/Content.Server/Vehicle/VehicleSystem.Rider.cs b/Content.Server/Vehicle/VehicleSystem.Rider.cs index 3f9c0e1d6d..30c6a0d465 100644 --- a/Content.Server/Vehicle/VehicleSystem.Rider.cs +++ b/Content.Server/Vehicle/VehicleSystem.Rider.cs @@ -49,7 +49,7 @@ namespace Content.Server.Vehicle /// private void OnMobStateChanged(EntityUid uid, RiderComponent rider, MobStateChangedEvent args) { - if (args.Component.IsCritical() || args.Component.IsDead()) + if (args.CurrentMobState is DamageState.Critical or DamageState.Dead) { UnbuckleFromVehicle(uid); } diff --git a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs index 1a6daccd39..783c903043 100644 --- a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs @@ -131,18 +131,18 @@ public sealed partial class GunSystem : SharedGunSystem RaiseLocalEvent(cartridge.Owner, new AmmoShotEvent() { FiredProjectiles = shotProjectiles, - }, false); + }); SetCartridgeSpent(cartridge, true); MuzzleFlash(gun.Owner, cartridge, user); - PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user); + Audio.PlayPredicted(gun.SoundGunshot, gun.Owner, user); if (cartridge.DeleteOnSpawn) Del(cartridge.Owner); } else { - PlaySound(gun.Owner, gun.SoundEmpty?.GetSound(Random, ProtoManager), user); + Audio.PlayPredicted(gun.SoundEmpty, gun.Owner, user); } // Something like ballistic might want to leave it in the container still @@ -155,7 +155,7 @@ public sealed partial class GunSystem : SharedGunSystem case AmmoComponent newAmmo: shotProjectiles.Add(newAmmo.Owner); MuzzleFlash(gun.Owner, newAmmo, user); - PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user); + Audio.PlayPredicted(gun.SoundGunshot, gun.Owner, user); // Do a throw if (!HasComp(newAmmo.Owner)) @@ -214,7 +214,8 @@ public sealed partial class GunSystem : SharedGunSystem { FireEffects(fromCoordinates, hitscan.MaxLength, mapDirection.ToAngle(), hitscan); } - PlaySound(gun.Owner, gun.SoundGunshot?.GetSound(Random, ProtoManager), user); + + Audio.PlayPredicted(gun.SoundGunshot, gun.Owner, user); break; default: throw new ArgumentOutOfRangeException(); @@ -231,7 +232,7 @@ public sealed partial class GunSystem : SharedGunSystem { var physics = EnsureComp(uid); physics.BodyStatus = BodyStatus.InAir; - physics.LinearVelocity = direction.Normalized * speed; + Physics.SetLinearVelocity(physics, direction.Normalized * speed); if (user != null) { @@ -276,13 +277,6 @@ public sealed partial class GunSystem : SharedGunSystem return angle; } - protected override void PlaySound(EntityUid gun, string? sound, EntityUid? user = null) - { - if (string.IsNullOrEmpty(sound)) return; - - SoundSystem.Play(sound, Filter.Pvs(gun, entityManager: EntityManager).RemoveWhereAttachedEntity(e => e == user), gun); - } - protected override void Popup(string message, EntityUid? uid, EntityUid? user) {} protected override void CreateEffect(EntityUid uid, MuzzleFlashEvent message, EntityUid? user = null) diff --git a/Content.Server/Wires/WiresSystem.cs b/Content.Server/Wires/WiresSystem.cs index 98bf10702d..769e256992 100644 --- a/Content.Server/Wires/WiresSystem.cs +++ b/Content.Server/Wires/WiresSystem.cs @@ -23,11 +23,13 @@ namespace Content.Server.Wires; public sealed class WiresSystem : EntitySystem { [Dependency] private readonly IPrototypeManager _protoMan = default!; - [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; + [Dependency] private readonly AppearanceSystem _appearance = default!; + [Dependency] private readonly DoAfterSystem _doAfter = default!; [Dependency] private readonly ToolSystem _toolSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; - [Dependency] private readonly DoAfterSystem _doAfter = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; private IRobustRandom _random = new RobustRandom(); @@ -476,12 +478,13 @@ public sealed class WiresSystem : EntitySystem if (component.IsPanelOpen) { - SoundSystem.Play(component.ScrewdriverOpenSound.GetSound(), Filter.Pvs(args.Target), args.Target); + _audio.PlayPvs(component.ScrewdriverOpenSound, args.Target); } else { - SoundSystem.Play(component.ScrewdriverCloseSound.GetSound(), Filter.Pvs(args.Target), args.Target); - _uiSystem.GetUiOrNull(args.Target, WiresUiKey.Key)?.CloseAll(); + _audio.PlayPvs(component.ScrewdriverCloseSound, args.Target); + var ui = _uiSystem.GetUiOrNull(args.Target, WiresUiKey.Key); + _uiSystem.CloseAll(ui); } } @@ -548,7 +551,7 @@ public sealed class WiresSystem : EntitySystem if (!Resolve(uid, ref appearance, ref wires, false)) return; - appearance.SetData(WiresVisuals.MaintenancePanelState, wires.IsPanelOpen && wires.IsPanelVisible); + _appearance.SetData(uid, WiresVisuals.MaintenancePanelState, wires.IsPanelOpen && wires.IsPanelVisible, appearance); } private void UpdateUserInterface(EntityUid uid, WiresComponent? wires = null, ServerUserInterfaceComponent? ui = null) @@ -578,18 +581,18 @@ public sealed class WiresSystem : EntitySystem statuses.Sort((a, b) => a.position.CompareTo(b.position)); - _uiSystem.GetUiOrNull(uid, WiresUiKey.Key)?.SetState( - new WiresBoundUserInterfaceState( - clientList.ToArray(), - statuses.Select(p => new StatusEntry(p.key, p.value)).ToArray(), - wires.BoardName, - wires.SerialNumber, - wires.WireSeed)); + _uiSystem.TrySetUiState(uid, WiresUiKey.Key, new WiresBoundUserInterfaceState( + clientList.ToArray(), + statuses.Select(p => new StatusEntry(p.key, p.value)).ToArray(), + wires.BoardName, + wires.SerialNumber, + wires.WireSeed), ui: ui); } public void OpenUserInterface(EntityUid uid, IPlayerSession player) { - _uiSystem.GetUiOrNull(uid, WiresUiKey.Key)?.Open(player); + if (_uiSystem.TryGetUi(uid, WiresUiKey.Key, out var ui)) + _uiSystem.OpenUi(ui, player); } /// @@ -800,7 +803,7 @@ public sealed class WiresSystem : EntitySystem wire.Action.Pulse(user, wire); UpdateUserInterface(used); - SoundSystem.Play(wires.PulseSound.GetSound(), Filter.Pvs(used), used); + _audio.PlayPvs(wires.PulseSound, used); break; } diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index e6e3a0cecb..f24c1716e8 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -316,8 +316,6 @@ public abstract partial class SharedGunSystem : EntitySystem Shoot(gun, new List(1) { ammo }, fromCoordinates, toCoordinates, user); } - protected abstract void PlaySound(EntityUid gun, string? sound, EntityUid? user = null); - protected abstract void Popup(string message, EntityUid? uid, EntityUid? user); ///