Update usages of ! is with is not (#2584)

* Update usages of ! is with is not

* Content.IntegrationTests commit

* Content.Server commit

* Content.Shared commit

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
DrSmugleaf
2020-11-26 14:33:31 +01:00
committed by GitHub
parent a16ce4b7a5
commit 06b1939a60
75 changed files with 147 additions and 113 deletions

View File

@@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components.ActionBlocking
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{ {
if (!(curState is CuffableComponentState cuffState)) if (curState is not CuffableComponentState cuffState)
{ {
return; return;
} }

View File

@@ -10,16 +10,19 @@ namespace Content.Client.GameObjects.Components.ActionBlocking
{ {
public override void HandleComponentState(ComponentState curState, ComponentState nextState) 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; return;
} }
if (Owner.TryGetComponent<SpriteComponent>(out var sprite)) if (Owner.TryGetComponent<SpriteComponent>(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?
} }
} }
} }

View File

@@ -24,7 +24,7 @@ namespace Content.Client.GameObjects.Components.Atmos
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
if (!(curState is GasAnalyzerComponentState state)) if (curState is not GasAnalyzerComponentState state)
return; return;
Danger = state.Danger; Danger = state.Danger;

View File

@@ -31,7 +31,7 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
{ {
base.UpdateState(state); base.UpdateState(state);
if (!(state is BodyScannerUIState scannerState)) if (state is not BodyScannerUIState scannerState)
{ {
return; return;
} }

View File

@@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components.Buckle
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
if (!(curState is BuckleComponentState buckle)) if (curState is not BuckleComponentState buckle)
{ {
return; return;
} }

View File

@@ -63,7 +63,7 @@ namespace Content.Client.GameObjects.Components.Cargo
}; };
_menu.OnItemSelected += (args) => _menu.OnItemSelected += (args) =>
{ {
if (!(args.Button.Parent is CargoProductRow row)) if (args.Button.Parent is not CargoProductRow row)
return; return;
_product = row.Product; _product = row.Product;
_orderMenu.Requester.Text = null; _orderMenu.Requester.Text = null;
@@ -87,7 +87,7 @@ namespace Content.Client.GameObjects.Components.Cargo
{ {
base.UpdateState(state); base.UpdateState(state);
if (!(state is CargoConsoleInterfaceState cState)) if (state is not CargoConsoleInterfaceState cState)
return; return;
if (RequestOnly != cState.RequestOnly) if (RequestOnly != cState.RequestOnly)
{ {
@@ -121,14 +121,14 @@ namespace Content.Client.GameObjects.Components.Cargo
internal void RemoveOrder(BaseButton.ButtonEventArgs args) internal void RemoveOrder(BaseButton.ButtonEventArgs args)
{ {
if (!(args.Button.Parent.Parent is CargoOrderRow row)) if (args.Button.Parent.Parent is not CargoOrderRow row)
return; return;
SendMessage(new SharedCargoConsoleComponent.CargoConsoleRemoveOrderMessage(row.Order.OrderNumber)); SendMessage(new SharedCargoConsoleComponent.CargoConsoleRemoveOrderMessage(row.Order.OrderNumber));
} }
internal void ApproveOrder(BaseButton.ButtonEventArgs args) internal void ApproveOrder(BaseButton.ButtonEventArgs args)
{ {
if (!(args.Button.Parent.Parent is CargoOrderRow row)) if (args.Button.Parent.Parent is not CargoOrderRow row)
return; return;
if (ShuttleCapacity.CurrentCapacity == ShuttleCapacity.MaxCapacity) if (ShuttleCapacity.CurrentCapacity == ShuttleCapacity.MaxCapacity)
return; return;

View File

@@ -40,7 +40,7 @@ namespace Content.Client.GameObjects.Components.Cargo
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is CargoOrderDatabaseState state)) if (curState is not CargoOrderDatabaseState state)
return; return;
Clear(); Clear();
if (state.Orders == null) if (state.Orders == null)

View File

@@ -20,7 +20,7 @@ namespace Content.Client.GameObjects.Components.Cargo
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is GalacticMarketState state)) if (curState is not GalacticMarketState state)
return; return;
_products.Clear(); _products.Clear();
foreach (var productId in state.Products) foreach (var productId in state.Products)

View File

@@ -29,14 +29,15 @@ namespace Content.Client.GameObjects.Components.Chemistry
//Handle net updates //Handle net updates
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
var cast = (InjectorComponentState) curState; if (curState is not InjectorComponentState state)
if (cast != null)
{ {
CurrentVolume = cast.CurrentVolume; return;
TotalVolume = cast.TotalVolume;
CurrentMode = cast.CurrentMode;
_uiUpdateNeeded = true;
} }
CurrentVolume = state.CurrentVolume;
TotalVolume = state.TotalVolume;
CurrentMode = state.CurrentMode;
_uiUpdateNeeded = true;
} }
/// <summary> /// <summary>

View File

@@ -81,12 +81,13 @@ namespace Content.Client.GameObjects.Components.Clothing
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{ {
if (curState == null) if (curState is not ClothingComponentState state)
{
return; return;
}
var clothingComponentState = (ClothingComponentState)curState; ClothingEquippedPrefix = state.ClothingEquippedPrefix;
ClothingEquippedPrefix = clothingComponentState.ClothingEquippedPrefix; EquippedPrefix = state.EquippedPrefix;
EquippedPrefix = clothingComponentState.EquippedPrefix;
} }
} }

