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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,8 @@ 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>();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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!"));
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user