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

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