View File

@@ -56,7 +56,9 @@ namespace Content.Client.GameObjects.Components.Command
protected override void UpdateState(BoundUserInterfaceState state) protected override void UpdateState(BoundUserInterfaceState state)
{ {
if (!(state is CommunicationsConsoleInterfaceState commsState)) base.UpdateState(state);
if (state is not CommunicationsConsoleInterfaceState commsState)
return; return;
_expectedCountdownTime = commsState.ExpectedCountdownEnd; _expectedCountdownTime = commsState.ExpectedCountdownEnd;

View File

@@ -25,7 +25,7 @@ namespace Content.Client.GameObjects.Components.Crayon
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
if (!(curState is CrayonComponentState state)) if (curState is not CrayonComponentState state)
return; return;
_color = state.Color; _color = state.Color;

View File

@@ -45,7 +45,7 @@ namespace Content.Client.GameObjects.Components.Disposal
{ {
base.UpdateState(state); base.UpdateState(state);
if (!(state is DisposalMailingUnitBoundUserInterfaceState cast)) if (state is not DisposalMailingUnitBoundUserInterfaceState cast)
{ {
return; return;
} }

View File

@@ -42,7 +42,7 @@ namespace Content.Client.GameObjects.Components.Disposal
{ {
base.UpdateState(state); base.UpdateState(state);
if (!(state is DisposalRouterUserInterfaceState cast)) if (state is not DisposalRouterUserInterfaceState cast)
{ {
return; return;
} }

View File

@@ -42,7 +42,7 @@ namespace Content.Client.GameObjects.Components.Disposal
{ {
base.UpdateState(state); base.UpdateState(state);
if (!(state is DisposalTaggerUserInterfaceState cast)) if (state is not DisposalTaggerUserInterfaceState cast)
{ {
return; return;
} }

View File

@@ -41,7 +41,7 @@ namespace Content.Client.GameObjects.Components.Disposal
{ {
base.UpdateState(state); base.UpdateState(state);
if (!(state is DisposalUnitBoundUserInterfaceState cast)) if (state is not DisposalUnitBoundUserInterfaceState cast)
{ {
return; return;
} }

View File

@@ -76,7 +76,8 @@ namespace Content.Client.GameObjects.Components
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is DoAfterComponentState state))
if (curState is not DoAfterComponentState state)
return; return;
var toRemove = new List<ClientDoAfter>(); var toRemove = new List<ClientDoAfter>();

View File

@@ -74,14 +74,12 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (curState == null) if (curState is not InventoryComponentState state)
return; return;
var cast = (InventoryComponentState) curState;
var doneSlots = new HashSet<Slots>(); var doneSlots = new HashSet<Slots>();
foreach (var (slot, entityUid) in cast.Entities) foreach (var (slot, entityUid) in state.Entities)
{ {
if (!Owner.EntityManager.TryGetEntity(entityUid, out var entity)) if (!Owner.EntityManager.TryGetEntity(entityUid, out var entity))
{ {
@@ -95,9 +93,9 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
doneSlots.Add(slot); 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); var entity = Owner.EntityManager.GetEntity(entityUid);
InterfaceController?.HoverInSlot(slot, entity, fits); InterfaceController?.HoverInSlot(slot, entity, fits);

View File

@@ -90,7 +90,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
{ {
base.UpdateState(state); base.UpdateState(state);
if (!(state is StrippingBoundUserInterfaceState stripState)) return; if (state is not StrippingBoundUserInterfaceState stripState) return;
Inventory = stripState.Inventory; Inventory = stripState.Inventory;
Hands = stripState.Hands; Hands = stripState.Hands;

View File

@@ -25,7 +25,9 @@ namespace Content.Client.GameObjects.Components
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
if (!(curState is HandheldLightComponentState cast)) base.HandleComponentState(curState, nextState);
if (curState is not HandheldLightComponentState cast)
return; return;
_level = cast.Charge; _level = cast.Charge;

View File

@@ -306,7 +306,7 @@ namespace Content.Client.GameObjects.Components.Instruments
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is InstrumentState state)) return; if (curState is not InstrumentState state) return;
if (state.Playing) if (state.Playing)
{ {

View File

@@ -32,7 +32,9 @@ namespace Content.Client.GameObjects.Components.Interactable
public override void HandleComponentState(ComponentState curState, ComponentState nextState) 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; _behavior = tool.Quality;
_uiUpdateNeeded = true; _uiUpdateNeeded = true;

View File

@@ -32,7 +32,9 @@ namespace Content.Client.GameObjects.Components.Interactable
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
if (!(curState is WelderComponentState weld)) base.HandleComponentState(curState, nextState);
if (curState is not WelderComponentState weld)
return; return;
FuelCapacity = weld.FuelCapacity; FuelCapacity = weld.FuelCapacity;

View File

@@ -78,7 +78,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
protected override void UpdateState(BoundUserInterfaceState state) protected override void UpdateState(BoundUserInterfaceState state)
{ {
base.UpdateState(state); base.UpdateState(state);
if (!(state is MicrowaveUpdateUserInterfaceState cState)) if (state is not MicrowaveUpdateUserInterfaceState cState)
{ {
return; return;
} }

View File

@@ -78,7 +78,7 @@ namespace Content.Client.GameObjects.Components.Mobs
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is AlertsComponentState state)) if (curState is not AlertsComponentState state)
{ {
return; return;
} }

View File

@@ -48,7 +48,7 @@ namespace Content.Client.GameObjects.Components.Mobs.State
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is MobStateManagerComponentState state)) if (curState is not MobStateManagerComponentState state)
{ {
return; return;
} }

View File

@@ -22,7 +22,7 @@ namespace Content.Client.GameObjects.Components.Mobs
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is StunnableComponentState state)) if (curState is not StunnableComponentState state)
{ {
return; return;
} }

View File

@@ -8,7 +8,9 @@ namespace Content.Client.GameObjects.Components.Movement
{ {
public override void HandleComponentState(ComponentState curState, ComponentState nextState) 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; return;
} }

View File

@@ -10,7 +10,9 @@ namespace Content.Client.GameObjects.Components.Movement
{ {
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) 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; Slippery = state.Slippery;
IntersectPercentage = state.IntersectPercentage; IntersectPercentage = state.IntersectPercentage;

View File

@@ -13,7 +13,9 @@ namespace Content.Client.GameObjects.Components.Nutrition
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{ {
if (!(curState is HungerComponentState hunger)) base.HandleComponentState(curState, nextState);
if (curState is not HungerComponentState hunger)
{ {
return; return;
} }

View File

@@ -13,7 +13,9 @@ namespace Content.Client.GameObjects.Components.Nutrition
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{ {
if (!(curState is ThirstComponentState thirst)) base.HandleComponentState(curState, nextState);
if (curState is not ThirstComponentState thirst)
{ {
return; return;
} }

View File

@@ -106,7 +106,7 @@ namespace Content.Client.GameObjects.Components.Observer
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is GhostComponentState state)) return; if (curState is not GhostComponentState state) return;
CanReturnToBody = state.CanReturnToBody; CanReturnToBody = state.CanReturnToBody;

View File

@@ -30,7 +30,7 @@ namespace Content.Client.GameObjects.Components
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is PlaceableSurfaceComponentState state)) if (curState is not PlaceableSurfaceComponentState state)
{ {
return; return;
} }

View File

@@ -15,7 +15,7 @@ namespace Content.Client.GameObjects.Components.Research
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is LatheDatabaseState state)) return; if (curState is not LatheDatabaseState state) return;
Clear(); Clear();
foreach (var ID in state.Recipes) foreach (var ID in state.Recipes)
{ {

View File

@@ -16,7 +16,7 @@ namespace Content.Client.GameObjects.Components.Research
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is MaterialStorageState state)) return; if (curState is not MaterialStorageState state) return;
Storage = state.Storage; Storage = state.Storage;
OnMaterialStorageChanged?.Invoke(); OnMaterialStorageChanged?.Invoke();
} }

View File

@@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components.Research
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is ProtolatheDatabaseState state)) return; if (curState is not ProtolatheDatabaseState state) return;
Clear(); Clear();
foreach (var ID in state.Recipes) foreach (var ID in state.Recipes)
{ {

View File

@@ -37,7 +37,7 @@ namespace Content.Client.GameObjects.Components.Research
protected override void UpdateState(BoundUserInterfaceState state) protected override void UpdateState(BoundUserInterfaceState state)
{ {
base.UpdateState(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); _menu.Populate(rState.ServerCount, rState.ServerNames, rState.ServerIds, rState.SelectedServerId);
} }

View File

@@ -18,7 +18,7 @@ namespace Content.Client.GameObjects.Components.Research
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is TechnologyDatabaseState state)) return; if (curState is not TechnologyDatabaseState state) return;
_technologies.Clear(); _technologies.Clear();
var protoManager = IoCManager.Resolve<IPrototypeManager>(); var protoManager = IoCManager.Resolve<IPrototypeManager>();
foreach (var techID in state.Technologies) foreach (var techID in state.Technologies)

View File

@@ -25,7 +25,7 @@ namespace Content.Client.GameObjects.Components.StationEvents
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is RadiationPulseState state)) if (curState is not RadiationPulseState state)
{ {
return; return;
} }

View File

@@ -50,7 +50,7 @@ namespace Content.Client.GameObjects.Components.Storage
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is StorageComponentState state)) if (curState is not StorageComponentState state)
{ {
return; return;
} }

