diff --git a/Content.Client/GameObjects/Components/ActionBlocking/CuffableComponent.cs b/Content.Client/GameObjects/Components/ActionBlocking/CuffableComponent.cs index cf84ca56ea..a257e59b93 100644 --- a/Content.Client/GameObjects/Components/ActionBlocking/CuffableComponent.cs +++ b/Content.Client/GameObjects/Components/ActionBlocking/CuffableComponent.cs @@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components.ActionBlocking public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { - if (!(curState is CuffableComponentState cuffState)) + if (curState is not CuffableComponentState cuffState) { return; } diff --git a/Content.Client/GameObjects/Components/ActionBlocking/HandcuffComponent.cs b/Content.Client/GameObjects/Components/ActionBlocking/HandcuffComponent.cs index 53c5dc2baa..adc7488425 100644 --- a/Content.Client/GameObjects/Components/ActionBlocking/HandcuffComponent.cs +++ b/Content.Client/GameObjects/Components/ActionBlocking/HandcuffComponent.cs @@ -10,16 +10,19 @@ namespace Content.Client.GameObjects.Components.ActionBlocking { public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - var cuffState = curState as HandcuffedComponentState; + if (curState is not HandcuffedComponentState state) + { + return; + } - if (cuffState == null || cuffState.IconState == string.Empty) + if (state.IconState == string.Empty) { return; } if (Owner.TryGetComponent(out var sprite)) { - sprite.LayerSetState(0, new RSI.StateId(cuffState.IconState)); // TODO: safety check to see if RSI contains the state? + sprite.LayerSetState(0, new RSI.StateId(state.IconState)); // TODO: safety check to see if RSI contains the state? } } } diff --git a/Content.Client/GameObjects/Components/Atmos/GasAnalyzerComponent.cs b/Content.Client/GameObjects/Components/Atmos/GasAnalyzerComponent.cs index 705d3583c9..12c4e15082 100644 --- a/Content.Client/GameObjects/Components/Atmos/GasAnalyzerComponent.cs +++ b/Content.Client/GameObjects/Components/Atmos/GasAnalyzerComponent.cs @@ -24,7 +24,7 @@ namespace Content.Client.GameObjects.Components.Atmos public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is GasAnalyzerComponentState state)) + if (curState is not GasAnalyzerComponentState state) return; Danger = state.Danger; diff --git a/Content.Client/GameObjects/Components/Body/Scanner/BodyScannerBoundUserInterface.cs b/Content.Client/GameObjects/Components/Body/Scanner/BodyScannerBoundUserInterface.cs index bee5094d28..3945e6c9a6 100644 --- a/Content.Client/GameObjects/Components/Body/Scanner/BodyScannerBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Body/Scanner/BodyScannerBoundUserInterface.cs @@ -31,7 +31,7 @@ namespace Content.Client.GameObjects.Components.Body.Scanner { base.UpdateState(state); - if (!(state is BodyScannerUIState scannerState)) + if (state is not BodyScannerUIState scannerState) { return; } diff --git a/Content.Client/GameObjects/Components/Buckle/BuckleComponent.cs b/Content.Client/GameObjects/Components/Buckle/BuckleComponent.cs index 3ee1b85144..491be6c91d 100644 --- a/Content.Client/GameObjects/Components/Buckle/BuckleComponent.cs +++ b/Content.Client/GameObjects/Components/Buckle/BuckleComponent.cs @@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components.Buckle public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is BuckleComponentState buckle)) + if (curState is not BuckleComponentState buckle) { return; } diff --git a/Content.Client/GameObjects/Components/Cargo/CargoConsoleBoundUserInterface.cs b/Content.Client/GameObjects/Components/Cargo/CargoConsoleBoundUserInterface.cs index 16538f7da0..280b278b27 100644 --- a/Content.Client/GameObjects/Components/Cargo/CargoConsoleBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Cargo/CargoConsoleBoundUserInterface.cs @@ -63,7 +63,7 @@ namespace Content.Client.GameObjects.Components.Cargo }; _menu.OnItemSelected += (args) => { - if (!(args.Button.Parent is CargoProductRow row)) + if (args.Button.Parent is not CargoProductRow row) return; _product = row.Product; _orderMenu.Requester.Text = null; @@ -87,7 +87,7 @@ namespace Content.Client.GameObjects.Components.Cargo { base.UpdateState(state); - if (!(state is CargoConsoleInterfaceState cState)) + if (state is not CargoConsoleInterfaceState cState) return; if (RequestOnly != cState.RequestOnly) { @@ -121,14 +121,14 @@ namespace Content.Client.GameObjects.Components.Cargo internal void RemoveOrder(BaseButton.ButtonEventArgs args) { - if (!(args.Button.Parent.Parent is CargoOrderRow row)) + if (args.Button.Parent.Parent is not CargoOrderRow row) return; SendMessage(new SharedCargoConsoleComponent.CargoConsoleRemoveOrderMessage(row.Order.OrderNumber)); } internal void ApproveOrder(BaseButton.ButtonEventArgs args) { - if (!(args.Button.Parent.Parent is CargoOrderRow row)) + if (args.Button.Parent.Parent is not CargoOrderRow row) return; if (ShuttleCapacity.CurrentCapacity == ShuttleCapacity.MaxCapacity) return; diff --git a/Content.Client/GameObjects/Components/Cargo/CargoOrderDatabaseComponent.cs b/Content.Client/GameObjects/Components/Cargo/CargoOrderDatabaseComponent.cs index baad228915..a2feb6bb75 100644 --- a/Content.Client/GameObjects/Components/Cargo/CargoOrderDatabaseComponent.cs +++ b/Content.Client/GameObjects/Components/Cargo/CargoOrderDatabaseComponent.cs @@ -40,7 +40,7 @@ namespace Content.Client.GameObjects.Components.Cargo public override void HandleComponentState(ComponentState curState, ComponentState nextState) { base.HandleComponentState(curState, nextState); - if (!(curState is CargoOrderDatabaseState state)) + if (curState is not CargoOrderDatabaseState state) return; Clear(); if (state.Orders == null) diff --git a/Content.Client/GameObjects/Components/Cargo/GalacticMarketComponent.cs b/Content.Client/GameObjects/Components/Cargo/GalacticMarketComponent.cs index 786c0c3d6e..fde85e0c68 100644 --- a/Content.Client/GameObjects/Components/Cargo/GalacticMarketComponent.cs +++ b/Content.Client/GameObjects/Components/Cargo/GalacticMarketComponent.cs @@ -20,7 +20,7 @@ namespace Content.Client.GameObjects.Components.Cargo public override void HandleComponentState(ComponentState curState, ComponentState nextState) { base.HandleComponentState(curState, nextState); - if (!(curState is GalacticMarketState state)) + if (curState is not GalacticMarketState state) return; _products.Clear(); foreach (var productId in state.Products) diff --git a/Content.Client/GameObjects/Components/Chemistry/InjectorComponent.cs b/Content.Client/GameObjects/Components/Chemistry/InjectorComponent.cs index fe1e71bbe5..3a35e7f266 100644 --- a/Content.Client/GameObjects/Components/Chemistry/InjectorComponent.cs +++ b/Content.Client/GameObjects/Components/Chemistry/InjectorComponent.cs @@ -29,14 +29,15 @@ namespace Content.Client.GameObjects.Components.Chemistry //Handle net updates public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - var cast = (InjectorComponentState) curState; - if (cast != null) + if (curState is not InjectorComponentState state) { - CurrentVolume = cast.CurrentVolume; - TotalVolume = cast.TotalVolume; - CurrentMode = cast.CurrentMode; - _uiUpdateNeeded = true; + return; } + + CurrentVolume = state.CurrentVolume; + TotalVolume = state.TotalVolume; + CurrentMode = state.CurrentMode; + _uiUpdateNeeded = true; } /// diff --git a/Content.Client/GameObjects/Components/Clothing/ClothingComponent.cs b/Content.Client/GameObjects/Components/Clothing/ClothingComponent.cs index 37fa84f161..2441c9c589 100644 --- a/Content.Client/GameObjects/Components/Clothing/ClothingComponent.cs +++ b/Content.Client/GameObjects/Components/Clothing/ClothingComponent.cs @@ -81,12 +81,13 @@ namespace Content.Client.GameObjects.Components.Clothing public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { - if (curState == null) + if (curState is not ClothingComponentState state) + { return; + } - var clothingComponentState = (ClothingComponentState)curState; - ClothingEquippedPrefix = clothingComponentState.ClothingEquippedPrefix; - EquippedPrefix = clothingComponentState.EquippedPrefix; + ClothingEquippedPrefix = state.ClothingEquippedPrefix; + EquippedPrefix = state.EquippedPrefix; } } diff --git a/Content.Client/GameObjects/Components/Command/CommunicationsConsoleBoundUserInterface.cs b/Content.Client/GameObjects/Components/Command/CommunicationsConsoleBoundUserInterface.cs index 992d879bf1..0d4f0afc1f 100644 --- a/Content.Client/GameObjects/Components/Command/CommunicationsConsoleBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Command/CommunicationsConsoleBoundUserInterface.cs @@ -56,7 +56,9 @@ namespace Content.Client.GameObjects.Components.Command protected override void UpdateState(BoundUserInterfaceState state) { - if (!(state is CommunicationsConsoleInterfaceState commsState)) + base.UpdateState(state); + + if (state is not CommunicationsConsoleInterfaceState commsState) return; _expectedCountdownTime = commsState.ExpectedCountdownEnd; diff --git a/Content.Client/GameObjects/Components/Crayon/CrayonComponent.cs b/Content.Client/GameObjects/Components/Crayon/CrayonComponent.cs index b093192ef7..0b7b7e7ece 100644 --- a/Content.Client/GameObjects/Components/Crayon/CrayonComponent.cs +++ b/Content.Client/GameObjects/Components/Crayon/CrayonComponent.cs @@ -25,7 +25,7 @@ namespace Content.Client.GameObjects.Components.Crayon public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is CrayonComponentState state)) + if (curState is not CrayonComponentState state) return; _color = state.Color; diff --git a/Content.Client/GameObjects/Components/Disposal/DisposalMailingUnitBoundUserInterface.cs b/Content.Client/GameObjects/Components/Disposal/DisposalMailingUnitBoundUserInterface.cs index 164ba9f6f5..398e523d29 100644 --- a/Content.Client/GameObjects/Components/Disposal/DisposalMailingUnitBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Disposal/DisposalMailingUnitBoundUserInterface.cs @@ -45,7 +45,7 @@ namespace Content.Client.GameObjects.Components.Disposal { base.UpdateState(state); - if (!(state is DisposalMailingUnitBoundUserInterfaceState cast)) + if (state is not DisposalMailingUnitBoundUserInterfaceState cast) { return; } diff --git a/Content.Client/GameObjects/Components/Disposal/DisposalRouterBoundUserInterface.cs b/Content.Client/GameObjects/Components/Disposal/DisposalRouterBoundUserInterface.cs index dd359ccf85..6e462bb0a6 100644 --- a/Content.Client/GameObjects/Components/Disposal/DisposalRouterBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Disposal/DisposalRouterBoundUserInterface.cs @@ -42,7 +42,7 @@ namespace Content.Client.GameObjects.Components.Disposal { base.UpdateState(state); - if (!(state is DisposalRouterUserInterfaceState cast)) + if (state is not DisposalRouterUserInterfaceState cast) { return; } diff --git a/Content.Client/GameObjects/Components/Disposal/DisposalTaggerBoundUserInterface.cs b/Content.Client/GameObjects/Components/Disposal/DisposalTaggerBoundUserInterface.cs index 54baa4339d..b2aec5b8a5 100644 --- a/Content.Client/GameObjects/Components/Disposal/DisposalTaggerBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Disposal/DisposalTaggerBoundUserInterface.cs @@ -42,7 +42,7 @@ namespace Content.Client.GameObjects.Components.Disposal { base.UpdateState(state); - if (!(state is DisposalTaggerUserInterfaceState cast)) + if (state is not DisposalTaggerUserInterfaceState cast) { return; } diff --git a/Content.Client/GameObjects/Components/Disposal/DisposalUnitBoundUserInterface.cs b/Content.Client/GameObjects/Components/Disposal/DisposalUnitBoundUserInterface.cs index b2e9ab7fb9..9f47302503 100644 --- a/Content.Client/GameObjects/Components/Disposal/DisposalUnitBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Disposal/DisposalUnitBoundUserInterface.cs @@ -41,7 +41,7 @@ namespace Content.Client.GameObjects.Components.Disposal { base.UpdateState(state); - if (!(state is DisposalUnitBoundUserInterfaceState cast)) + if (state is not DisposalUnitBoundUserInterfaceState cast) { return; } diff --git a/Content.Client/GameObjects/Components/DoAfterComponent.cs b/Content.Client/GameObjects/Components/DoAfterComponent.cs index 0e5940dccd..7974b30514 100644 --- a/Content.Client/GameObjects/Components/DoAfterComponent.cs +++ b/Content.Client/GameObjects/Components/DoAfterComponent.cs @@ -18,8 +18,8 @@ namespace Content.Client.GameObjects.Components public IReadOnlyDictionary DoAfters => _doAfters; private readonly Dictionary _doAfters = new Dictionary(); - - public readonly List<(TimeSpan CancelTime, ClientDoAfter Message)> CancelledDoAfters = + + public readonly List<(TimeSpan CancelTime, ClientDoAfter Message)> CancelledDoAfters = new List<(TimeSpan CancelTime, ClientDoAfter Message)>(); public DoAfterGui? Gui { get; set; } @@ -54,9 +54,9 @@ namespace Content.Client.GameObjects.Components { if (Gui != null && !Gui.Disposed) return; - + Gui = new DoAfterGui {AttachedEntity = Owner}; - + foreach (var (_, doAfter) in _doAfters) { Gui.AddDoAfter(doAfter); @@ -76,15 +76,16 @@ namespace Content.Client.GameObjects.Components public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { base.HandleComponentState(curState, nextState); - if (!(curState is DoAfterComponentState state)) + + if (curState is not DoAfterComponentState state) return; var toRemove = new List(); - + foreach (var (id, doAfter) in _doAfters) { var found = false; - + foreach (var clientdoAfter in state.DoAfters) { if (clientdoAfter.ID == id) @@ -109,10 +110,10 @@ namespace Content.Client.GameObjects.Components { if (_doAfters.ContainsKey(doAfter.ID)) continue; - + _doAfters.Add(doAfter.ID, doAfter); } - + if (Gui == null || Gui.Disposed) return; @@ -132,7 +133,7 @@ namespace Content.Client.GameObjects.Components _doAfters.Remove(clientDoAfter.ID); var found = false; - + for (var i = CancelledDoAfters.Count - 1; i >= 0; i--) { var cancelled = CancelledDoAfters[i]; @@ -167,11 +168,11 @@ namespace Content.Client.GameObjects.Components if (!_doAfters.ContainsKey(id)) return; - + var doAfterMessage = _doAfters[id]; currentTime ??= IoCManager.Resolve().CurTime; CancelledDoAfters.Add((currentTime.Value, doAfterMessage)); Gui?.CancelDoAfter(id); } } -} \ No newline at end of file +} diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs index a543b709f2..c458407ca5 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs @@ -74,14 +74,12 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory { base.HandleComponentState(curState, nextState); - if (curState == null) + if (curState is not InventoryComponentState state) return; - var cast = (InventoryComponentState) curState; - var doneSlots = new HashSet(); - foreach (var (slot, entityUid) in cast.Entities) + foreach (var (slot, entityUid) in state.Entities) { if (!Owner.EntityManager.TryGetEntity(entityUid, out var entity)) { @@ -95,9 +93,9 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory doneSlots.Add(slot); } - if (cast.HoverEntity != null) + if (state.HoverEntity != null) { - var (slot, (entityUid, fits)) = cast.HoverEntity.Value; + var (slot, (entityUid, fits)) = state.HoverEntity.Value; var entity = Owner.EntityManager.GetEntity(entityUid); InterfaceController?.HoverInSlot(slot, entity, fits); diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/StrippableBoundUserInterface.cs b/Content.Client/GameObjects/Components/HUD/Inventory/StrippableBoundUserInterface.cs index cb2ed47c21..e71f50336f 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/StrippableBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/StrippableBoundUserInterface.cs @@ -90,7 +90,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory { base.UpdateState(state); - if (!(state is StrippingBoundUserInterfaceState stripState)) return; + if (state is not StrippingBoundUserInterfaceState stripState) return; Inventory = stripState.Inventory; Hands = stripState.Hands; diff --git a/Content.Client/GameObjects/Components/HandheldLightComponent.cs b/Content.Client/GameObjects/Components/HandheldLightComponent.cs index 30c4edd40a..586ffd959a 100644 --- a/Content.Client/GameObjects/Components/HandheldLightComponent.cs +++ b/Content.Client/GameObjects/Components/HandheldLightComponent.cs @@ -25,7 +25,9 @@ namespace Content.Client.GameObjects.Components public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is HandheldLightComponentState cast)) + base.HandleComponentState(curState, nextState); + + if (curState is not HandheldLightComponentState cast) return; _level = cast.Charge; diff --git a/Content.Client/GameObjects/Components/Instruments/InstrumentComponent.cs b/Content.Client/GameObjects/Components/Instruments/InstrumentComponent.cs index d30bcf6da9..e13903f0da 100644 --- a/Content.Client/GameObjects/Components/Instruments/InstrumentComponent.cs +++ b/Content.Client/GameObjects/Components/Instruments/InstrumentComponent.cs @@ -306,7 +306,7 @@ namespace Content.Client.GameObjects.Components.Instruments public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { base.HandleComponentState(curState, nextState); - if (!(curState is InstrumentState state)) return; + if (curState is not InstrumentState state) return; if (state.Playing) { diff --git a/Content.Client/GameObjects/Components/Interactable/MultiToolComponent.cs b/Content.Client/GameObjects/Components/Interactable/MultiToolComponent.cs index 70de623621..c1f077323d 100644 --- a/Content.Client/GameObjects/Components/Interactable/MultiToolComponent.cs +++ b/Content.Client/GameObjects/Components/Interactable/MultiToolComponent.cs @@ -32,7 +32,9 @@ namespace Content.Client.GameObjects.Components.Interactable public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is MultiToolComponentState tool)) return; + base.HandleComponentState(curState, nextState); + + if (curState is not MultiToolComponentState tool) return; _behavior = tool.Quality; _uiUpdateNeeded = true; diff --git a/Content.Client/GameObjects/Components/Interactable/WelderComponent.cs b/Content.Client/GameObjects/Components/Interactable/WelderComponent.cs index 5852469bc6..823f75dbdb 100644 --- a/Content.Client/GameObjects/Components/Interactable/WelderComponent.cs +++ b/Content.Client/GameObjects/Components/Interactable/WelderComponent.cs @@ -32,7 +32,9 @@ namespace Content.Client.GameObjects.Components.Interactable public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is WelderComponentState weld)) + base.HandleComponentState(curState, nextState); + + if (curState is not WelderComponentState weld) return; FuelCapacity = weld.FuelCapacity; diff --git a/Content.Client/GameObjects/Components/Kitchen/MicrowaveBoundUserInterface.cs b/Content.Client/GameObjects/Components/Kitchen/MicrowaveBoundUserInterface.cs index 802a410699..66e0636e38 100644 --- a/Content.Client/GameObjects/Components/Kitchen/MicrowaveBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Kitchen/MicrowaveBoundUserInterface.cs @@ -78,7 +78,7 @@ namespace Content.Client.GameObjects.Components.Kitchen protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); - if (!(state is MicrowaveUpdateUserInterfaceState cState)) + if (state is not MicrowaveUpdateUserInterfaceState cState) { return; } diff --git a/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs b/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs index 15bce99a2a..1270cb79a3 100644 --- a/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs +++ b/Content.Client/GameObjects/Components/Mobs/ClientAlertsComponent.cs @@ -78,7 +78,7 @@ namespace Content.Client.GameObjects.Components.Mobs { base.HandleComponentState(curState, nextState); - if (!(curState is AlertsComponentState state)) + if (curState is not AlertsComponentState state) { return; } diff --git a/Content.Client/GameObjects/Components/Mobs/State/MobStateManagerComponent.cs b/Content.Client/GameObjects/Components/Mobs/State/MobStateManagerComponent.cs index 207c8f17c2..4ea8d1e661 100644 --- a/Content.Client/GameObjects/Components/Mobs/State/MobStateManagerComponent.cs +++ b/Content.Client/GameObjects/Components/Mobs/State/MobStateManagerComponent.cs @@ -48,7 +48,7 @@ namespace Content.Client.GameObjects.Components.Mobs.State { base.HandleComponentState(curState, nextState); - if (!(curState is MobStateManagerComponentState state)) + if (curState is not MobStateManagerComponentState state) { return; } diff --git a/Content.Client/GameObjects/Components/Mobs/StunnableComponent.cs b/Content.Client/GameObjects/Components/Mobs/StunnableComponent.cs index 9d6ce08f8f..8fa3e2949d 100644 --- a/Content.Client/GameObjects/Components/Mobs/StunnableComponent.cs +++ b/Content.Client/GameObjects/Components/Mobs/StunnableComponent.cs @@ -22,7 +22,7 @@ namespace Content.Client.GameObjects.Components.Mobs { base.HandleComponentState(curState, nextState); - if (!(curState is StunnableComponentState state)) + if (curState is not StunnableComponentState state) { return; } diff --git a/Content.Client/GameObjects/Components/Movement/ClimbingComponent.cs b/Content.Client/GameObjects/Components/Movement/ClimbingComponent.cs index b624ad9a75..7db57f929e 100644 --- a/Content.Client/GameObjects/Components/Movement/ClimbingComponent.cs +++ b/Content.Client/GameObjects/Components/Movement/ClimbingComponent.cs @@ -8,7 +8,9 @@ namespace Content.Client.GameObjects.Components.Movement { public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is ClimbModeComponentState climbModeState) || Body == null) + base.HandleComponentState(curState, nextState); + + if (curState is not ClimbModeComponentState climbModeState || Body == null) { return; } diff --git a/Content.Client/GameObjects/Components/Movement/SlipperyComponent.cs b/Content.Client/GameObjects/Components/Movement/SlipperyComponent.cs index 596d06c7de..fb1048fd17 100644 --- a/Content.Client/GameObjects/Components/Movement/SlipperyComponent.cs +++ b/Content.Client/GameObjects/Components/Movement/SlipperyComponent.cs @@ -10,7 +10,9 @@ namespace Content.Client.GameObjects.Components.Movement { public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { - if (!(curState is SlipperyComponentState state)) return; + base.HandleComponentState(curState, nextState); + + if (curState is not SlipperyComponentState state) return; Slippery = state.Slippery; IntersectPercentage = state.IntersectPercentage; diff --git a/Content.Client/GameObjects/Components/Nutrition/HungerComponent.cs b/Content.Client/GameObjects/Components/Nutrition/HungerComponent.cs index 6db62b1bb3..e96bc5cf6c 100644 --- a/Content.Client/GameObjects/Components/Nutrition/HungerComponent.cs +++ b/Content.Client/GameObjects/Components/Nutrition/HungerComponent.cs @@ -13,7 +13,9 @@ namespace Content.Client.GameObjects.Components.Nutrition public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { - if (!(curState is HungerComponentState hunger)) + base.HandleComponentState(curState, nextState); + + if (curState is not HungerComponentState hunger) { return; } diff --git a/Content.Client/GameObjects/Components/Nutrition/ThirstComponent.cs b/Content.Client/GameObjects/Components/Nutrition/ThirstComponent.cs index a211afe239..01223f7c9a 100644 --- a/Content.Client/GameObjects/Components/Nutrition/ThirstComponent.cs +++ b/Content.Client/GameObjects/Components/Nutrition/ThirstComponent.cs @@ -13,7 +13,9 @@ namespace Content.Client.GameObjects.Components.Nutrition public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { - if (!(curState is ThirstComponentState thirst)) + base.HandleComponentState(curState, nextState); + + if (curState is not ThirstComponentState thirst) { return; } diff --git a/Content.Client/GameObjects/Components/Observer/GhostComponent.cs b/Content.Client/GameObjects/Components/Observer/GhostComponent.cs index ba79966eab..5c9d6c7ade 100644 --- a/Content.Client/GameObjects/Components/Observer/GhostComponent.cs +++ b/Content.Client/GameObjects/Components/Observer/GhostComponent.cs @@ -106,7 +106,7 @@ namespace Content.Client.GameObjects.Components.Observer { base.HandleComponentState(curState, nextState); - if (!(curState is GhostComponentState state)) return; + if (curState is not GhostComponentState state) return; CanReturnToBody = state.CanReturnToBody; diff --git a/Content.Client/GameObjects/Components/PlaceableSurfaceComponent.cs b/Content.Client/GameObjects/Components/PlaceableSurfaceComponent.cs index e5a27e117c..090c187e2a 100644 --- a/Content.Client/GameObjects/Components/PlaceableSurfaceComponent.cs +++ b/Content.Client/GameObjects/Components/PlaceableSurfaceComponent.cs @@ -30,7 +30,7 @@ namespace Content.Client.GameObjects.Components { base.HandleComponentState(curState, nextState); - if (!(curState is PlaceableSurfaceComponentState state)) + if (curState is not PlaceableSurfaceComponentState state) { return; } diff --git a/Content.Client/GameObjects/Components/Research/LatheDatabaseComponent.cs b/Content.Client/GameObjects/Components/Research/LatheDatabaseComponent.cs index 67163e0e18..efb1d1d15e 100644 --- a/Content.Client/GameObjects/Components/Research/LatheDatabaseComponent.cs +++ b/Content.Client/GameObjects/Components/Research/LatheDatabaseComponent.cs @@ -15,7 +15,7 @@ namespace Content.Client.GameObjects.Components.Research public override void HandleComponentState(ComponentState curState, ComponentState nextState) { base.HandleComponentState(curState, nextState); - if (!(curState is LatheDatabaseState state)) return; + if (curState is not LatheDatabaseState state) return; Clear(); foreach (var ID in state.Recipes) { diff --git a/Content.Client/GameObjects/Components/Research/MaterialStorageComponent.cs b/Content.Client/GameObjects/Components/Research/MaterialStorageComponent.cs index 62dfd8c18d..742abc8fd4 100644 --- a/Content.Client/GameObjects/Components/Research/MaterialStorageComponent.cs +++ b/Content.Client/GameObjects/Components/Research/MaterialStorageComponent.cs @@ -16,7 +16,7 @@ namespace Content.Client.GameObjects.Components.Research public override void HandleComponentState(ComponentState curState, ComponentState nextState) { base.HandleComponentState(curState, nextState); - if (!(curState is MaterialStorageState state)) return; + if (curState is not MaterialStorageState state) return; Storage = state.Storage; OnMaterialStorageChanged?.Invoke(); } diff --git a/Content.Client/GameObjects/Components/Research/ProtolatheDatabaseComponent.cs b/Content.Client/GameObjects/Components/Research/ProtolatheDatabaseComponent.cs index 42cf4bc90e..dad88197b1 100644 --- a/Content.Client/GameObjects/Components/Research/ProtolatheDatabaseComponent.cs +++ b/Content.Client/GameObjects/Components/Research/ProtolatheDatabaseComponent.cs @@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components.Research public override void HandleComponentState(ComponentState curState, ComponentState nextState) { base.HandleComponentState(curState, nextState); - if (!(curState is ProtolatheDatabaseState state)) return; + if (curState is not ProtolatheDatabaseState state) return; Clear(); foreach (var ID in state.Recipes) { diff --git a/Content.Client/GameObjects/Components/Research/ResearchClientBoundUserInterface.cs b/Content.Client/GameObjects/Components/Research/ResearchClientBoundUserInterface.cs index 116eb21e06..cde830251b 100644 --- a/Content.Client/GameObjects/Components/Research/ResearchClientBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Research/ResearchClientBoundUserInterface.cs @@ -37,7 +37,7 @@ namespace Content.Client.GameObjects.Components.Research protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); - if (!(state is SharedResearchClientComponent.ResearchClientBoundInterfaceState rState)) return; + if (state is not SharedResearchClientComponent.ResearchClientBoundInterfaceState rState) return; _menu.Populate(rState.ServerCount, rState.ServerNames, rState.ServerIds, rState.SelectedServerId); } diff --git a/Content.Client/GameObjects/Components/Research/TechnologyDatabaseComponent.cs b/Content.Client/GameObjects/Components/Research/TechnologyDatabaseComponent.cs index 691b7edbfd..fe4a8ac633 100644 --- a/Content.Client/GameObjects/Components/Research/TechnologyDatabaseComponent.cs +++ b/Content.Client/GameObjects/Components/Research/TechnologyDatabaseComponent.cs @@ -18,7 +18,7 @@ namespace Content.Client.GameObjects.Components.Research public override void HandleComponentState(ComponentState curState, ComponentState nextState) { base.HandleComponentState(curState, nextState); - if (!(curState is TechnologyDatabaseState state)) return; + if (curState is not TechnologyDatabaseState state) return; _technologies.Clear(); var protoManager = IoCManager.Resolve(); foreach (var techID in state.Technologies) diff --git a/Content.Client/GameObjects/Components/StationEvents/RadiationPulseComponent.cs b/Content.Client/GameObjects/Components/StationEvents/RadiationPulseComponent.cs index 98dcd7a6ff..b56e1075ea 100644 --- a/Content.Client/GameObjects/Components/StationEvents/RadiationPulseComponent.cs +++ b/Content.Client/GameObjects/Components/StationEvents/RadiationPulseComponent.cs @@ -25,7 +25,7 @@ namespace Content.Client.GameObjects.Components.StationEvents { base.HandleComponentState(curState, nextState); - if (!(curState is RadiationPulseState state)) + if (curState is not RadiationPulseState state) { return; } diff --git a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs index 94d8e1e8d4..c018e2448b 100644 --- a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs +++ b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs @@ -50,7 +50,7 @@ namespace Content.Client.GameObjects.Components.Storage { base.HandleComponentState(curState, nextState); - if (!(curState is StorageComponentState state)) + if (curState is not StorageComponentState state) { return; } diff --git a/Content.Client/GameObjects/Components/Storage/StorableComponent.cs b/Content.Client/GameObjects/Components/Storage/StorableComponent.cs index ab6e4d1b1f..d5aa2ffb07 100644 --- a/Content.Client/GameObjects/Components/Storage/StorableComponent.cs +++ b/Content.Client/GameObjects/Components/Storage/StorableComponent.cs @@ -30,7 +30,7 @@ namespace Content.Client.GameObjects.Components.Storage { base.HandleComponentState(curState, nextState); - if (!(curState is StorableComponentState state)) + if (curState is not StorableComponentState state) { return; } diff --git a/Content.Client/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs b/Content.Client/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs index 99e0153e3e..959ad934ad 100644 --- a/Content.Client/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs +++ b/Content.Client/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs @@ -119,7 +119,7 @@ namespace Content.Client.GameObjects.Components.Suspicion { base.HandleComponentState(curState, nextState); - if (!(curState is SuspicionRoleComponentState state)) + if (curState is not SuspicionRoleComponentState state) { return; } diff --git a/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientBatteryBarrelComponent.cs b/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientBatteryBarrelComponent.cs index e10246eb4f..4082f3496d 100644 --- a/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientBatteryBarrelComponent.cs +++ b/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientBatteryBarrelComponent.cs @@ -30,7 +30,9 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is BatteryBarrelComponentState cast)) + base.HandleComponentState(curState, nextState); + + if (curState is not BatteryBarrelComponentState cast) return; MagazineCount = cast.Magazine; diff --git a/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientBoltActionBarrelComponent.cs b/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientBoltActionBarrelComponent.cs index 1f3fab4e44..087a12a944 100644 --- a/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientBoltActionBarrelComponent.cs +++ b/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientBoltActionBarrelComponent.cs @@ -38,7 +38,9 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is BoltActionBarrelComponentState cast)) + base.HandleComponentState(curState, nextState); + + if (curState is not BoltActionBarrelComponentState cast) return; Chamber = cast.Chamber; diff --git a/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientMagazineBarrelComponent.cs b/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientMagazineBarrelComponent.cs index f02d184cad..be869e8b49 100644 --- a/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientMagazineBarrelComponent.cs +++ b/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientMagazineBarrelComponent.cs @@ -99,7 +99,9 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is MagazineBarrelComponentState cast)) + base.HandleComponentState(curState, nextState); + + if (curState is not MagazineBarrelComponentState cast) return; Chambered = cast.Chambered; @@ -113,7 +115,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels switch (message) { - + case MagazineAutoEjectMessage _: _statusControl?.PlayAlarmAnimation(); return; diff --git a/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientPumpBarrelComponent.cs b/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientPumpBarrelComponent.cs index 7a0e15e432..2a7b286fcd 100644 --- a/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientPumpBarrelComponent.cs +++ b/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientPumpBarrelComponent.cs @@ -38,7 +38,9 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is PumpBarrelComponentState cast)) + base.HandleComponentState(curState, nextState); + + if (curState is not PumpBarrelComponentState cast) return; Chamber = cast.Chamber; diff --git a/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientRevolverBarrelComponent.cs b/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientRevolverBarrelComponent.cs index a9c3c35759..624ee64d25 100644 --- a/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientRevolverBarrelComponent.cs +++ b/Content.Client/GameObjects/Components/Weapons/Ranged/Barrels/ClientRevolverBarrelComponent.cs @@ -32,7 +32,9 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is RevolverBarrelComponentState cast)) + base.HandleComponentState(curState, nextState); + + if (curState is not RevolverBarrelComponentState cast) return; CurrentSlot = cast.CurrentSlot; diff --git a/Content.Client/GameObjects/Components/Weapons/Ranged/ClientRangedWeaponComponent.cs b/Content.Client/GameObjects/Components/Weapons/Ranged/ClientRangedWeaponComponent.cs index 9bb8bc1050..d52c35c00b 100644 --- a/Content.Client/GameObjects/Components/Weapons/Ranged/ClientRangedWeaponComponent.cs +++ b/Content.Client/GameObjects/Components/Weapons/Ranged/ClientRangedWeaponComponent.cs @@ -14,7 +14,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged Mag, MagUnshaded, } - + [RegisterComponent] public sealed class ClientRangedWeaponComponent : SharedRangedWeaponComponent { @@ -23,7 +23,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged public override void HandleComponentState(ComponentState curState, ComponentState nextState) { base.HandleComponentState(curState, nextState); - if (!(curState is RangedWeaponComponentState rangedState)) + if (curState is not RangedWeaponComponentState rangedState) { return; } diff --git a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs index a2681507f4..cc7de7651b 100644 --- a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs @@ -142,7 +142,7 @@ namespace Content.Client.GameObjects.EntitySystems return true; } - if (!(_stateManager.CurrentState is GameScreenBase gameScreen)) + if (_stateManager.CurrentState is not GameScreenBase) { return false; } diff --git a/Content.Client/UserInterface/LobbyCharacterPreviewPanel.cs b/Content.Client/UserInterface/LobbyCharacterPreviewPanel.cs index de0af99932..9aacc5e859 100644 --- a/Content.Client/UserInterface/LobbyCharacterPreviewPanel.cs +++ b/Content.Client/UserInterface/LobbyCharacterPreviewPanel.cs @@ -111,7 +111,7 @@ namespace Content.Client.UserInterface { _loaded.Visible = true; _unloaded.Visible = false; - if (!(_preferencesManager.Preferences.SelectedCharacter is HumanoidCharacterProfile selectedCharacter)) + if (_preferencesManager.Preferences.SelectedCharacter is not HumanoidCharacterProfile selectedCharacter) { _summaryLabel.Text = string.Empty; } diff --git a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs index f37fe7215e..4bc3f481cc 100644 --- a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs +++ b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs @@ -401,7 +401,7 @@ namespace Content.IntegrationTests.Tests.Networking public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { - if (!(curState is PredictionComponentState pred)) + if (curState is not PredictionComponentState pred) { return; } diff --git a/Content.Server/Database/ServerDbBase.cs b/Content.Server/Database/ServerDbBase.cs index c0978562cc..0ee380040e 100644 --- a/Content.Server/Database/ServerDbBase.cs +++ b/Content.Server/Database/ServerDbBase.cs @@ -56,7 +56,7 @@ namespace Content.Server.Database return; } - if (!(profile is HumanoidCharacterProfile humanoid)) + if (profile is not HumanoidCharacterProfile humanoid) { // TODO: Handle other ICharacterProfile implementations properly throw new NotImplementedException(); @@ -73,7 +73,7 @@ namespace Content.Server.Database .Profiles .SingleOrDefault(h => h.Slot == entity.Slot); - if (!(oldProfile is null)) + if (oldProfile is not null) { prefs.Profiles.Remove(oldProfile); } diff --git a/Content.Server/GameObjects/Components/Arcade/SpaceVillainArcadeComponent.cs b/Content.Server/GameObjects/Components/Arcade/SpaceVillainArcadeComponent.cs index 30098ee021..ebaa59b164 100644 --- a/Content.Server/GameObjects/Components/Arcade/SpaceVillainArcadeComponent.cs +++ b/Content.Server/GameObjects/Components/Arcade/SpaceVillainArcadeComponent.cs @@ -119,7 +119,7 @@ namespace Content.Server.GameObjects.Components.Arcade if (!Powered) return; - if (!(serverMsg.Message is SpaceVillainArcadePlayerActionMessage msg)) return; + if (serverMsg.Message is not SpaceVillainArcadePlayerActionMessage msg) return; switch (msg.PlayerAction) { diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs index 681cbe046f..c8b2dfb202 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs @@ -381,7 +381,7 @@ namespace Content.Server.GameObjects.Components.Disposal return; } - if (!(obj.Message is UiButtonPressedMessage message)) + if (obj.Message is not UiButtonPressedMessage message) { return; } diff --git a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs index 83c8c78609..6931a74617 100644 --- a/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/InventoryComponent.cs @@ -415,7 +415,7 @@ namespace Content.Server.GameObjects.Components.GUI // make sure this is one of our containers. // Technically the correct way would be to enumerate the possible slot names // comparing with this container, but I might as well put the dictionary to good use. - if (!(container is ContainerSlot slot) || !_slotContainers.ContainsValue(slot)) + if (container is not ContainerSlot slot || !_slotContainers.ContainsValue(slot)) return; if (entity.TryGetComponent(out ItemComponent itemComp)) diff --git a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs index 8ce7324607..5c303b6e7b 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs @@ -411,7 +411,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage } case CloseStorageUIMessage _: { - if (!(session is IPlayerSession playerSession)) + if (session is not IPlayerSession playerSession) { break; } diff --git a/Content.Server/GameObjects/Components/Medical/CloningPodComponent.cs b/Content.Server/GameObjects/Components/Medical/CloningPodComponent.cs index 65e9a87daf..9b5d750b4e 100644 --- a/Content.Server/GameObjects/Components/Medical/CloningPodComponent.cs +++ b/Content.Server/GameObjects/Components/Medical/CloningPodComponent.cs @@ -147,7 +147,7 @@ namespace Content.Server.GameObjects.Components.Medical private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj) { - if (!(obj.Message is CloningPodUiButtonPressedMessage message)) return; + if (obj.Message is not CloningPodUiButtonPressedMessage message) return; switch (message.Button) { diff --git a/Content.Server/GameObjects/Components/Medical/MedicalScannerComponent.cs b/Content.Server/GameObjects/Components/Medical/MedicalScannerComponent.cs index fdaf7ca0c0..ce53a5f9f2 100644 --- a/Content.Server/GameObjects/Components/Medical/MedicalScannerComponent.cs +++ b/Content.Server/GameObjects/Components/Medical/MedicalScannerComponent.cs @@ -258,7 +258,7 @@ namespace Content.Server.GameObjects.Components.Medical private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj) { - if (!(obj.Message is UiButtonPressedMessage message)) return; + if (obj.Message is not UiButtonPressedMessage message) return; switch (message.Button) { diff --git a/Content.Server/GameObjects/Components/Mobs/MindComponent.cs b/Content.Server/GameObjects/Components/Mobs/MindComponent.cs index 78af6ec95a..86aa98ea70 100644 --- a/Content.Server/GameObjects/Components/Mobs/MindComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/MindComponent.cs @@ -82,7 +82,7 @@ namespace Content.Server.GameObjects.Components.Mobs private void OnUiAcceptCloningMessage(ServerBoundUserInterfaceMessage obj) { - if (!(obj.Message is SharedAcceptCloningComponent.UiButtonPressedMessage message)) return; + if (obj.Message is not SharedAcceptCloningComponent.UiButtonPressedMessage) return; if (Mind != null) { Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new GhostComponent.GhostReturnMessage(Mind)); diff --git a/Content.Server/GameObjects/Components/NodeContainer/NodeGroups/IPipeNet.cs b/Content.Server/GameObjects/Components/NodeContainer/NodeGroups/IPipeNet.cs index fb584363ef..e9fc5c16f2 100644 --- a/Content.Server/GameObjects/Components/NodeContainer/NodeGroups/IPipeNet.cs +++ b/Content.Server/GameObjects/Components/NodeContainer/NodeGroups/IPipeNet.cs @@ -46,7 +46,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups protected override void OnAddNode(Node node) { - if (!(node is PipeNode pipeNode)) + if (node is not PipeNode pipeNode) return; _pipes.Add(pipeNode); pipeNode.JoinPipeNet(this); @@ -58,7 +58,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups protected override void OnRemoveNode(Node node) { RemoveFromGridAtmos(); - if (!(node is PipeNode pipeNode)) + if (node is not PipeNode pipeNode) return; var pipeAir = pipeNode.LocalAir; pipeAir.Merge(Air); @@ -68,7 +68,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups protected override void OnGivingNodesForCombine(INodeGroup newGroup) { - if (!(newGroup is IPipeNet newPipeNet)) + if (newGroup is not IPipeNet newPipeNet) return; newPipeNet.Air.Merge(Air); Air.Clear(); @@ -78,7 +78,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups { foreach (var newGroup in newGroups) { - if (!(newGroup is IPipeNet newPipeNet)) + if (newGroup is not IPipeNet newPipeNet) continue; newPipeNet.Air.Merge(Air); var newPipeNetGas = newPipeNet.Air; diff --git a/Content.Server/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs b/Content.Server/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs index 11e05c97b4..ece86456be 100644 --- a/Content.Server/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs +++ b/Content.Server/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs @@ -215,8 +215,8 @@ namespace Content.Server.GameObjects.Components.Suspicion { base.HandleMessage(message, component); - if (!(message is RoleMessage msg) || - !(msg.Role is SuspicionRole role)) + if (message is not RoleMessage msg || + msg.Role is not SuspicionRole role) { return; } diff --git a/Content.Shared/Arcade/BlockGameMessages.cs b/Content.Shared/Arcade/BlockGameMessages.cs index 8f6d6aba81..8b98933db1 100644 --- a/Content.Shared/Arcade/BlockGameMessages.cs +++ b/Content.Shared/Arcade/BlockGameMessages.cs @@ -123,7 +123,7 @@ namespace Content.Shared.Arcade public int CompareTo(object? obj) { - if (!(obj is HighScoreEntry entry)) return 0; + if (obj is not HighScoreEntry entry) return 0; return Score.CompareTo(entry.Score); } } diff --git a/Content.Shared/GameObjects/Components/Body/Part/SharedBodyPartComponent.cs b/Content.Shared/GameObjects/Components/Body/Part/SharedBodyPartComponent.cs index 148f432bb5..648fa16afe 100644 --- a/Content.Shared/GameObjects/Components/Body/Part/SharedBodyPartComponent.cs +++ b/Content.Shared/GameObjects/Components/Body/Part/SharedBodyPartComponent.cs @@ -154,7 +154,7 @@ namespace Content.Shared.GameObjects.Components.Body.Part { base.HandleComponentState(curState, nextState); - if (!(curState is BodyPartComponentState state)) + if (curState is not BodyPartComponentState state) { return; } diff --git a/Content.Shared/GameObjects/Components/Body/SharedBodyComponent.cs b/Content.Shared/GameObjects/Components/Body/SharedBodyComponent.cs index 50232a7c0f..b7e6dff3fa 100644 --- a/Content.Shared/GameObjects/Components/Body/SharedBodyComponent.cs +++ b/Content.Shared/GameObjects/Components/Body/SharedBodyComponent.cs @@ -675,7 +675,7 @@ namespace Content.Shared.GameObjects.Components.Body { base.HandleComponentState(curState, nextState); - if (!(curState is BodyComponentState state)) + if (curState is not BodyComponentState state) { return; } diff --git a/Content.Shared/GameObjects/Components/Body/Surgery/BiologicalSurgeryDataComponent.cs b/Content.Shared/GameObjects/Components/Body/Surgery/BiologicalSurgeryDataComponent.cs index ceb6f16ede..31c3b3e045 100644 --- a/Content.Shared/GameObjects/Components/Body/Surgery/BiologicalSurgeryDataComponent.cs +++ b/Content.Shared/GameObjects/Components/Body/Surgery/BiologicalSurgeryDataComponent.cs @@ -255,7 +255,7 @@ namespace Content.Shared.GameObjects.Components.Body.Surgery private void RemoveBodyPartSurgery(IBodyPartContainer container, ISurgeon surgeon, IEntity performer) { if (Parent == null) return; - if (!(container is IBody body)) return; + if (container is not IBody body) return; performer.PopupMessage(Loc.GetString("Saw off the limb!")); diff --git a/Content.Shared/GameObjects/Components/Chemistry/SharedSolutionContainerComponent.cs b/Content.Shared/GameObjects/Components/Chemistry/SharedSolutionContainerComponent.cs index 64fcc4746f..7fc4eb4885 100644 --- a/Content.Shared/GameObjects/Components/Chemistry/SharedSolutionContainerComponent.cs +++ b/Content.Shared/GameObjects/Components/Chemistry/SharedSolutionContainerComponent.cs @@ -104,7 +104,7 @@ namespace Content.Shared.GameObjects.Components.Chemistry { base.HandleComponentState(curState, nextState); - if (!(curState is SolutionContainerComponentState state)) + if (curState is not SolutionContainerComponentState state) { return; } diff --git a/Content.Shared/GameObjects/Components/Items/ItemCooldownComponent.cs b/Content.Shared/GameObjects/Components/Items/ItemCooldownComponent.cs index c2425cc9bc..1851ddd2df 100644 --- a/Content.Shared/GameObjects/Components/Items/ItemCooldownComponent.cs +++ b/Content.Shared/GameObjects/Components/Items/ItemCooldownComponent.cs @@ -62,7 +62,9 @@ namespace Content.Shared.GameObjects.Components.Items public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is ItemCooldownComponentState cast)) + base.HandleComponentState(curState, nextState); + + if (curState is not ItemCooldownComponentState cast) return; CooldownStart = cast.CooldownStart; diff --git a/Content.Shared/GameObjects/Components/Mobs/SharedCombatModeComponent.cs b/Content.Shared/GameObjects/Components/Mobs/SharedCombatModeComponent.cs index bde177ac64..12e284e87d 100644 --- a/Content.Shared/GameObjects/Components/Mobs/SharedCombatModeComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/SharedCombatModeComponent.cs @@ -39,7 +39,7 @@ namespace Content.Shared.GameObjects.Components.Mobs { base.HandleComponentState(curState, nextState); - if (!(curState is CombatModeComponentState state)) + if (curState is not CombatModeComponentState state) return; IsInCombatMode = state.IsInCombatMode; diff --git a/Content.Shared/GameObjects/Components/Mobs/SharedHumanoidAppearanceComponent.cs b/Content.Shared/GameObjects/Components/Mobs/SharedHumanoidAppearanceComponent.cs index 91abd4e721..b2d223eea5 100644 --- a/Content.Shared/GameObjects/Components/Mobs/SharedHumanoidAppearanceComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/SharedHumanoidAppearanceComponent.cs @@ -51,7 +51,9 @@ namespace Content.Shared.GameObjects.Components.Mobs public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is HumanoidAppearanceComponentState cast)) + base.HandleComponentState(curState, nextState); + + if (curState is not HumanoidAppearanceComponentState cast) return; Appearance = cast.Appearance; diff --git a/Content.Shared/GameObjects/Components/Pulling/SharedPullableComponent.cs b/Content.Shared/GameObjects/Components/Pulling/SharedPullableComponent.cs index 79bbf6e7c9..4fbf16931f 100644 --- a/Content.Shared/GameObjects/Components/Pulling/SharedPullableComponent.cs +++ b/Content.Shared/GameObjects/Components/Pulling/SharedPullableComponent.cs @@ -171,7 +171,7 @@ namespace Content.Shared.GameObjects.Components.Pulling { base.HandleComponentState(curState, nextState); - if (!(curState is PullableComponentState state)) + if (curState is not PullableComponentState state) { return; } @@ -195,7 +195,7 @@ namespace Content.Shared.GameObjects.Components.Pulling { base.HandleMessage(message, component); - if (!(message is PullMessage pullMessage) || + if (message is not PullMessage pullMessage || pullMessage.Pulled.Owner != Owner) { return; diff --git a/Content.Shared/GameObjects/Components/Pulling/SharedPullerComponent.cs b/Content.Shared/GameObjects/Components/Pulling/SharedPullerComponent.cs index 0a87ba22fe..f6355e0a42 100644 --- a/Content.Shared/GameObjects/Components/Pulling/SharedPullerComponent.cs +++ b/Content.Shared/GameObjects/Components/Pulling/SharedPullerComponent.cs @@ -52,7 +52,7 @@ namespace Content.Shared.GameObjects.Components.Pulling { base.HandleMessage(message, component); - if (!(message is PullMessage pullMessage) || + if (message is not PullMessage pullMessage || pullMessage.Puller.Owner != Owner) { return; diff --git a/Content.Shared/GameObjects/Components/SharedStackComponent.cs b/Content.Shared/GameObjects/Components/SharedStackComponent.cs index a70af9a823..90363daebc 100644 --- a/Content.Shared/GameObjects/Components/SharedStackComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedStackComponent.cs @@ -97,7 +97,7 @@ namespace Content.Shared.GameObjects.Components public override void HandleComponentState(ComponentState curState, ComponentState nextState) { - if (!(curState is StackComponentState cast)) + if (curState is not StackComponentState cast) { return; } diff --git a/Content.Shared/GameObjects/EntitySystems/SharedMoverSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedMoverSystem.cs index 974ba1014a..ee0ce1b188 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedMoverSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedMoverSystem.cs @@ -205,7 +205,7 @@ namespace Content.Shared.GameObjects.EntitySystems public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message) { - if (!(message is FullInputCmdMessage full)) + if (message is not FullInputCmdMessage full) { return false; } @@ -219,7 +219,7 @@ namespace Content.Shared.GameObjects.EntitySystems { public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message) { - if (!(message is FullInputCmdMessage full)) + if (message is not FullInputCmdMessage full) { return false; } diff --git a/Content.Shared/Preferences/HumanoidCharacterAppearance.cs b/Content.Shared/Preferences/HumanoidCharacterAppearance.cs index 6e04371213..f28814c0fd 100644 --- a/Content.Shared/Preferences/HumanoidCharacterAppearance.cs +++ b/Content.Shared/Preferences/HumanoidCharacterAppearance.cs @@ -145,7 +145,7 @@ namespace Content.Shared.Preferences public bool MemberwiseEquals(ICharacterAppearance maybeOther) { - if (!(maybeOther is HumanoidCharacterAppearance other)) return false; + if (maybeOther is not HumanoidCharacterAppearance other) return false; if (HairStyleName != other.HairStyleName) return false; if (!HairColor.Equals(other.HairColor)) return false; if (FacialHairStyleName != other.FacialHairStyleName) return false; diff --git a/Content.Shared/Preferences/HumanoidCharacterProfile.cs b/Content.Shared/Preferences/HumanoidCharacterProfile.cs index 6c69f2ee12..c1591f590b 100644 --- a/Content.Shared/Preferences/HumanoidCharacterProfile.cs +++ b/Content.Shared/Preferences/HumanoidCharacterProfile.cs @@ -236,7 +236,7 @@ namespace Content.Shared.Preferences public bool MemberwiseEquals(ICharacterProfile maybeOther) { - if (!(maybeOther is HumanoidCharacterProfile other)) return false; + if (maybeOther is not HumanoidCharacterProfile other) return false; if (Name != other.Name) return false; if (Age != other.Age) return false; if (Sex != other.Sex) return false;