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)
{
if (!(curState is CuffableComponentState cuffState))
if (curState is not CuffableComponentState cuffState)
{
return;
}

View File

@@ -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<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)
{
if (!(curState is GasAnalyzerComponentState state))
if (curState is not GasAnalyzerComponentState state)
return;
Danger = state.Danger;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -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)

View File

@@ -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;
}
/// <summary>

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -18,8 +18,8 @@ namespace Content.Client.GameObjects.Components
public IReadOnlyDictionary<byte, ClientDoAfter> DoAfters => _doAfters;
private readonly Dictionary<byte, ClientDoAfter> _doAfters = new Dictionary<byte, ClientDoAfter>();
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<ClientDoAfter>();
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<IGameTiming>().CurTime;
CancelledDoAfters.Add((currentTime.Value, doAfterMessage));
Gui?.CancelDoAfter(id);
}
}
}
}

View File

@@ -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<Slots>();
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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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)
{

View File

@@ -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();
}

View File

@@ -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)
{

View File

@@ -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);
}

View File

@@ -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<IPrototypeManager>();
foreach (var techID in state.Technologies)

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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)
{

View File

@@ -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;
}

View File

@@ -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))

View File

@@ -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;
}

View File

@@ -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)
{

View File

@@ -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)
{

View File

@@ -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));

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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!"));

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;