View File

@@ -30,7 +30,7 @@ namespace Content.Client.GameObjects.Components.Storage
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is StorableComponentState state)) if (curState is not StorableComponentState state)
{ {
return; return;
} }

View File

@@ -119,7 +119,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is SuspicionRoleComponentState state)) if (curState is not SuspicionRoleComponentState state)
{ {
return; return;
} }

View File

@@ -30,7 +30,9 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
if (!(curState is BatteryBarrelComponentState cast)) base.HandleComponentState(curState, nextState);
if (curState is not BatteryBarrelComponentState cast)
return; return;
MagazineCount = cast.Magazine; MagazineCount = cast.Magazine;

View File

@@ -38,7 +38,9 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
if (!(curState is BoltActionBarrelComponentState cast)) base.HandleComponentState(curState, nextState);
if (curState is not BoltActionBarrelComponentState cast)
return; return;
Chamber = cast.Chamber; Chamber = cast.Chamber;

View File

@@ -99,7 +99,9 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
if (!(curState is MagazineBarrelComponentState cast)) base.HandleComponentState(curState, nextState);
if (curState is not MagazineBarrelComponentState cast)
return; return;
Chambered = cast.Chambered; Chambered = cast.Chambered;

View File

@@ -38,7 +38,9 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
if (!(curState is PumpBarrelComponentState cast)) base.HandleComponentState(curState, nextState);
if (curState is not PumpBarrelComponentState cast)
return; return;
Chamber = cast.Chamber; Chamber = cast.Chamber;

