diff --git a/Content.Client/Gravity/GravitySystem.Shake.cs b/Content.Client/Gravity/GravitySystem.Shake.cs index c4356588d3..9b9918ca3e 100644 --- a/Content.Client/Gravity/GravitySystem.Shake.cs +++ b/Content.Client/Gravity/GravitySystem.Shake.cs @@ -25,7 +25,7 @@ public sealed partial class GravitySystem { var localPlayer = _playerManager.LocalEntity; - if (!TryComp(localPlayer, out var xform) || + if (!TryComp(localPlayer, out TransformComponent? xform) || xform.GridUid != uid && xform.MapUid != uid) { return; @@ -46,7 +46,7 @@ public sealed partial class GravitySystem var localPlayer = _playerManager.LocalEntity; - if (!TryComp(localPlayer, out var xform)) + if (!TryComp(localPlayer, out TransformComponent? xform)) return; if (xform.GridUid != uid || diff --git a/Content.Client/Maps/GridDraggingSystem.cs b/Content.Client/Maps/GridDraggingSystem.cs index 16357c8983..e82786847e 100644 --- a/Content.Client/Maps/GridDraggingSystem.cs +++ b/Content.Client/Maps/GridDraggingSystem.cs @@ -61,7 +61,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem { if (_dragging == null) return; - if (_lastMousePosition != null && TryComp(_dragging.Value, out var xform) && + if (_lastMousePosition != null && TryComp(_dragging.Value, out TransformComponent? xform) && TryComp(_dragging.Value, out var body) && xform.MapID == _lastMousePosition.Value.MapId) { @@ -104,7 +104,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem StartDragging(gridUid, Transform(gridUid).InvWorldMatrix.Transform(mousePos.Position)); } - if (!TryComp(_dragging, out var xform)) + if (!TryComp(_dragging, out TransformComponent? xform)) { StopDragging(); return; diff --git a/Content.Client/Salvage/SalvageSystem.cs b/Content.Client/Salvage/SalvageSystem.cs index fb305c5fdc..e1bce367ca 100644 --- a/Content.Client/Salvage/SalvageSystem.cs +++ b/Content.Client/Salvage/SalvageSystem.cs @@ -38,7 +38,7 @@ public sealed class SalvageSystem : SharedSalvageSystem var player = _playerManager.LocalEntity; - if (!TryComp(player, out var xform) || + if (!TryComp(player, out TransformComponent? xform) || !TryComp(xform.MapUid, out var expedition) || expedition.Stage < ExpeditionStage.MusicCountdown) { diff --git a/Content.Client/Sprite/SpriteFadeSystem.cs b/Content.Client/Sprite/SpriteFadeSystem.cs index d9584b60a6..676a6e583d 100644 --- a/Content.Client/Sprite/SpriteFadeSystem.cs +++ b/Content.Client/Sprite/SpriteFadeSystem.cs @@ -45,7 +45,7 @@ public sealed class SpriteFadeSystem : EntitySystem var spriteQuery = GetEntityQuery(); var change = ChangeRate * frameTime; - if (TryComp(player, out var playerXform) && + if (TryComp(player, out TransformComponent? playerXform) && _stateManager.CurrentState is GameplayState state && spriteQuery.TryGetComponent(player, out var playerSprite)) { diff --git a/Content.Client/Weapons/Misc/TetherGunSystem.cs b/Content.Client/Weapons/Misc/TetherGunSystem.cs index 634dbd24e7..398aeabb83 100644 --- a/Content.Client/Weapons/Misc/TetherGunSystem.cs +++ b/Content.Client/Weapons/Misc/TetherGunSystem.cs @@ -82,7 +82,7 @@ public sealed class TetherGunSystem : SharedTetherGunSystem const float BufferDistance = 0.1f; - if (TryComp(gun.TetherEntity, out var tetherXform) && + if (TryComp(gun.TetherEntity, out TransformComponent? tetherXform) && tetherXform.Coordinates.TryDistance(EntityManager, TransformSystem, coords, out var distance) && distance < BufferDistance) { diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Commands.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Commands.cs index f711b235af..5a41a7567b 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Commands.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Commands.cs @@ -165,7 +165,7 @@ public sealed partial class AtmosphereSystem foreach (var grid in _mapManager.GetAllGrids(playerMap.Value).OrderBy(o => o.Owner)) { var uid = grid.Owner; - if (!TryComp(uid, out var gridXform)) + if (!TryComp(uid, out TransformComponent? gridXform)) continue; options.Add(new CompletionOption(uid.ToString(), $"{MetaData(uid).EntityName} - Map {gridXform.MapID}")); diff --git a/Content.Server/Bible/BibleSystem.cs b/Content.Server/Bible/BibleSystem.cs index 0c60e40dac..2cb0ac1dd7 100644 --- a/Content.Server/Bible/BibleSystem.cs +++ b/Content.Server/Bible/BibleSystem.cs @@ -167,7 +167,7 @@ namespace Content.Server.Bible { Act = () => { - if (!TryComp(args.User, out var userXform)) + if (!TryComp(args.User, out TransformComponent? userXform)) return; AttemptSummon((uid, component), args.User, userXform); diff --git a/Content.Server/Engineering/EntitySystems/DisassembleOnAltVerbSystem.cs b/Content.Server/Engineering/EntitySystems/DisassembleOnAltVerbSystem.cs index 61b6f3d93d..d694f84a9c 100644 --- a/Content.Server/Engineering/EntitySystems/DisassembleOnAltVerbSystem.cs +++ b/Content.Server/Engineering/EntitySystems/DisassembleOnAltVerbSystem.cs @@ -56,7 +56,7 @@ namespace Content.Server.Engineering.EntitySystems if (component.Deleted || Deleted(uid)) return; - if (!TryComp(uid, out var transformComp)) + if (!TryComp(uid, out TransformComponent? transformComp)) return; var entity = EntityManager.SpawnEntity(component.Prototype, transformComp.Coordinates); diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs index 8e0a75ea24..7c6b5df7f1 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs @@ -166,7 +166,7 @@ namespace Content.Server.Explosion.EntitySystems private void HandleGibTrigger(EntityUid uid, GibOnTriggerComponent component, TriggerEvent args) { - if (!TryComp(uid, out var xform)) + if (!TryComp(uid, out TransformComponent? xform)) return; if (component.DeleteItems) { diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index e86dbca4a1..16d2d391f6 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -459,7 +459,7 @@ public sealed class FaxSystem : EntitySystem if (sendEntity == null) return; - if (!TryComp(sendEntity, out var metadata) || + if (!TryComp(sendEntity, out MetaDataComponent? metadata) || !TryComp(sendEntity, out var paper)) return; @@ -506,7 +506,7 @@ public sealed class FaxSystem : EntitySystem if (!component.KnownFaxes.TryGetValue(component.DestinationFaxAddress, out var faxName)) return; - if (!TryComp(sendEntity, out var metadata) || + if (!TryComp(sendEntity, out MetaDataComponent? metadata) || !TryComp(sendEntity, out var paper)) return; diff --git a/Content.Server/Gravity/GravityGeneratorSystem.cs b/Content.Server/Gravity/GravityGeneratorSystem.cs index 8e4da75fac..0b53df63fd 100644 --- a/Content.Server/Gravity/GravityGeneratorSystem.cs +++ b/Content.Server/Gravity/GravityGeneratorSystem.cs @@ -41,7 +41,7 @@ namespace Content.Server.Gravity private void OnComponentShutdown(EntityUid uid, GravityGeneratorComponent component, ComponentShutdown args) { if (component.GravityActive && - TryComp(uid, out var xform) && + TryComp(uid, out TransformComponent? xform) && TryComp(xform.ParentUid, out GravityComponent? gravity)) { component.GravityActive = false; @@ -114,7 +114,7 @@ namespace Content.Server.Gravity UpdateUI(ent, chargeRate); if (active != gravGen.GravityActive && - TryComp(uid, out var xform) && + TryComp(uid, out TransformComponent? xform) && TryComp(xform.ParentUid, out var gravity)) { // Force it on in the faster path. diff --git a/Content.Server/Medical/MedicalScannerSystem.cs b/Content.Server/Medical/MedicalScannerSystem.cs index 91184ddc16..b24690e204 100644 --- a/Content.Server/Medical/MedicalScannerSystem.cs +++ b/Content.Server/Medical/MedicalScannerSystem.cs @@ -86,7 +86,7 @@ namespace Content.Server.Medical return; var name = "Unknown"; - if (TryComp(args.Using.Value, out var metadata)) + if (TryComp(args.Using.Value, out MetaDataComponent? metadata)) name = metadata.EntityName; InteractionVerb verb = new() diff --git a/Content.Server/NPC/Pathfinding/PathfindingSystem.Distance.cs b/Content.Server/NPC/Pathfinding/PathfindingSystem.Distance.cs index 95d5c9c465..5daf38c420 100644 --- a/Content.Server/NPC/Pathfinding/PathfindingSystem.Distance.cs +++ b/Content.Server/NPC/Pathfinding/PathfindingSystem.Distance.cs @@ -30,8 +30,8 @@ public sealed partial class PathfindingSystem if (end.GraphUid != start.GraphUid) { - if (!TryComp(start.GraphUid, out var startXform) || - !TryComp(end.GraphUid, out var endXform)) + if (!TryComp(start.GraphUid, out TransformComponent? startXform) || + !TryComp(end.GraphUid, out TransformComponent? endXform)) { return Vector2.Zero; } diff --git a/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs b/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs index 6462c10fe5..52f7db77ed 100644 --- a/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs +++ b/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs @@ -261,7 +261,7 @@ public sealed partial class PathfindingSystem private void OnBodyTypeChange(ref PhysicsBodyTypeChangedEvent ev) { - if (TryComp(ev.Entity, out var xform) && + if (TryComp(ev.Entity, out TransformComponent? xform) && xform.GridUid != null) { var aabb = _lookup.GetAABBNoContainer(ev.Entity, xform.Coordinates.Position, xform.LocalRotation); diff --git a/Content.Server/NPC/Pathfinding/PathfindingSystem.cs b/Content.Server/NPC/Pathfinding/PathfindingSystem.cs index a59af88ff5..3672ad047b 100644 --- a/Content.Server/NPC/Pathfinding/PathfindingSystem.cs +++ b/Content.Server/NPC/Pathfinding/PathfindingSystem.cs @@ -264,7 +264,7 @@ namespace Content.Server.NPC.Pathfinding int limit = 40, PathFlags flags = PathFlags.None) { - if (!TryComp(entity, out var start)) + if (!TryComp(entity, out TransformComponent? start)) return new PathResultEvent(PathResult.NoPath, new List()); var layer = 0; @@ -294,7 +294,7 @@ namespace Content.Server.NPC.Pathfinding CancellationToken cancelToken, PathFlags flags = PathFlags.None) { - if (!TryComp(entity, out var start)) + if (!TryComp(entity, out TransformComponent? start)) return null; var request = GetRequest(entity, start.Coordinates, end, range, cancelToken, flags); @@ -325,8 +325,8 @@ namespace Content.Server.NPC.Pathfinding CancellationToken cancelToken, PathFlags flags = PathFlags.None) { - if (!TryComp(entity, out var xform) || - !TryComp(target, out var targetXform)) + if (!TryComp(entity, out TransformComponent? xform) || + !TryComp(target, out TransformComponent? targetXform)) return new PathResultEvent(PathResult.NoPath, new List()); var request = GetRequest(entity, xform.Coordinates, targetXform.Coordinates, range, cancelToken, flags); @@ -400,7 +400,7 @@ namespace Content.Server.NPC.Pathfinding var gridUid = coordinates.GetGridUid(EntityManager); if (!TryComp(gridUid, out var comp) || - !TryComp(gridUid, out var xform)) + !TryComp(gridUid, out TransformComponent? xform)) { return null; } diff --git a/Content.Server/NPC/Systems/NPCUtilitySystem.cs b/Content.Server/NPC/Systems/NPCUtilitySystem.cs index 4b0ccafa1d..2e8c628b50 100644 --- a/Content.Server/NPC/Systems/NPCUtilitySystem.cs +++ b/Content.Server/NPC/Systems/NPCUtilitySystem.cs @@ -260,8 +260,8 @@ public sealed class NPCUtilitySystem : EntitySystem { var radius = blackboard.GetValueOrDefault(NPCBlackboard.VisionRadius, EntityManager); - if (!TryComp(targetUid, out var targetXform) || - !TryComp(owner, out var xform)) + if (!TryComp(targetUid, out TransformComponent? targetXform) || + !TryComp(owner, out TransformComponent? xform)) { return 0f; } @@ -308,8 +308,8 @@ public sealed class NPCUtilitySystem : EntitySystem if (blackboard.TryGetValue("Target", out var currentTarget, EntityManager) && currentTarget == targetUid && - TryComp(owner, out var xform) && - TryComp(targetUid, out var targetXform) && + TryComp(owner, out TransformComponent? xform) && + TryComp(targetUid, out TransformComponent? targetXform) && xform.Coordinates.TryDistance(EntityManager, _transform, targetXform.Coordinates, out var distance) && distance <= radius + bufferRange) { diff --git a/Content.Server/PAI/PAISystem.cs b/Content.Server/PAI/PAISystem.cs index 091afb1557..0cdb0bc29a 100644 --- a/Content.Server/PAI/PAISystem.cs +++ b/Content.Server/PAI/PAISystem.cs @@ -111,7 +111,7 @@ public sealed class PAISystem : SharedPAISystem if (TryComp(uid, out var instrument)) _instrumentSystem.Clean(uid, instrument); - if (TryComp(uid, out var metadata)) + if (TryComp(uid, out MetaDataComponent? metadata)) { var proto = metadata.EntityPrototype; if (proto != null) diff --git a/Content.Server/Paper/PaperSystem.cs b/Content.Server/Paper/PaperSystem.cs index d10d04cfb9..4a7828c78c 100644 --- a/Content.Server/Paper/PaperSystem.cs +++ b/Content.Server/Paper/PaperSystem.cs @@ -148,7 +148,7 @@ namespace Content.Server.Paper if (TryComp(uid, out var appearance)) _appearance.SetData(uid, PaperVisuals.Status, PaperStatus.Written, appearance); - if (TryComp(uid, out var meta)) + if (TryComp(uid, out MetaDataComponent? meta)) _metaSystem.SetEntityDescription(uid, "", meta); _adminLogger.Add(LogType.Chat, LogImpact.Low, diff --git a/Content.Server/Physics/Controllers/MoverController.cs b/Content.Server/Physics/Controllers/MoverController.cs index 759b8ef29c..6edc202d15 100644 --- a/Content.Server/Physics/Controllers/MoverController.cs +++ b/Content.Server/Physics/Controllers/MoverController.cs @@ -271,7 +271,7 @@ namespace Content.Server.Physics.Controllers consoleEnt = cargoConsole.Entity; } - if (!TryComp(consoleEnt, out var xform)) continue; + if (!TryComp(consoleEnt, out TransformComponent? xform)) continue; var gridId = xform.GridUid; // This tries to see if the grid is a shuttle and if the console should work. diff --git a/Content.Server/Polymorph/Systems/PolymorphSystem.cs b/Content.Server/Polymorph/Systems/PolymorphSystem.cs index e6ba1d02af..d4a9159d44 100644 --- a/Content.Server/Polymorph/Systems/PolymorphSystem.cs +++ b/Content.Server/Polymorph/Systems/PolymorphSystem.cs @@ -248,7 +248,7 @@ public sealed partial class PolymorphSystem : EntitySystem } } - if (configuration.TransferName && TryComp(uid, out var targetMeta)) + if (configuration.TransferName && TryComp(uid, out MetaDataComponent? targetMeta)) _metaData.SetEntityName(child, targetMeta.EntityName); if (configuration.TransferHumanoidAppearance) diff --git a/Content.Server/Projectiles/ProjectileSystem.cs b/Content.Server/Projectiles/ProjectileSystem.cs index 0061b16e47..f8c8ef64b7 100644 --- a/Content.Server/Projectiles/ProjectileSystem.cs +++ b/Content.Server/Projectiles/ProjectileSystem.cs @@ -72,7 +72,7 @@ public sealed class ProjectileSystem : SharedProjectileSystem if (component.DeleteOnCollide) QueueDel(uid); - if (component.ImpactEffect != null && TryComp(uid, out var xform)) + if (component.ImpactEffect != null && TryComp(uid, out TransformComponent? xform)) { RaiseNetworkEvent(new ImpactEffectEvent(component.ImpactEffect, GetNetCoordinates(xform.Coordinates)), Filter.Pvs(xform.Coordinates, entityMan: EntityManager)); } diff --git a/Content.Server/Salvage/FultonSystem.cs b/Content.Server/Salvage/FultonSystem.cs index a24bab4584..ad998e5359 100644 --- a/Content.Server/Salvage/FultonSystem.cs +++ b/Content.Server/Salvage/FultonSystem.cs @@ -53,7 +53,7 @@ public sealed class FultonSystem : SharedFultonSystem private void Fulton(EntityUid uid, FultonedComponent component) { if (!Deleted(component.Beacon) && - TryComp(component.Beacon, out var beaconXform) && + TryComp(component.Beacon, out TransformComponent? beaconXform) && !Container.IsEntityOrParentInContainer(component.Beacon.Value, xform: beaconXform) && CanFulton(uid)) { diff --git a/Content.Server/Salvage/SalvageSystem.Runner.cs b/Content.Server/Salvage/SalvageSystem.Runner.cs index 23607e2bdc..161b791084 100644 --- a/Content.Server/Salvage/SalvageSystem.Runner.cs +++ b/Content.Server/Salvage/SalvageSystem.Runner.cs @@ -32,7 +32,7 @@ public sealed partial class SalvageSystem private void OnConsoleFTLAttempt(ref ConsoleFTLAttemptEvent ev) { - if (!TryComp(ev.Uid, out var xform) || + if (!TryComp(ev.Uid, out TransformComponent? xform) || !TryComp(xform.MapUid, out var salvage)) { return; diff --git a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs index 23f7e10a3e..e87e781e62 100644 --- a/Content.Server/Shuttles/Systems/ArrivalsSystem.cs +++ b/Content.Server/Shuttles/Systems/ArrivalsSystem.cs @@ -316,7 +316,7 @@ public sealed class ArrivalsSystem : EntitySystem TryGetArrivals(out var arrivals); - if (TryComp(arrivals, out var arrivalsXform)) + if (TryComp(arrivals, out TransformComponent? arrivalsXform)) { var mapId = arrivalsXform.MapID; @@ -413,7 +413,7 @@ public sealed class ArrivalsSystem : EntitySystem var curTime = _timing.CurTime; TryGetArrivals(out var arrivals); - if (TryComp(arrivals, out var arrivalsXform)) + if (TryComp(arrivals, out TransformComponent? arrivalsXform)) { while (query.MoveNext(out var uid, out var comp, out var shuttle, out var xform)) { diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs index 9bfe1bf986..2d8ae4b735 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs @@ -261,7 +261,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem if (!Resolve(stationUid, ref stationShuttle)) return; - if (!TryComp(stationShuttle.EmergencyShuttle, out var xform) || + if (!TryComp(stationShuttle.EmergencyShuttle, out TransformComponent? xform) || !TryComp(stationShuttle.EmergencyShuttle, out var shuttle)) { Log.Error($"Attempted to call an emergency shuttle for an uninitialized station? Station: {ToPrettyString(stationUid)}. Shuttle: {ToPrettyString(stationShuttle.EmergencyShuttle)}"); @@ -284,7 +284,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem if (_shuttle.TryFTLDock(stationShuttle.EmergencyShuttle.Value, shuttle, targetGrid.Value, DockTag)) { - if (TryComp(targetGrid.Value, out var targetXform)) + if (TryComp(targetGrid.Value, out TransformComponent? targetXform)) { var angle = _dock.GetAngle(stationShuttle.EmergencyShuttle.Value, xform, targetGrid.Value, targetXform, xformQuery); _chatSystem.DispatchStationAnnouncement(stationUid, Loc.GetString("emergency-shuttle-docked", ("time", $"{_consoleAccumulator:0}"), ("direction", angle.GetDir())), playDefaultSound: false); @@ -330,7 +330,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem return; // Post mapinit? fancy - if (TryComp(component.Entity, out var xform)) + if (TryComp(component.Entity, out TransformComponent? xform)) { component.MapEntity = xform.MapUid; return; diff --git a/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs index 89dc114caf..2b5769881d 100644 --- a/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs @@ -242,7 +242,7 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem RaiseLocalEvent(entity.Value, ref getShuttleEv); entity = getShuttleEv.Console; - TryComp(entity, out var consoleXform); + TryComp(entity, out TransformComponent? consoleXform); var shuttleGridUid = consoleXform?.GridUid; NavInterfaceState navState; diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs index c4cf2820e2..853548add3 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs @@ -184,7 +184,7 @@ public sealed partial class ShuttleSystem return; if (!TryComp(uid, out var dock) || - !TryComp(uid, out var xform) || + !TryComp(uid, out TransformComponent? xform) || xform.GridUid == null) { return; @@ -196,7 +196,7 @@ public sealed partial class ShuttleSystem if (_loader.TryLoad(mapId, component.Path.ToString(), out var ent) && ent.Count == 1 && - TryComp(ent[0], out var shuttleXform)) + TryComp(ent[0], out TransformComponent? shuttleXform)) { var escape = GetSingleDock(ent[0]); diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.IFF.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.IFF.cs index ce79466b58..ed5d109e85 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.IFF.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.IFF.cs @@ -16,7 +16,7 @@ public sealed partial class ShuttleSystem private void OnIFFShow(EntityUid uid, IFFConsoleComponent component, IFFShowIFFMessage args) { - if (!TryComp(uid, out var xform) || xform.GridUid == null || + if (!TryComp(uid, out TransformComponent? xform) || xform.GridUid == null || (component.AllowedFlags & IFFFlags.HideLabel) == 0x0) { return; @@ -34,7 +34,7 @@ public sealed partial class ShuttleSystem private void OnIFFShowVessel(EntityUid uid, IFFConsoleComponent component, IFFShowVesselMessage args) { - if (!TryComp(uid, out var xform) || xform.GridUid == null || + if (!TryComp(uid, out TransformComponent? xform) || xform.GridUid == null || (component.AllowedFlags & IFFFlags.Hide) == 0x0) { return; @@ -54,7 +54,7 @@ public sealed partial class ShuttleSystem { // If we anchor / re-anchor then make sure flags up to date. if (!args.Anchored || - !TryComp(uid, out var xform) || + !TryComp(uid, out TransformComponent? xform) || !TryComp(xform.GridUid, out var iff)) { _uiSystem.SetUiState(uid, IFFConsoleUiKey.Key, new IFFConsoleBoundUserInterfaceState() diff --git a/Content.Server/Spawners/EntitySystems/SpawnOnDespawnSystem.cs b/Content.Server/Spawners/EntitySystems/SpawnOnDespawnSystem.cs index 77927c9bba..f5a34728dc 100644 --- a/Content.Server/Spawners/EntitySystems/SpawnOnDespawnSystem.cs +++ b/Content.Server/Spawners/EntitySystems/SpawnOnDespawnSystem.cs @@ -14,7 +14,7 @@ public sealed class SpawnOnDespawnSystem : EntitySystem private void OnDespawn(EntityUid uid, SpawnOnDespawnComponent comp, ref TimedDespawnEvent args) { - if (!TryComp(uid, out var xform)) + if (!TryComp(uid, out TransformComponent? xform)) return; Spawn(comp.Prototype, xform.Coordinates); diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index 8b3431cb02..c82a749755 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -570,7 +570,7 @@ namespace Content.Shared.Interaction Ignored? predicate = null, bool popup = false) { - if (!TryComp(other, out var otherXform)) + if (!TryComp(other, out TransformComponent? otherXform)) return false; return InRangeUnobstructed(origin, other, otherXform.Coordinates, otherXform.LocalRotation, range, collisionMask, predicate, @@ -633,7 +633,7 @@ namespace Content.Shared.Interaction fixtureA.FixtureCount > 0 && TryComp(other, out var fixtureB) && fixtureB.FixtureCount > 0 && - TryComp(origin, out var xformA)) + TryComp(origin, out TransformComponent? xformA)) { var (worldPosA, worldRotA) = xformA.GetWorldPositionRotation(); var xfA = new Transform(worldPosA, worldRotA); diff --git a/Content.Shared/Movement/Systems/SharedJetpackSystem.cs b/Content.Shared/Movement/Systems/SharedJetpackSystem.cs index 8c42511f84..724eca682f 100644 --- a/Content.Shared/Movement/Systems/SharedJetpackSystem.cs +++ b/Content.Shared/Movement/Systems/SharedJetpackSystem.cs @@ -113,7 +113,7 @@ public abstract class SharedJetpackSystem : EntitySystem if (args.Handled) return; - if (TryComp(uid, out var xform) && !CanEnableOnGrid(xform.GridUid)) + if (TryComp(uid, out TransformComponent? xform) && !CanEnableOnGrid(xform.GridUid)) { _popup.PopupClient(Loc.GetString("jetpack-no-station"), uid, args.Performer); diff --git a/Content.Shared/Movement/Systems/SharedMoverController.Input.cs b/Content.Shared/Movement/Systems/SharedMoverController.Input.cs index ba175b345f..1ccb7f0c3f 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.Input.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.Input.cs @@ -313,7 +313,7 @@ namespace Content.Shared.Movement.Systems // For stuff like "Moving out of locker" or the likes // We'll relay a movement input to the parent. if (_container.IsEntityInContainer(entity) && - TryComp(entity, out var xform) && + TryComp(entity, out TransformComponent? xform) && xform.ParentUid.IsValid() && _mobState.IsAlive(entity)) { diff --git a/Content.Shared/Nutrition/EntitySystems/PressurizedSolutionSystem.cs b/Content.Shared/Nutrition/EntitySystems/PressurizedSolutionSystem.cs index d63b8e7326..82d90f4c92 100644 --- a/Content.Shared/Nutrition/EntitySystems/PressurizedSolutionSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/PressurizedSolutionSystem.cs @@ -179,7 +179,7 @@ public sealed partial class PressurizedSolutionSystem : EntitySystem var solution = _solutionContainer.SplitSolution(soln.Value, interactions.Volume); // Spray the solution onto the ground and anyone nearby - if (TryComp(entity, out var transform)) + if (TryComp(entity, out TransformComponent? transform)) _puddle.TrySplashSpillAt(entity, transform.Coordinates, solution, out _, sound: false); var drinkName = Identity.Entity(entity, EntityManager); diff --git a/Content.Shared/Nutrition/EntitySystems/SharedDrinkSystem.cs b/Content.Shared/Nutrition/EntitySystems/SharedDrinkSystem.cs index 7cae3b9208..bf1e585fab 100644 --- a/Content.Shared/Nutrition/EntitySystems/SharedDrinkSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/SharedDrinkSystem.cs @@ -81,7 +81,7 @@ public abstract partial class SharedDrinkSystem : EntitySystem { string remainingString = "drink-component-on-examine-is-half-full"; - if (TryComp(args.Examiner, out var examiner) && examiner.EntityName.Length > 0 + if (TryComp(args.Examiner, out MetaDataComponent? examiner) && examiner.EntityName.Length > 0 && string.Compare(examiner.EntityName.Substring(0, 1), "m", StringComparison.InvariantCultureIgnoreCase) > 0) remainingString = "drink-component-on-examine-is-half-empty"; diff --git a/Content.Shared/Random/RulesSystem.cs b/Content.Shared/Random/RulesSystem.cs index f8711fb63e..6b8a58abb7 100644 --- a/Content.Shared/Random/RulesSystem.cs +++ b/Content.Shared/Random/RulesSystem.cs @@ -26,7 +26,7 @@ public sealed class RulesSystem : EntitySystem break; case GridInRangeRule griddy: { - if (!TryComp(uid, out var xform)) + if (!TryComp(uid, out TransformComponent? xform)) { return false; } @@ -50,7 +50,7 @@ public sealed class RulesSystem : EntitySystem } case InSpaceRule: { - if (!TryComp(uid, out var xform) || + if (!TryComp(uid, out TransformComponent? xform) || xform.GridUid != null) { return false; @@ -146,7 +146,7 @@ public sealed class RulesSystem : EntitySystem } case NearbyEntitiesRule entity: { - if (!TryComp(uid, out var xform) || + if (!TryComp(uid, out TransformComponent? xform) || xform.MapUid == null) { return false; @@ -177,7 +177,7 @@ public sealed class RulesSystem : EntitySystem } case NearbyTilesPercentRule tiles: { - if (!TryComp(uid, out var xform) || + if (!TryComp(uid, out TransformComponent? xform) || !TryComp(xform.GridUid, out var grid)) { return false; @@ -227,7 +227,7 @@ public sealed class RulesSystem : EntitySystem } case OnMapGridRule: { - if (!TryComp(uid, out var xform) || + if (!TryComp(uid, out TransformComponent? xform) || xform.GridUid != xform.MapUid || xform.MapUid == null) { diff --git a/Content.Shared/Sound/SharedEmitSoundSystem.cs b/Content.Shared/Sound/SharedEmitSoundSystem.cs index a9a50698d7..0dcdc44c9f 100644 --- a/Content.Shared/Sound/SharedEmitSoundSystem.cs +++ b/Content.Shared/Sound/SharedEmitSoundSystem.cs @@ -72,7 +72,7 @@ public abstract class SharedEmitSoundSystem : EntitySystem private void OnEmitSoundOnLand(EntityUid uid, BaseEmitSoundComponent component, ref LandEvent args) { if (!args.PlaySound || - !TryComp(uid, out var xform) || + !TryComp(uid, out TransformComponent? xform) || !TryComp(xform.GridUid, out var grid)) { return; diff --git a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs index 4f0b760345..6dd7f9d418 100644 --- a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs @@ -463,7 +463,7 @@ public abstract class SharedStorageSystem : EntitySystem return; } - if (_xformQuery.TryGetComponent(uid, out var transformOwner) && TryComp(target, out var transformEnt)) + if (TryComp(uid, out TransformComponent? transformOwner) && TryComp(target, out TransformComponent? transformEnt)) { var parent = transformOwner.ParentUid; diff --git a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs index 6fa11f87d2..0fb6ac3eff 100644 --- a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs +++ b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs @@ -315,7 +315,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem public bool AttemptLightAttack(EntityUid user, EntityUid weaponUid, MeleeWeaponComponent weapon, EntityUid target) { - if (!TryComp(target, out var targetXform)) + if (!TryComp(target, out TransformComponent? targetXform)) return false; return AttemptAttack(user, weaponUid, weapon, new LightAttackEvent(GetNetEntity(target), GetNetEntity(weaponUid), GetNetCoordinates(targetXform.Coordinates)), null); @@ -323,7 +323,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem public bool AttemptDisarmAttack(EntityUid user, EntityUid weaponUid, MeleeWeaponComponent weapon, EntityUid target) { - if (!TryComp(target, out var targetXform)) + if (!TryComp(target, out TransformComponent? targetXform)) return false; return AttemptAttack(user, weaponUid, weapon, new DisarmAttackEvent(GetNetEntity(target), GetNetCoordinates(targetXform.Coordinates)), null); @@ -446,7 +446,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem // For consistency with wide attacks stuff needs damageable. if (Deleted(target) || !HasComp(target) || - !TryComp(target, out var targetXform) || + !TryComp(target, out TransformComponent? targetXform) || // Not in LOS. !InRange(user, target.Value, component.Range, session)) { @@ -534,7 +534,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem private bool DoHeavyAttack(EntityUid user, HeavyAttackEvent ev, EntityUid meleeUid, MeleeWeaponComponent component, ICommonSession? session) { // TODO: This is copy-paste as fuck with DoPreciseAttack - if (!TryComp(user, out var userXform)) + if (!TryComp(user, out TransformComponent? userXform)) return false; var targetMap = GetCoordinates(ev.Coordinates).ToMap(EntityManager, TransformSystem); @@ -748,7 +748,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem private void DoLungeAnimation(EntityUid user, EntityUid weapon, Angle angle, MapCoordinates coordinates, float length, string? animation) { // TODO: Assert that offset eyes are still okay. - if (!TryComp(user, out var userXform)) + if (!TryComp(user, out TransformComponent? userXform)) return; var invMatrix = TransformSystem.GetInvWorldMatrix(userXform);