View File

@@ -32,7 +32,9 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
if (!(curState is RevolverBarrelComponentState cast)) base.HandleComponentState(curState, nextState);
if (curState is not RevolverBarrelComponentState cast)
return; return;
CurrentSlot = cast.CurrentSlot; CurrentSlot = cast.CurrentSlot;

View File

@@ -23,7 +23,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is RangedWeaponComponentState rangedState)) if (curState is not RangedWeaponComponentState rangedState)
{ {
return; return;
} }

View File

@@ -142,7 +142,7 @@ namespace Content.Client.GameObjects.EntitySystems
return true; return true;
} }
if (!(_stateManager.CurrentState is GameScreenBase gameScreen)) if (_stateManager.CurrentState is not GameScreenBase)
{ {
return false; return false;
} }

View File

@@ -111,7 +111,7 @@ namespace Content.Client.UserInterface
{ {
_loaded.Visible = true; _loaded.Visible = true;
_unloaded.Visible = false; _unloaded.Visible = false;
if (!(_preferencesManager.Preferences.SelectedCharacter is HumanoidCharacterProfile selectedCharacter)) if (_preferencesManager.Preferences.SelectedCharacter is not HumanoidCharacterProfile selectedCharacter)
{ {
_summaryLabel.Text = string.Empty; _summaryLabel.Text = string.Empty;
} }

View File

@@ -401,7 +401,7 @@ namespace Content.IntegrationTests.Tests.Networking
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{ {
if (!(curState is PredictionComponentState pred)) if (curState is not PredictionComponentState pred)
{ {
return; return;
} }

View File

@@ -56,7 +56,7 @@ namespace Content.Server.Database
return; return;
} }
if (!(profile is HumanoidCharacterProfile humanoid)) if (profile is not HumanoidCharacterProfile humanoid)
{ {
// TODO: Handle other ICharacterProfile implementations properly // TODO: Handle other ICharacterProfile implementations properly
throw new NotImplementedException(); throw new NotImplementedException();
@@ -73,7 +73,7 @@ namespace Content.Server.Database
.Profiles .Profiles
.SingleOrDefault(h => h.Slot == entity.Slot); .SingleOrDefault(h => h.Slot == entity.Slot);
if (!(oldProfile is null)) if (oldProfile is not null)
{ {
prefs.Profiles.Remove(oldProfile); prefs.Profiles.Remove(oldProfile);
} }

View File

@@ -119,7 +119,7 @@ namespace Content.Server.GameObjects.Components.Arcade
if (!Powered) if (!Powered)
return; return;
if (!(serverMsg.Message is SpaceVillainArcadePlayerActionMessage msg)) return; if (serverMsg.Message is not SpaceVillainArcadePlayerActionMessage msg) return;
switch (msg.PlayerAction) switch (msg.PlayerAction)
{ {

View File

@@ -381,7 +381,7 @@ namespace Content.Server.GameObjects.Components.Disposal
return; return;
} }
if (!(obj.Message is UiButtonPressedMessage message)) if (obj.Message is not UiButtonPressedMessage message)
{ {
return; return;
} }

View File

@@ -415,7 +415,7 @@ namespace Content.Server.GameObjects.Components.GUI
// make sure this is one of our containers. // make sure this is one of our containers.
// Technically the correct way would be to enumerate the possible slot names // 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. // 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; return;
if (entity.TryGetComponent(out ItemComponent itemComp)) if (entity.TryGetComponent(out ItemComponent itemComp))

View File

@@ -411,7 +411,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
} }
case CloseStorageUIMessage _: case CloseStorageUIMessage _:
{ {
if (!(session is IPlayerSession playerSession)) if (session is not IPlayerSession playerSession)
{ {
break; break;
} }

View File

@@ -147,7 +147,7 @@ namespace Content.Server.GameObjects.Components.Medical
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj) private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
{ {
if (!(obj.Message is CloningPodUiButtonPressedMessage message)) return; if (obj.Message is not CloningPodUiButtonPressedMessage message) return;
switch (message.Button) switch (message.Button)
{ {

View File

@@ -258,7 +258,7 @@ namespace Content.Server.GameObjects.Components.Medical
private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj) private void OnUiReceiveMessage(ServerBoundUserInterfaceMessage obj)
{ {
if (!(obj.Message is UiButtonPressedMessage message)) return; if (obj.Message is not UiButtonPressedMessage message) return;
switch (message.Button) switch (message.Button)
{ {

View File

@@ -82,7 +82,7 @@ namespace Content.Server.GameObjects.Components.Mobs
private void OnUiAcceptCloningMessage(ServerBoundUserInterfaceMessage obj) private void OnUiAcceptCloningMessage(ServerBoundUserInterfaceMessage obj)
{ {
if (!(obj.Message is SharedAcceptCloningComponent.UiButtonPressedMessage message)) return; if (obj.Message is not SharedAcceptCloningComponent.UiButtonPressedMessage) return;
if (Mind != null) if (Mind != null)
{ {
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new GhostComponent.GhostReturnMessage(Mind)); Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new GhostComponent.GhostReturnMessage(Mind));

View File

@@ -46,7 +46,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
protected override void OnAddNode(Node node) protected override void OnAddNode(Node node)
{ {
if (!(node is PipeNode pipeNode)) if (node is not PipeNode pipeNode)
return; return;
_pipes.Add(pipeNode); _pipes.Add(pipeNode);
pipeNode.JoinPipeNet(this); pipeNode.JoinPipeNet(this);
@@ -58,7 +58,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
protected override void OnRemoveNode(Node node) protected override void OnRemoveNode(Node node)
{ {
RemoveFromGridAtmos(); RemoveFromGridAtmos();
if (!(node is PipeNode pipeNode)) if (node is not PipeNode pipeNode)
return; return;
var pipeAir = pipeNode.LocalAir; var pipeAir = pipeNode.LocalAir;
pipeAir.Merge(Air); pipeAir.Merge(Air);
@@ -68,7 +68,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
protected override void OnGivingNodesForCombine(INodeGroup newGroup) protected override void OnGivingNodesForCombine(INodeGroup newGroup)
{ {
if (!(newGroup is IPipeNet newPipeNet)) if (newGroup is not IPipeNet newPipeNet)
return; return;
newPipeNet.Air.Merge(Air); newPipeNet.Air.Merge(Air);
Air.Clear(); Air.Clear();
@@ -78,7 +78,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
{ {
foreach (var newGroup in newGroups) foreach (var newGroup in newGroups)
{ {
if (!(newGroup is IPipeNet newPipeNet)) if (newGroup is not IPipeNet newPipeNet)
continue; continue;
newPipeNet.Air.Merge(Air); newPipeNet.Air.Merge(Air);
var newPipeNetGas = newPipeNet.Air; var newPipeNetGas = newPipeNet.Air;

View File

@@ -215,8 +215,8 @@ namespace Content.Server.GameObjects.Components.Suspicion
{ {
base.HandleMessage(message, component); base.HandleMessage(message, component);
if (!(message is RoleMessage msg) || if (message is not RoleMessage msg ||
!(msg.Role is SuspicionRole role)) msg.Role is not SuspicionRole role)
{ {
return; return;
} }

View File

@@ -123,7 +123,7 @@ namespace Content.Shared.Arcade
public int CompareTo(object? obj) 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); return Score.CompareTo(entry.Score);
} }
} }

View File

@@ -154,7 +154,7 @@ namespace Content.Shared.GameObjects.Components.Body.Part
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is BodyPartComponentState state)) if (curState is not BodyPartComponentState state)
{ {
return; return;
} }

View File

@@ -675,7 +675,7 @@ namespace Content.Shared.GameObjects.Components.Body
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is BodyComponentState state)) if (curState is not BodyComponentState state)
{ {
return; return;
} }

View File

@@ -255,7 +255,7 @@ namespace Content.Shared.GameObjects.Components.Body.Surgery
private void RemoveBodyPartSurgery(IBodyPartContainer container, ISurgeon surgeon, IEntity performer) private void RemoveBodyPartSurgery(IBodyPartContainer container, ISurgeon surgeon, IEntity performer)
{ {
if (Parent == null) return; 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!")); performer.PopupMessage(Loc.GetString("Saw off the limb!"));

View File

@@ -104,7 +104,7 @@ namespace Content.Shared.GameObjects.Components.Chemistry
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is SolutionContainerComponentState state)) if (curState is not SolutionContainerComponentState state)
{ {
return; return;
} }

View File

@@ -62,7 +62,9 @@ namespace Content.Shared.GameObjects.Components.Items
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
if (!(curState is ItemCooldownComponentState cast)) base.HandleComponentState(curState, nextState);
if (curState is not ItemCooldownComponentState cast)
return; return;
CooldownStart = cast.CooldownStart; CooldownStart = cast.CooldownStart;

View File

@@ -39,7 +39,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is CombatModeComponentState state)) if (curState is not CombatModeComponentState state)
return; return;
IsInCombatMode = state.IsInCombatMode; IsInCombatMode = state.IsInCombatMode;

View File

@@ -51,7 +51,9 @@ namespace Content.Shared.GameObjects.Components.Mobs
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
if (!(curState is HumanoidAppearanceComponentState cast)) base.HandleComponentState(curState, nextState);
if (curState is not HumanoidAppearanceComponentState cast)
return; return;
Appearance = cast.Appearance; Appearance = cast.Appearance;

View File

@@ -171,7 +171,7 @@ namespace Content.Shared.GameObjects.Components.Pulling
{ {
base.HandleComponentState(curState, nextState); base.HandleComponentState(curState, nextState);
if (!(curState is PullableComponentState state)) if (curState is not PullableComponentState state)
{ {
return; return;
} }
@@ -195,7 +195,7 @@ namespace Content.Shared.GameObjects.Components.Pulling
{ {
base.HandleMessage(message, component); base.HandleMessage(message, component);
if (!(message is PullMessage pullMessage) || if (message is not PullMessage pullMessage ||
pullMessage.Pulled.Owner != Owner) pullMessage.Pulled.Owner != Owner)
{ {
return; return;

View File

@@ -52,7 +52,7 @@ namespace Content.Shared.GameObjects.Components.Pulling
{ {
base.HandleMessage(message, component); base.HandleMessage(message, component);
if (!(message is PullMessage pullMessage) || if (message is not PullMessage pullMessage ||
pullMessage.Puller.Owner != Owner) pullMessage.Puller.Owner != Owner)
{ {
return; return;

View File

@@ -97,7 +97,7 @@ namespace Content.Shared.GameObjects.Components
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{ {
if (!(curState is StackComponentState cast)) if (curState is not StackComponentState cast)
{ {
return; return;
} }

View File

@@ -205,7 +205,7 @@ namespace Content.Shared.GameObjects.EntitySystems
public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message) public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message)
{ {
if (!(message is FullInputCmdMessage full)) if (message is not FullInputCmdMessage full)
{ {
return false; return false;
} }
@@ -219,7 +219,7 @@ namespace Content.Shared.GameObjects.EntitySystems
{ {
public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message) public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message)
{ {
if (!(message is FullInputCmdMessage full)) if (message is not FullInputCmdMessage full)
{ {
return false; return false;
} }

View File

@@ -145,7 +145,7 @@ namespace Content.Shared.Preferences
public bool MemberwiseEquals(ICharacterAppearance maybeOther) 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 (HairStyleName != other.HairStyleName) return false;
if (!HairColor.Equals(other.HairColor)) return false; if (!HairColor.Equals(other.HairColor)) return false;
if (FacialHairStyleName != other.FacialHairStyleName) return false; if (FacialHairStyleName != other.FacialHairStyleName) return false;

View File

@@ -236,7 +236,7 @@ namespace Content.Shared.Preferences
public bool MemberwiseEquals(ICharacterProfile maybeOther) 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 (Name != other.Name) return false;
if (Age != other.Age) return false; if (Age != other.Age) return false;
if (Sex != other.Sex) return false; if (Sex != other.Sex) return false;