From 75db49f9c0885c570b7f7c7c2ae61193914ae88a Mon Sep 17 00:00:00 2001 From: Tayrtahn Date: Thu, 26 Jun 2025 19:50:49 -0400 Subject: [PATCH] Clean up all missing `EntitySystem` proxy method uses (#38353) --- Content.Client/Actions/ActionsSystem.cs | 2 +- Content.Client/Audio/AmbientSoundSystem.cs | 2 +- .../Construction/ConstructionSystem.cs | 20 ++++++------- Content.Client/Examine/ExamineSystem.cs | 4 +-- .../Explosion/TriggerSystem.Proximity.cs | 2 +- Content.Client/Hands/Systems/HandsSystem.cs | 10 +++---- .../Humanoid/HumanoidAppearanceSystem.cs | 2 +- .../Inventory/ClientInventorySystem.cs | 8 ++--- .../EntitySystems/LightBehaviorSystem.cs | 12 ++++---- Content.Client/Markers/MarkerSystem.cs | 2 +- Content.Client/Orbit/OrbitVisualsSystem.cs | 2 +- Content.Client/Sandbox/SandboxSystem.cs | 2 +- Content.Client/Tabletop/TabletopSystem.cs | 4 +-- Content.Client/Verbs/VerbSystem.cs | 2 +- .../Weapons/Ranged/Systems/GunSystem.cs | 6 ++-- .../Tests/Disposal/DisposalUnitTest.cs | 2 +- .../Networking/SimplePredictReconcileTest.cs | 2 +- .../Access/Systems/AccessOverriderSystem.cs | 4 +-- .../Access/Systems/IdCardConsoleSystem.cs | 6 ++-- Content.Server/Access/Systems/IdCardSystem.cs | 4 +-- .../Administration/Systems/AdminSystem.cs | 2 +- .../Systems/AdminVerbSystem.Smites.cs | 4 +-- .../Systems/AdminVerbSystem.Tools.cs | 2 +- .../Administration/Systems/AdminVerbSystem.cs | 14 ++++----- .../Ame/EntitySystems/AmeControllerSystem.cs | 4 +-- .../Arcade/BlockGame/BlockGameArcadeSystem.cs | 2 +- .../SpaceVillainArcadeSystem.cs | 2 +- .../Consoles/AtmosMonitoringConsoleSystem.cs | 4 +-- .../Atmos/EntitySystems/AirtightSystem.cs | 2 +- .../AtmosphereSystem.Processing.cs | 8 ++--- .../Atmos/EntitySystems/FlammableSystem.cs | 2 +- .../Monitor/Systems/AtmosAlarmableSystem.cs | 2 +- .../Binary/EntitySystems/GasRecyclerSystem.cs | 2 +- .../EntitySystems/AtmosPipeColorSystem.cs | 6 ++-- .../AtmosUnsafeUnanchorSystem.cs | 4 +-- .../Trinary/EntitySystems/GasFilterSystem.cs | 4 +-- .../Trinary/EntitySystems/GasMixerSystem.cs | 6 ++-- .../Unary/EntitySystems/GasPortableSystem.cs | 4 +-- .../Unary/EntitySystems/GasVentPumpSystem.cs | 2 +- .../EntitySystems/GasVentScrubberSystem.cs | 2 +- Content.Server/Bible/BibleSystem.cs | 4 +-- .../Cargo/Systems/CargoSystem.Orders.cs | 2 +- .../Cartridges/NanoTaskCartridgeSystem.cs | 4 +-- Content.Server/Chat/SuicideSystem.cs | 4 +-- Content.Server/Chat/Systems/ChatSystem.cs | 2 +- .../DeleteOnSolutionEmptySystem.cs | 2 +- .../Chemistry/EntitySystems/InjectorSystem.cs | 8 ++--- .../Chemistry/EntitySystems/VaporSystem.cs | 8 ++--- Content.Server/Cloning/CloningPodSystem.cs | 12 ++++---- Content.Server/Cloning/CloningSystem.cs | 2 +- Content.Server/Codewords/CodewordSystem.cs | 2 +- .../ConstructionSystem.Computer.cs | 2 +- .../Construction/ConstructionSystem.Graph.cs | 4 +-- .../ConstructionSystem.Initial.cs | 6 ++-- .../Construction/ConstructionSystem.cs | 8 ++--- Content.Server/Crayon/CrayonSystem.cs | 4 +-- .../Systems/DamageOnToolInteractSystem.cs | 2 +- .../DeviceNetwork/Systems/ApcNetworkSystem.cs | 4 +-- .../Systems/Devices/ApcNetSwitchSystem.cs | 4 +-- .../Disposal/Tube/DisposalTubeSystem.cs | 2 +- .../Disposal/Unit/DisposableSystem.cs | 6 ++-- .../EntitySystems/SpawnAfterInteractSystem.cs | 4 +-- .../EntityEffects/EntityEffectSystem.cs | 20 ++++++------- Content.Server/Examine/ExamineSystem.cs | 2 +- .../EntitySystems/ExplosionSystem.Airtight.cs | 8 ++--- .../EntitySystems/ExplosionSystem.GridMap.cs | 2 +- .../EntitySystems/ExplosionSystem.cs | 2 +- .../EntitySystems/TriggerSystem.Proximity.cs | 4 +-- .../Explosion/EntitySystems/TriggerSystem.cs | 2 +- .../EntitySystems/TwoStageTriggerSystem.cs | 2 +- Content.Server/Fax/FaxSystem.cs | 2 +- .../Fluids/EntitySystems/DrainSystem.cs | 2 +- .../PuddleDebugDebugOverlaySystem.cs | 2 +- .../Fluids/EntitySystems/PuddleSystem.cs | 2 +- .../Systems/ForensicScannerSystem.cs | 4 +-- .../GameTicking/GameTicker.Spawning.cs | 4 +-- Content.Server/Ghost/GhostSystem.cs | 6 ++-- Content.Server/Ghost/Roles/GhostRoleSystem.cs | 4 +-- Content.Server/Hands/Systems/HandsSystem.cs | 4 +-- Content.Server/Holosign/HolosignSystem.cs | 2 +- .../Humanoid/Systems/RandomHumanoidSystem.cs | 4 +-- .../ImmovableRod/ImmovableRodSystem.cs | 4 +-- .../Instruments/InstrumentSystem.cs | 10 +++---- .../Kitchen/EntitySystems/MicrowaveSystem.cs | 4 +-- .../Kitchen/EntitySystems/SharpSystem.cs | 6 ++-- .../EntitySystems/ExpendableLightSystem.cs | 2 +- .../Light/EntitySystems/PoweredLightSystem.cs | 12 ++++---- .../MassMedia/Systems/NewsSystem.cs | 2 +- .../Mech/Systems/MechAssemblySystem.cs | 2 +- Content.Server/Medical/HealingSystem.cs | 4 +-- .../Medical/SuitSensors/SuitSensorSystem.cs | 4 +-- Content.Server/Morgue/CrematoriumSystem.cs | 4 +-- .../NPC/Systems/NPCSteeringSystem.cs | 2 +- .../Nutrition/EntitySystems/CreamPieSystem.cs | 6 ++-- .../EntitySystems/SmokingSystem.Cigar.cs | 6 ++-- .../SmokingSystem.SmokingPipe.cs | 6 ++-- .../EntitySystems/SmokingSystem.Vape.cs | 4 +-- .../TrashOnSolutionEmptySystem.cs | 2 +- .../Payload/EntitySystems/PayloadSystem.cs | 4 +-- .../Controllers/RandomWalkController.cs | 6 ++-- Content.Server/Pinpointer/PinpointerSystem.cs | 2 +- .../Pointing/EntitySystems/PointingSystem.cs | 4 +-- .../EntitySystems/RoguePointingSystem.cs | 4 +-- .../Power/EntitySystems/CableSystem.Placer.cs | 2 +- .../EntitySystems/ExtensionCableSystem.cs | 2 +- .../PowerMonitoringConsoleSystem.cs | 30 +++++++++---------- Content.Server/PowerSink/PowerSinkSystem.cs | 2 +- Content.Server/Prayer/PrayerSystem.cs | 4 +-- .../Procedural/DungeonSystem.Commands.cs | 2 +- .../Projectiles/ProjectileSystem.cs | 2 +- .../Systems/RadiationSystem.GridCast.cs | 2 +- Content.Server/Repairable/RepairableSystem.cs | 2 +- .../Research/Disk/ResearchDiskSystem.cs | 2 +- Content.Server/Rotatable/RotatableSystem.cs | 24 +++++++-------- .../Shuttles/Systems/DockingSystem.cs | 22 +++++++------- .../Shuttles/Systems/ShuttleConsoleSystem.cs | 8 ++--- .../Shuttles/Systems/ShuttleSystem.cs | 8 ++--- .../Shuttles/Systems/ThrusterSystem.cs | 18 +++++------ .../Silicons/StationAi/StationAiSystem.cs | 2 +- .../EntitySystems/EventHorizonSystem.cs | 6 ++-- .../EntitySystems/RadiationCollectorSystem.cs | 2 +- .../SingularityGeneratorSystem.cs | 8 ++--- .../EntitySystems/SingularitySystem.cs | 4 +-- .../Solar/EntitySystems/PowerSolarSystem.cs | 2 +- .../EntitySystems/ConditionalSpawnerSystem.cs | 6 ++-- Content.Server/Species/Systems/NymphSystem.cs | 2 +- .../EntitySystems/AddAccentClothingSystem.cs | 2 +- Content.Server/Spreader/KudzuSystem.cs | 4 +-- .../Station/Systems/StationSpawningSystem.cs | 2 +- .../StationEvents/Events/VentClogRule.cs | 2 +- .../EntitySystems/BluespaceLockerSystem.cs | 4 +-- .../EntitySystems/ItemCounterSystem.cs | 2 +- .../EntitySystems/SpawnItemsOnUseSystem.cs | 4 +-- .../Store/Systems/StoreSystem.Ui.cs | 2 +- .../Stunnable/Systems/StunOnCollideSystem.cs | 2 +- .../SurveillanceCameraMonitorSystem.cs | 4 +-- Content.Server/Tabletop/TabletopSystem.Map.cs | 2 +- .../Tabletop/TabletopSystem.Session.cs | 16 +++++----- Content.Server/Tabletop/TabletopSystem.cs | 10 +++---- Content.Server/Telephone/TelephoneSystem.cs | 2 +- Content.Server/Traits/TraitSystem.cs | 2 +- Content.Server/Verbs/VerbSystem.cs | 2 +- Content.Server/Wires/WiresSystem.cs | 4 +-- .../Access/Systems/IdExaminableSystem.cs | 4 +-- Content.Shared/Actions/ActionUpgradeSystem.cs | 4 +-- Content.Shared/Alert/AlertsSystem.cs | 14 ++++----- Content.Shared/Animals/UdderSystem.cs | 4 +-- Content.Shared/Animals/WoolySystem.cs | 2 +- .../Cryostorage/SharedCryostorageSystem.cs | 2 +- .../EntitySystems/HypospraySystem.cs | 2 +- .../SharedSolutionContainerSystem.cs | 6 ++-- .../MetabolismMovespeedModifierSystem.cs | 2 +- .../EntitySystems/AnchorableSystem.cs | 4 +-- .../Containers/ContainerFillSystem.cs | 4 +-- .../Containers/ItemSlot/ItemSlotsSystem.cs | 8 ++--- Content.Shared/Cuffs/SharedCuffableSystem.cs | 2 +- .../Systems/DamageOnHighSpeedImpactSystem.cs | 2 +- .../Damage/Systems/SlowOnDamageSystem.cs | 2 +- .../Mailing/SharedMailingUnitSystem.cs | 2 +- Content.Shared/Examine/ExamineSystemShared.cs | 2 +- Content.Shared/Gravity/SharedGravitySystem.cs | 2 +- .../Implants/SharedImplanterSystem.cs | 2 +- .../Inventory/InventorySystem.Helpers.cs | 4 +-- .../Jittering/SharedJitteringSystem.cs | 4 +-- Content.Shared/Magic/SharedMagicSystem.cs | 2 +- .../Movement/Pulling/Systems/PullingSystem.cs | 4 +-- .../Systems/FrictionContactsSystem.cs | 2 +- .../Systems/SpeedModifierContactsSystem.cs | 2 +- .../EntitySystems/SharedCreamPieSystem.cs | 4 +-- .../Nutrition/EntitySystems/UtensilSystem.cs | 4 +-- Content.Shared/Paper/PaperSystem.cs | 2 +- Content.Shared/RCD/Systems/RCDSystem.cs | 4 +-- .../EntitySystems/SharedEventHorizonSystem.cs | 2 +- .../Station/SharedStationSpawningSystem.cs | 4 +-- .../StatusEffect/StatusEffectsSystem.cs | 8 ++--- .../EntitySystems/SharedItemCounterSystem.cs | 4 +-- .../EntitySystems/SharedItemMapperSystem.cs | 4 +-- .../SubFloor/SharedSubFloorHideSystem.cs | 4 +-- .../Tabletop/SharedTabletopSystem.cs | 2 +- Content.Shared/Throwing/ThrownItemSystem.cs | 6 ++-- .../Systems/SharedToolSystem.MultipleTool.cs | 2 +- .../Weapons/Melee/SharedMeleeWeaponSystem.cs | 2 +- .../Systems/SharedGunSystem.Revolver.cs | 2 +- .../Weapons/Ranged/Systems/SharedGunSystem.cs | 10 +++---- .../Artifact/XAE/XAEApplyComponentsSystem.cs | 6 ++-- 185 files changed, 418 insertions(+), 418 deletions(-) diff --git a/Content.Client/Actions/ActionsSystem.cs b/Content.Client/Actions/ActionsSystem.cs index 23ff23997f..3bfacb5bc6 100644 --- a/Content.Client/Actions/ActionsSystem.cs +++ b/Content.Client/Actions/ActionsSystem.cs @@ -211,7 +211,7 @@ namespace Content.Client.Actions else { var request = new RequestPerformActionEvent(GetNetEntity(action)); - EntityManager.RaisePredictiveEvent(request); + RaisePredictiveEvent(request); } } diff --git a/Content.Client/Audio/AmbientSoundSystem.cs b/Content.Client/Audio/AmbientSoundSystem.cs index b525747aa9..e6ea94c3a6 100644 --- a/Content.Client/Audio/AmbientSoundSystem.cs +++ b/Content.Client/Audio/AmbientSoundSystem.cs @@ -168,7 +168,7 @@ public sealed class AmbientSoundSystem : SharedAmbientSoundSystem _targetTime = _gameTiming.CurTime + TimeSpan.FromSeconds(_cooldown); var player = _playerManager.LocalEntity; - if (!EntityManager.TryGetComponent(player, out TransformComponent? xform)) + if (!TryComp(player, out TransformComponent? xform)) { ClearSounds(); return; diff --git a/Content.Client/Construction/ConstructionSystem.cs b/Content.Client/Construction/ConstructionSystem.cs index 24d339dfce..0e7557724f 100644 --- a/Content.Client/Construction/ConstructionSystem.cs +++ b/Content.Client/Construction/ConstructionSystem.cs @@ -286,14 +286,14 @@ namespace Content.Client.Construction if (!CheckConstructionConditions(prototype, loc, dir, user, showPopup: true)) return false; - ghost = EntityManager.SpawnEntity("constructionghost", loc); - var comp = EntityManager.GetComponent(ghost.Value); + ghost = Spawn("constructionghost", loc); + var comp = Comp(ghost.Value); comp.Prototype = prototype; comp.GhostId = ghost.GetHashCode(); - EntityManager.GetComponent(ghost.Value).LocalRotation = dir.ToAngle(); + Comp(ghost.Value).LocalRotation = dir.ToAngle(); _ghosts.Add(comp.GhostId, ghost.Value); - var sprite = EntityManager.GetComponent(ghost.Value); + var sprite = Comp(ghost.Value); _sprite.SetColor((ghost.Value, sprite), new Color(48, 255, 48, 128)); if (targetProto.TryGetComponent(out IconComponent? icon, EntityManager.ComponentFactory)) @@ -306,7 +306,7 @@ namespace Content.Client.Construction else if (targetProto.Components.TryGetValue("Sprite", out _)) { var dummy = EntityManager.SpawnEntity(targetProtoId, MapCoordinates.Nullspace); - var targetSprite = EntityManager.EnsureComponent(dummy); + var targetSprite = EnsureComp(dummy); EntityManager.System().OnChangeData(dummy, targetSprite); for (var i = 0; i < targetSprite.AllLayers.Count(); i++) @@ -325,7 +325,7 @@ namespace Content.Client.Construction _sprite.LayerSetVisible((ghost.Value, sprite), i, true); } - EntityManager.DeleteEntity(dummy); + Del(dummy); } else return false; @@ -367,7 +367,7 @@ namespace Content.Client.Construction { foreach (var ghost in _ghosts) { - if (EntityManager.GetComponent(ghost.Value).Coordinates.Equals(loc)) + if (Comp(ghost.Value).Coordinates.Equals(loc)) return true; } @@ -384,7 +384,7 @@ namespace Content.Client.Construction throw new ArgumentException($"Can't start construction for a ghost with no prototype. Ghost id: {ghostId}"); } - var transform = EntityManager.GetComponent(ghostId); + var transform = Comp(ghostId); var msg = new TryStartStructureConstructionMessage(GetNetCoordinates(transform.Coordinates), ghostComp.Prototype.ID, transform.LocalRotation, ghostId.GetHashCode()); RaiseNetworkEvent(msg); } @@ -405,7 +405,7 @@ namespace Content.Client.Construction if (!_ghosts.TryGetValue(ghostId, out var ghost)) return; - EntityManager.QueueDeleteEntity(ghost); + QueueDel(ghost); _ghosts.Remove(ghostId); } @@ -416,7 +416,7 @@ namespace Content.Client.Construction { foreach (var ghost in _ghosts.Values) { - EntityManager.QueueDeleteEntity(ghost); + QueueDel(ghost); } _ghosts.Clear(); diff --git a/Content.Client/Examine/ExamineSystem.cs b/Content.Client/Examine/ExamineSystem.cs index 9f0496e578..0385672977 100644 --- a/Content.Client/Examine/ExamineSystem.cs +++ b/Content.Client/Examine/ExamineSystem.cs @@ -110,7 +110,7 @@ namespace Content.Client.Examine { var entity = args.EntityUid; - if (!args.EntityUid.IsValid() || !EntityManager.EntityExists(entity)) + if (!args.EntityUid.IsValid() || !Exists(entity)) { return false; } @@ -225,7 +225,7 @@ namespace Content.Client.Examine vBox.AddChild(hBox); - if (EntityManager.HasComponent(target)) + if (HasComp(target)) { var spriteView = new SpriteView { diff --git a/Content.Client/Explosion/TriggerSystem.Proximity.cs b/Content.Client/Explosion/TriggerSystem.Proximity.cs index d49f483664..03e7436971 100644 --- a/Content.Client/Explosion/TriggerSystem.Proximity.cs +++ b/Content.Client/Explosion/TriggerSystem.Proximity.cs @@ -61,7 +61,7 @@ public sealed partial class TriggerSystem private void OnProximityInit(EntityUid uid, TriggerOnProximityComponent component, ComponentInit args) { - EntityManager.EnsureComponent(uid); + EnsureComp(uid); } private void OnProxAppChange(EntityUid uid, TriggerOnProximityComponent component, ref AppearanceChangeEvent args) diff --git a/Content.Client/Hands/Systems/HandsSystem.cs b/Content.Client/Hands/Systems/HandsSystem.cs index 37bc9b1232..2613313585 100644 --- a/Content.Client/Hands/Systems/HandsSystem.cs +++ b/Content.Client/Hands/Systems/HandsSystem.cs @@ -135,28 +135,28 @@ namespace Content.Client.Hands.Systems { // use item in hand // it will always be attack_self() in my heart. - EntityManager.RaisePredictiveEvent(new RequestUseInHandEvent()); + RaisePredictiveEvent(new RequestUseInHandEvent()); return; } if (handName != hands.ActiveHandId && pressedEntity == null) { // change active hand - EntityManager.RaisePredictiveEvent(new RequestSetHandEvent(handName)); + RaisePredictiveEvent(new RequestSetHandEvent(handName)); return; } if (handName != hands.ActiveHandId && pressedEntity != null && activeEntity != null) { // use active item on held item - EntityManager.RaisePredictiveEvent(new RequestHandInteractUsingEvent(handName)); + RaisePredictiveEvent(new RequestHandInteractUsingEvent(handName)); return; } if (handName != hands.ActiveHandId && pressedEntity != null && activeEntity == null) { // move the item to the active hand - EntityManager.RaisePredictiveEvent(new RequestMoveHandItemEvent(handName)); + RaisePredictiveEvent(new RequestMoveHandItemEvent(handName)); } } @@ -166,7 +166,7 @@ namespace Content.Client.Hands.Systems /// public void UIHandActivate(string handName) { - EntityManager.RaisePredictiveEvent(new RequestActivateInHandEvent(handName)); + RaisePredictiveEvent(new RequestActivateInHandEvent(handName)); } public void UIInventoryExamine(string handName) diff --git a/Content.Client/Humanoid/HumanoidAppearanceSystem.cs b/Content.Client/Humanoid/HumanoidAppearanceSystem.cs index d9897c56e2..6700cf2a18 100644 --- a/Content.Client/Humanoid/HumanoidAppearanceSystem.cs +++ b/Content.Client/Humanoid/HumanoidAppearanceSystem.cs @@ -36,7 +36,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem private void OnCvarChanged(bool value) { - var humanoidQuery = EntityManager.AllEntityQueryEnumerator(); + var humanoidQuery = AllEntityQuery(); while (humanoidQuery.MoveNext(out var uid, out var humanoidComp, out var spriteComp)) { UpdateSprite((uid, humanoidComp, spriteComp)); diff --git a/Content.Client/Inventory/ClientInventorySystem.cs b/Content.Client/Inventory/ClientInventorySystem.cs index dce401eefd..de58077e44 100644 --- a/Content.Client/Inventory/ClientInventorySystem.cs +++ b/Content.Client/Inventory/ClientInventorySystem.cs @@ -194,12 +194,12 @@ namespace Content.Client.Inventory public void UIInventoryActivate(string slot) { - EntityManager.RaisePredictiveEvent(new UseSlotNetworkMessage(slot)); + RaisePredictiveEvent(new UseSlotNetworkMessage(slot)); } public void UIInventoryStorageActivate(string slot) { - EntityManager.RaisePredictiveEvent(new OpenSlotStorageNetworkMessage(slot)); + RaisePredictiveEvent(new OpenSlotStorageNetworkMessage(slot)); } public void UIInventoryExamine(string slot, EntityUid uid) @@ -223,7 +223,7 @@ namespace Content.Client.Inventory if (!TryGetSlotEntity(uid, slot, out var item)) return; - EntityManager.RaisePredictiveEvent( + RaisePredictiveEvent( new InteractInventorySlotEvent(GetNetEntity(item.Value), altInteract: false)); } @@ -232,7 +232,7 @@ namespace Content.Client.Inventory if (!TryGetSlotEntity(uid, slot, out var item)) return; - EntityManager.RaisePredictiveEvent(new InteractInventorySlotEvent(GetNetEntity(item.Value), altInteract: true)); + RaisePredictiveEvent(new InteractInventorySlotEvent(GetNetEntity(item.Value), altInteract: true)); } protected override void UpdateInventoryTemplate(Entity ent) diff --git a/Content.Client/Light/EntitySystems/LightBehaviorSystem.cs b/Content.Client/Light/EntitySystems/LightBehaviorSystem.cs index 5b823946f7..d4eaad3882 100644 --- a/Content.Client/Light/EntitySystems/LightBehaviorSystem.cs +++ b/Content.Client/Light/EntitySystems/LightBehaviorSystem.cs @@ -63,7 +63,7 @@ public sealed class LightBehaviorSystem : EntitySystem /// private void CopyLightSettings(Entity entity, string property) { - if (EntityManager.TryGetComponent(entity, out PointLightComponent? light)) + if (TryComp(entity, out PointLightComponent? light)) { var propertyValue = AnimationHelper.GetAnimatableProperty(light, property); if (propertyValue != null) @@ -73,7 +73,7 @@ public sealed class LightBehaviorSystem : EntitySystem } else { - Log.Warning($"{EntityManager.GetComponent(entity).EntityName} has a {nameof(LightBehaviourComponent)} but it has no {nameof(PointLightComponent)}! Check the prototype!"); + Log.Warning($"{Comp(entity).EntityName} has a {nameof(LightBehaviourComponent)} but it has no {nameof(PointLightComponent)}! Check the prototype!"); } } @@ -84,7 +84,7 @@ public sealed class LightBehaviorSystem : EntitySystem /// public void StartLightBehaviour(Entity entity, string id = "") { - if (!EntityManager.TryGetComponent(entity, out AnimationPlayerComponent? animation)) + if (!TryComp(entity, out AnimationPlayerComponent? animation)) { return; } @@ -113,7 +113,7 @@ public sealed class LightBehaviorSystem : EntitySystem /// Should the light have its original settings applied? public void StopLightBehaviour(Entity entity, string id = "", bool removeBehaviour = false, bool resetToOriginalSettings = false) { - if (!EntityManager.TryGetComponent(entity, out AnimationPlayerComponent? animation)) + if (!TryComp(entity, out AnimationPlayerComponent? animation)) { return; } @@ -143,7 +143,7 @@ public sealed class LightBehaviorSystem : EntitySystem comp.Animations.Remove(container); } - if (resetToOriginalSettings && EntityManager.TryGetComponent(entity, out PointLightComponent? light)) + if (resetToOriginalSettings && TryComp(entity, out PointLightComponent? light)) { foreach (var (property, value) in comp.OriginalPropertyValues) { @@ -161,7 +161,7 @@ public sealed class LightBehaviorSystem : EntitySystem public bool HasRunningBehaviours(Entity entity) { //var uid = Owner; - if (!EntityManager.TryGetComponent(entity, out AnimationPlayerComponent? animation)) + if (!TryComp(entity, out AnimationPlayerComponent? animation)) { return false; } diff --git a/Content.Client/Markers/MarkerSystem.cs b/Content.Client/Markers/MarkerSystem.cs index 2ff567e69e..37888d16c2 100644 --- a/Content.Client/Markers/MarkerSystem.cs +++ b/Content.Client/Markers/MarkerSystem.cs @@ -33,7 +33,7 @@ public sealed class MarkerSystem : EntitySystem private void UpdateVisibility(EntityUid uid) { - if (EntityManager.TryGetComponent(uid, out SpriteComponent? sprite)) + if (TryComp(uid, out SpriteComponent? sprite)) { _sprite.SetVisible((uid, sprite), MarkersVisible); } diff --git a/Content.Client/Orbit/OrbitVisualsSystem.cs b/Content.Client/Orbit/OrbitVisualsSystem.cs index 9824ccac29..144c489a54 100644 --- a/Content.Client/Orbit/OrbitVisualsSystem.cs +++ b/Content.Client/Orbit/OrbitVisualsSystem.cs @@ -64,7 +64,7 @@ public sealed class OrbitVisualsSystem : EntitySystem { base.FrameUpdate(frameTime); - var query = EntityManager.EntityQueryEnumerator(); + var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var orbit, out var sprite)) { var progress = (float)(_timing.CurTime.TotalSeconds / orbit.OrbitLength) % 1; diff --git a/Content.Client/Sandbox/SandboxSystem.cs b/Content.Client/Sandbox/SandboxSystem.cs index abc717642c..99a84fa23b 100644 --- a/Content.Client/Sandbox/SandboxSystem.cs +++ b/Content.Client/Sandbox/SandboxSystem.cs @@ -90,7 +90,7 @@ namespace Content.Client.Sandbox // Try copy entity. if (uid.IsValid() - && EntityManager.TryGetComponent(uid, out MetaDataComponent? comp) + && TryComp(uid, out MetaDataComponent? comp) && !comp.EntityDeleted) { if (comp.EntityPrototype == null || comp.EntityPrototype.HideSpawnMenu || comp.EntityPrototype.Abstract) diff --git a/Content.Client/Tabletop/TabletopSystem.cs b/Content.Client/Tabletop/TabletopSystem.cs index f83b0e0bd0..25d5907b05 100644 --- a/Content.Client/Tabletop/TabletopSystem.cs +++ b/Content.Client/Tabletop/TabletopSystem.cs @@ -131,7 +131,7 @@ namespace Content.Client.Tabletop // Get the camera entity that the server has created for us var camera = GetEntity(msg.CameraUid); - if (!EntityManager.TryGetComponent(camera, out var eyeComponent)) + if (!TryComp(camera, out var eyeComponent)) { // If there is no eye, print error and do not open any window Log.Error("Camera entity does not have eye component!"); @@ -258,7 +258,7 @@ namespace Content.Client.Tabletop private void StopDragging(bool broadcast = true) { // Set the dragging player on the component to noone - if (broadcast && _draggedEntity != null && EntityManager.HasComponent(_draggedEntity.Value)) + if (broadcast && _draggedEntity != null && HasComp(_draggedEntity.Value)) { RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transforms.GetMapCoordinates(_draggedEntity.Value), GetNetEntity(_table!.Value))); RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(_draggedEntity.Value), false)); diff --git a/Content.Client/Verbs/VerbSystem.cs b/Content.Client/Verbs/VerbSystem.cs index 92596f9dc0..77b8531888 100644 --- a/Content.Client/Verbs/VerbSystem.cs +++ b/Content.Client/Verbs/VerbSystem.cs @@ -225,7 +225,7 @@ namespace Content.Client.Verbs // is this a client exclusive (gui) verb? ExecuteVerb(verb, user, GetEntity(target)); else - EntityManager.RaisePredictiveEvent(new ExecuteVerbEvent(target, verb)); + RaisePredictiveEvent(new ExecuteVerbEvent(target, verb)); } private void HandleVerbResponse(VerbsResponseEvent msg) diff --git a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs index de2f4e42b1..dd26effb33 100644 --- a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs @@ -178,7 +178,7 @@ public sealed partial class GunSystem : SharedGunSystem if (_inputSystem.CmdStates.GetState(useKey) != BoundKeyState.Down && !gun.BurstActivated) { if (gun.ShotCounter != 0) - EntityManager.RaisePredictiveEvent(new RequestStopShootEvent { Gun = GetNetEntity(gunUid) }); + RaisePredictiveEvent(new RequestStopShootEvent { Gun = GetNetEntity(gunUid) }); return; } @@ -190,7 +190,7 @@ public sealed partial class GunSystem : SharedGunSystem if (mousePos.MapId == MapId.Nullspace) { if (gun.ShotCounter != 0) - EntityManager.RaisePredictiveEvent(new RequestStopShootEvent { Gun = GetNetEntity(gunUid) }); + RaisePredictiveEvent(new RequestStopShootEvent { Gun = GetNetEntity(gunUid) }); return; } @@ -204,7 +204,7 @@ public sealed partial class GunSystem : SharedGunSystem Log.Debug($"Sending shoot request tick {Timing.CurTick} / {Timing.CurTime}"); - EntityManager.RaisePredictiveEvent(new RequestShootEvent + RaisePredictiveEvent(new RequestShootEvent { Target = target, Coordinates = GetNetCoordinates(coordinates), diff --git a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs index 8cfe8fbfcd..52b669b09d 100644 --- a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs +++ b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs @@ -28,7 +28,7 @@ namespace Content.IntegrationTests.Tests.Disposal SubscribeLocalEvent(ev => { var (_, toInsert, unit) = ev; - var insertTransform = EntityManager.GetComponent(toInsert); + var insertTransform = Comp(toInsert); // Not in a tube yet Assert.That(insertTransform.ParentUid, Is.EqualTo(unit)); }, after: new[] { typeof(SharedDisposalUnitSystem) }); diff --git a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs index 29f2573c2d..3e49499845 100644 --- a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs +++ b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs @@ -410,7 +410,7 @@ namespace Content.IntegrationTests.Tests.Networking { var uid = GetEntity(message.Uid); - var component = EntityManager.GetComponent(uid); + var component = Comp(uid); var old = component.Foo; if (Allow) { diff --git a/Content.Server/Access/Systems/AccessOverriderSystem.cs b/Content.Server/Access/Systems/AccessOverriderSystem.cs index 51d35c50a4..68bdd6b9a9 100644 --- a/Content.Server/Access/Systems/AccessOverriderSystem.cs +++ b/Content.Server/Access/Systems/AccessOverriderSystem.cs @@ -113,7 +113,7 @@ public sealed class AccessOverriderSystem : SharedAccessOverriderSystem if (component.TargetAccessReaderId is { Valid: true } accessReader) { - targetLabel = Loc.GetString("access-overrider-window-target-label") + " " + EntityManager.GetComponent(component.TargetAccessReaderId).EntityName; + targetLabel = Loc.GetString("access-overrider-window-target-label") + " " + Comp(component.TargetAccessReaderId).EntityName; targetLabelColor = Color.White; if (!_accessReader.GetMainAccessReader(accessReader, out var accessReaderEnt)) @@ -125,7 +125,7 @@ public sealed class AccessOverriderSystem : SharedAccessOverriderSystem if (component.PrivilegedIdSlot.Item is { Valid: true } idCard) { - privilegedIdName = EntityManager.GetComponent(idCard).EntityName; + privilegedIdName = Comp(idCard).EntityName; if (component.TargetAccessReaderId is { Valid: true }) { diff --git a/Content.Server/Access/Systems/IdCardConsoleSystem.cs b/Content.Server/Access/Systems/IdCardConsoleSystem.cs index 9fd30ffcb1..62dfddbb58 100644 --- a/Content.Server/Access/Systems/IdCardConsoleSystem.cs +++ b/Content.Server/Access/Systems/IdCardConsoleSystem.cs @@ -73,7 +73,7 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem List>? possibleAccess = null; if (component.PrivilegedIdSlot.Item is { Valid: true } item) { - privilegedIdName = EntityManager.GetComponent(item).EntityName; + privilegedIdName = Comp(item).EntityName; possibleAccess = _accessReader.FindAccessTags(item).ToList(); } @@ -95,8 +95,8 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem } else { - var targetIdComponent = EntityManager.GetComponent(targetId); - var targetAccessComponent = EntityManager.GetComponent(targetId); + var targetIdComponent = Comp(targetId); + var targetAccessComponent = Comp(targetId); var jobProto = targetIdComponent.JobPrototype ?? new ProtoId(string.Empty); if (TryComp(targetId, out var keyStorage) diff --git a/Content.Server/Access/Systems/IdCardSystem.cs b/Content.Server/Access/Systems/IdCardSystem.cs index 05ee45b463..0fef62d970 100644 --- a/Content.Server/Access/Systems/IdCardSystem.cs +++ b/Content.Server/Access/Systems/IdCardSystem.cs @@ -47,12 +47,12 @@ public sealed class IdCardSystem : SharedIdCardSystem { _popupSystem.PopupCoordinates(Loc.GetString("id-card-component-microwave-burnt", ("id", uid)), transformComponent.Coordinates, PopupType.Medium); - EntityManager.SpawnEntity("FoodBadRecipe", + Spawn("FoodBadRecipe", transformComponent.Coordinates); } _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(args.Microwave)} burnt {ToPrettyString(uid):entity}"); - EntityManager.QueueDeleteEntity(uid); + QueueDel(uid); return; } diff --git a/Content.Server/Administration/Systems/AdminSystem.cs b/Content.Server/Administration/Systems/AdminSystem.cs index 95c6578a94..56bbc225cc 100644 --- a/Content.Server/Administration/Systems/AdminSystem.cs +++ b/Content.Server/Administration/Systems/AdminSystem.cs @@ -224,7 +224,7 @@ public sealed class AdminSystem : EntitySystem // Visible (identity) name can be different from real name if (session?.AttachedEntity != null) { - entityName = EntityManager.GetComponent(session.AttachedEntity.Value).EntityName; + entityName = Comp(session.AttachedEntity.Value).EntityName; identityName = Identity.Name(session.AttachedEntity.Value, EntityManager); } diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs b/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs index 1ae0543073..442c768709 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs @@ -83,7 +83,7 @@ public sealed partial class AdminVerbSystem // All smite verbs have names so invokeverb works. private void AddSmiteVerbs(GetVerbsEvent args) { - if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) + if (!TryComp(args.User, out ActorComponent? actor)) return; var player = actor.PlayerSession; @@ -622,7 +622,7 @@ public sealed partial class AdminVerbSystem Icon = new SpriteSpecifier.Rsi(new ("/Textures/Objects/Materials/materials.rsi"), "ash"), Act = () => { - EntityManager.QueueDeleteEntity(args.Target); + QueueDel(args.Target); Spawn("Ash", Transform(args.Target).Coordinates); _popupSystem.PopupEntity(Loc.GetString("admin-smite-turned-ash-other", ("name", args.Target)), args.Target, PopupType.LargeCaution); }, diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs b/Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs index 22a1ccadc9..6e88d59be6 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs @@ -58,7 +58,7 @@ public sealed partial class AdminVerbSystem private void AddTricksVerbs(GetVerbsEvent args) { - if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) + if (!TryComp(args.User, out ActorComponent? actor)) return; var player = actor.PlayerSession; diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.cs b/Content.Server/Administration/Systems/AdminVerbSystem.cs index 15ec7da467..b5ddc4bb19 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.cs @@ -88,7 +88,7 @@ namespace Content.Server.Administration.Systems private void AddAdminVerbs(GetVerbsEvent args) { - if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) + if (!TryComp(args.User, out ActorComponent? actor)) return; var player = actor.PlayerSession; @@ -395,7 +395,7 @@ namespace Content.Server.Administration.Systems private void AddDebugVerbs(GetVerbsEvent args) { - if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) + if (!TryComp(args.User, out ActorComponent? actor)) return; var player = actor.PlayerSession; @@ -408,7 +408,7 @@ namespace Content.Server.Administration.Systems Text = Loc.GetString("delete-verb-get-data-text"), Category = VerbCategory.Debug, Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/delete_transparent.svg.192dpi.png")), - Act = () => EntityManager.DeleteEntity(args.Target), + Act = () => Del(args.Target), Impact = LogImpact.Medium, ConfirmationPopup = true }; @@ -451,7 +451,7 @@ namespace Content.Server.Administration.Systems // Make Sentient verb if (_groupController.CanCommand(player, "makesentient") && args.User != args.Target && - !EntityManager.HasComponent(args.Target)) + !HasComp(args.Target)) { Verb verb = new() { @@ -517,7 +517,7 @@ namespace Content.Server.Administration.Systems // Get Disposal tube direction verb if (_groupController.CanCommand(player, "tubeconnections") && - EntityManager.TryGetComponent(args.Target, out DisposalTubeComponent? tube)) + TryComp(args.Target, out DisposalTubeComponent? tube)) { Verb verb = new() { @@ -544,7 +544,7 @@ namespace Content.Server.Administration.Systems } if (_groupController.CanAdminMenu(player) && - EntityManager.TryGetComponent(args.Target, out ConfigurationComponent? config)) + TryComp(args.Target, out ConfigurationComponent? config)) { Verb verb = new() { @@ -558,7 +558,7 @@ namespace Content.Server.Administration.Systems // Add verb to open Solution Editor if (_groupController.CanCommand(player, "addreagent") && - EntityManager.HasComponent(args.Target)) + HasComp(args.Target)) { Verb verb = new() { diff --git a/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs b/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs index a2e25f269a..4276eafd60 100644 --- a/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs +++ b/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs @@ -246,7 +246,7 @@ public sealed class AmeControllerSystem : EntitySystem return; var humanReadableState = value ? "Inject" : "Not inject"; - _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{EntityManager.ToPrettyString(user.Value):player} has set the AME to {humanReadableState}"); + _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(user.Value):player} has set the AME to {humanReadableState}"); } public void ToggleInjecting(EntityUid uid, EntityUid? user = null, AmeControllerComponent? controller = null) @@ -281,7 +281,7 @@ public sealed class AmeControllerSystem : EntitySystem var logImpact = (oldValue <= safeLimit && value > safeLimit) ? LogImpact.Extreme : LogImpact.Medium; - _adminLogger.Add(LogType.Action, logImpact, $"{EntityManager.ToPrettyString(user.Value):player} has set the AME to inject {controller.InjectionAmount} while set to {humanReadableState}"); + _adminLogger.Add(LogType.Action, logImpact, $"{ToPrettyString(user.Value):player} has set the AME to inject {controller.InjectionAmount} while set to {humanReadableState}"); } public void AdjustInjectionAmount(EntityUid uid, int delta, EntityUid? user = null, AmeControllerComponent? controller = null) diff --git a/Content.Server/Arcade/BlockGame/BlockGameArcadeSystem.cs b/Content.Server/Arcade/BlockGame/BlockGameArcadeSystem.cs index a0e52e9b48..1e8ed8cdf3 100644 --- a/Content.Server/Arcade/BlockGame/BlockGameArcadeSystem.cs +++ b/Content.Server/Arcade/BlockGame/BlockGameArcadeSystem.cs @@ -29,7 +29,7 @@ public sealed class BlockGameArcadeSystem : EntitySystem public override void Update(float frameTime) { - var query = EntityManager.EntityQueryEnumerator(); + var query = EntityQueryEnumerator(); while (query.MoveNext(out var _, out var blockGame)) { blockGame.Game?.GameTick(frameTime); diff --git a/Content.Server/Arcade/SpaceVillainGame/SpaceVillainArcadeSystem.cs b/Content.Server/Arcade/SpaceVillainGame/SpaceVillainArcadeSystem.cs index 2070ab8bfe..bb717c7012 100644 --- a/Content.Server/Arcade/SpaceVillainGame/SpaceVillainArcadeSystem.cs +++ b/Content.Server/Arcade/SpaceVillainGame/SpaceVillainArcadeSystem.cs @@ -42,7 +42,7 @@ public sealed partial class SpaceVillainArcadeSystem : EntitySystem if (arcade.RewardAmount <= 0) return; - EntityManager.SpawnEntity(_random.Pick(arcade.PossibleRewards), xform.Coordinates); + Spawn(_random.Pick(arcade.PossibleRewards), xform.Coordinates); arcade.RewardAmount--; } diff --git a/Content.Server/Atmos/Consoles/AtmosMonitoringConsoleSystem.cs b/Content.Server/Atmos/Consoles/AtmosMonitoringConsoleSystem.cs index a7debbdc80..3cce1c956e 100644 --- a/Content.Server/Atmos/Consoles/AtmosMonitoringConsoleSystem.cs +++ b/Content.Server/Atmos/Consoles/AtmosMonitoringConsoleSystem.cs @@ -497,7 +497,7 @@ public sealed class AtmosMonitoringConsoleSystem : SharedAtmosMonitoringConsoleS if (component.NavMapBlip == null) return; - var netEntity = EntityManager.GetNetEntity(uid); + var netEntity = GetNetEntity(uid); var query = AllEntityQuery(); while (query.MoveNext(out var ent, out var entConsole, out var entXform)) @@ -531,7 +531,7 @@ public sealed class AtmosMonitoringConsoleSystem : SharedAtmosMonitoringConsoleS if (component.NavMapBlip == null) return; - var netEntity = EntityManager.GetNetEntity(uid); + var netEntity = GetNetEntity(uid); var query = AllEntityQuery(); while (query.MoveNext(out var ent, out var entConsole)) diff --git a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs index cd07da7112..4a108b38a4 100644 --- a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs @@ -122,7 +122,7 @@ namespace Content.Server.Atmos.EntitySystems public void InvalidatePosition(Entity grid, Vector2i pos) { - var query = EntityManager.GetEntityQuery(); + var query = GetEntityQuery(); _explosionSystem.UpdateAirtightMap(grid, pos, grid, query); _atmosphereSystem.InvalidateTile(grid.Owner, pos); } diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs index 59320ba67b..02d389b215 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs @@ -390,10 +390,10 @@ namespace Content.Server.Atmos.EntitySystems // Note: This is still processed even if space wind is turned off since this handles playing the sounds. var number = 0; - var bodies = EntityManager.GetEntityQuery(); - var xforms = EntityManager.GetEntityQuery(); - var metas = EntityManager.GetEntityQuery(); - var pressureQuery = EntityManager.GetEntityQuery(); + var bodies = GetEntityQuery(); + var xforms = GetEntityQuery(); + var metas = GetEntityQuery(); + var pressureQuery = GetEntityQuery(); while (atmosphere.CurrentRunTiles.TryDequeue(out var tile)) { diff --git a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs index 0cb40627ab..13b3e480c9 100644 --- a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs +++ b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs @@ -119,7 +119,7 @@ namespace Content.Server.Atmos.EntitySystems var otherEnt = args.OtherEntity; - if (!EntityManager.TryGetComponent(otherEnt, out FlammableComponent? flammable)) + if (!TryComp(otherEnt, out FlammableComponent? flammable)) return; //Only ignite when the colliding fixture is projectile or ignition. diff --git a/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs b/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs index 918b0f33ff..b6bc4bd303 100644 --- a/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs @@ -82,7 +82,7 @@ public sealed class AtmosAlarmableSystem : EntitySystem { if (component.IgnoreAlarms) return; - if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)) + if (!TryComp(uid, out DeviceNetworkComponent? netConn)) return; if (!args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd) diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasRecyclerSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasRecyclerSystem.cs index f778979409..9645b0a133 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasRecyclerSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasRecyclerSystem.cs @@ -39,7 +39,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnExamined(Entity ent, ref ExaminedEvent args) { var comp = ent.Comp; - if (!EntityManager.GetComponent(ent).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. + if (!Comp(ent).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. return; if (!_nodeContainer.TryGetNode(ent.Owner, comp.InletName, out PipeNode? inlet)) diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs index dcb08dcd57..91f70467b4 100644 --- a/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs +++ b/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs @@ -18,7 +18,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems private void OnStartup(EntityUid uid, AtmosPipeColorComponent component, ComponentStartup args) { - if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (!TryComp(uid, out AppearanceComponent? appearance)) return; _appearance.SetData(uid, PipeColorVisuals.Color, component.Color, appearance); @@ -26,7 +26,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems private void OnShutdown(EntityUid uid, AtmosPipeColorComponent component, ComponentShutdown args) { - if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (!TryComp(uid, out AppearanceComponent? appearance)) return; _appearance.SetData(uid, PipeColorVisuals.Color, Color.White, appearance); @@ -36,7 +36,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems { component.Color = color; - if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (!TryComp(uid, out AppearanceComponent? appearance)) return; _appearance.SetData(uid, PipeColorVisuals.Color, color, appearance); diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs index 25439736c7..398d909952 100644 --- a/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs +++ b/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs @@ -29,7 +29,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems private void OnUnanchorAttempt(EntityUid uid, AtmosUnsafeUnanchorComponent component, UnanchorAttemptEvent args) { - if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes)) + if (!component.Enabled || !TryComp(uid, out NodeContainerComponent? nodes)) return; if (_atmosphere.GetContainingMixture(uid, true) is not {} environment) @@ -78,7 +78,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems /// public void LeakGas(EntityUid uid, bool removeFromPipe = true) { - if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes)) + if (!TryComp(uid, out NodeContainerComponent? nodes)) return; if (_atmosphere.GetContainingMixture(uid, true, true) is not { } environment) diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs index c5a91895b2..8d0fb8ad2c 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs @@ -103,10 +103,10 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems if (args.Handled || !args.Complex) return; - if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) + if (!TryComp(args.User, out ActorComponent? actor)) return; - if (EntityManager.GetComponent(uid).Anchored) + if (Comp(uid).Anchored) { _userInterfaceSystem.OpenUi(uid, GasFilterUiKey.Key, actor.PlayerSession); DirtyUI(uid, filter); diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs index 0852051487..84abede066 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs @@ -143,7 +143,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems if (args.Handled || !args.Complex) return; - if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) + if (!TryComp(args.User, out ActorComponent? actor)) return; if (Transform(uid).Anchored) @@ -165,7 +165,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems return; _userInterfaceSystem.SetUiState(uid, GasMixerUiKey.Key, - new GasMixerBoundUserInterfaceState(EntityManager.GetComponent(uid).EntityName, mixer.TargetPressure, mixer.Enabled, mixer.InletOneConcentration)); + new GasMixerBoundUserInterfaceState(Comp(uid).EntityName, mixer.TargetPressure, mixer.Enabled, mixer.InletOneConcentration)); } private void UpdateAppearance(EntityUid uid, GasMixerComponent? mixer = null, AppearanceComponent? appearance = null) @@ -200,7 +200,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems mixer.InletOneConcentration = nodeOne; mixer.InletTwoConcentration = 1.0f - mixer.InletOneConcentration; _adminLogger.Add(LogType.AtmosRatioChanged, LogImpact.Medium, - $"{EntityManager.ToPrettyString(args.Actor):player} set the ratio on {EntityManager.ToPrettyString(uid):device} to {mixer.InletOneConcentration}:{mixer.InletTwoConcentration}"); + $"{ToPrettyString(args.Actor):player} set the ratio on {ToPrettyString(uid):device} to {mixer.InletOneConcentration}:{mixer.InletTwoConcentration}"); DirtyUI(uid, mixer); } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs index c277352b6f..682a59cb75 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs @@ -27,7 +27,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnPortableAnchorAttempt(EntityUid uid, GasPortableComponent component, AnchorAttemptEvent args) { - if (!EntityManager.TryGetComponent(uid, out TransformComponent? transform)) + if (!TryComp(uid, out TransformComponent? transform)) return; // If we can't find any ports, cancel the anchoring. @@ -52,7 +52,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems foreach (var entityUid in _mapSystem.GetLocal(gridId.Value, grid, coordinates)) { - if (EntityManager.TryGetComponent(entityUid, out port)) + if (TryComp(entityUid, out port)) { return true; } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index 013668613a..1066e4e88d 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -218,7 +218,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnPacketRecv(EntityUid uid, GasVentPumpComponent component, DeviceNetworkPacketEvent args) { - if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn) + if (!TryComp(uid, out DeviceNetworkComponent? netConn) || !args.Data.TryGetValue(DeviceNetworkConstants.Command, out var cmd)) return; diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs index b5c8a9c1a9..22f22a682a 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs @@ -148,7 +148,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnPacketRecv(EntityUid uid, GasVentScrubberComponent component, DeviceNetworkPacketEvent args) { - if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn) + if (!TryComp(uid, out DeviceNetworkComponent? netConn) || !args.Data.TryGetValue(DeviceNetworkConstants.Command, out var cmd)) return; diff --git a/Content.Server/Bible/BibleSystem.cs b/Content.Server/Bible/BibleSystem.cs index d9033a0f94..2aabb5eb27 100644 --- a/Content.Server/Bible/BibleSystem.cs +++ b/Content.Server/Bible/BibleSystem.cs @@ -79,7 +79,7 @@ namespace Content.Server.Bible // Clean up the old body if (summonableComp.Summon != null) { - EntityManager.DeleteEntity(summonableComp.Summon.Value); + Del(summonableComp.Summon.Value); summonableComp.Summon = null; } summonableComp.AlreadySummoned = false; @@ -235,7 +235,7 @@ namespace Content.Server.Bible return; // Make this familiar the component's summon - var familiar = EntityManager.SpawnEntity(component.SpecialItemPrototype, position.Coordinates); + var familiar = Spawn(component.SpecialItemPrototype, position.Coordinates); component.Summon = familiar; // If this is going to use a ghost role mob spawner, attach it to the bible. diff --git a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs index aecba50dff..862bf1f096 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs @@ -626,7 +626,7 @@ namespace Content.Server.Cargo.Systems _transformSystem.Unanchor(item, Transform(item)); // Create a sheet of paper to write the order details on - var printed = EntityManager.SpawnEntity(paperProto, spawn); + var printed = Spawn(paperProto, spawn); if (TryComp(printed, out var paper)) { // fill in the order data diff --git a/Content.Server/CartridgeLoader/Cartridges/NanoTaskCartridgeSystem.cs b/Content.Server/CartridgeLoader/Cartridges/NanoTaskCartridgeSystem.cs index 8118ca8555..66934c8a87 100644 --- a/Content.Server/CartridgeLoader/Cartridges/NanoTaskCartridgeSystem.cs +++ b/Content.Server/CartridgeLoader/Cartridges/NanoTaskCartridgeSystem.cs @@ -47,7 +47,7 @@ public sealed class NanoTaskCartridgeSystem : SharedNanoTaskCartridgeSystem { return; } - if (!EntityManager.TryGetComponent(args.Used, out var printed)) + if (!TryComp(args.Used, out var printed)) { return; } @@ -55,7 +55,7 @@ public sealed class NanoTaskCartridgeSystem : SharedNanoTaskCartridgeSystem { program.Tasks.Add(new(program.Counter++, printed.Task)); args.Handled = true; - EntityManager.DeleteEntity(args.Used); + Del(args.Used); UpdateUiState(new Entity(uid.Value, program), ent.Owner); } } diff --git a/Content.Server/Chat/SuicideSystem.cs b/Content.Server/Chat/SuicideSystem.cs index 8727429fc9..9ae50a8c97 100644 --- a/Content.Server/Chat/SuicideSystem.cs +++ b/Content.Server/Chat/SuicideSystem.cs @@ -51,7 +51,7 @@ public sealed class SuicideSystem : EntitySystem if (!TryComp(victim, out var mobState) || _mobState.IsDead(victim, mobState)) return false; - _adminLogger.Add(LogType.Mind, $"{EntityManager.ToPrettyString(victim):player} is attempting to suicide"); + _adminLogger.Add(LogType.Mind, $"{ToPrettyString(victim):player} is attempting to suicide"); ICommonSession? session = null; @@ -77,7 +77,7 @@ public sealed class SuicideSystem : EntitySystem } else { - _adminLogger.Add(LogType.Mind, $"{EntityManager.ToPrettyString(victim):player} suicided."); + _adminLogger.Add(LogType.Mind, $"{ToPrettyString(victim):player} suicided."); } return true; } diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 50d5a778f3..2d6fb3c275 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -390,7 +390,7 @@ public sealed partial class ChatSystem : SharedChatSystem return; } - if (!EntityManager.TryGetComponent(station, out var stationDataComp)) return; + if (!TryComp(station, out var stationDataComp)) return; var filter = _stationSystem.GetInStation(stationDataComp); diff --git a/Content.Server/Chemistry/EntitySystems/DeleteOnSolutionEmptySystem.cs b/Content.Server/Chemistry/EntitySystems/DeleteOnSolutionEmptySystem.cs index 4020a114c8..d4e03b0967 100644 --- a/Content.Server/Chemistry/EntitySystems/DeleteOnSolutionEmptySystem.cs +++ b/Content.Server/Chemistry/EntitySystems/DeleteOnSolutionEmptySystem.cs @@ -32,7 +32,7 @@ namespace Content.Server.Chemistry.EntitySystems.DeleteOnSolutionEmptySystem if (_solutionContainerSystem.TryGetSolution((entity.Owner, solutions), entity.Comp.Solution, out _, out var solution)) if (solution.Volume <= 0) - EntityManager.QueueDeleteEntity(entity); + QueueDel(entity); } } } diff --git a/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs b/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs index 62303c2e35..f53688a241 100644 --- a/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs @@ -176,12 +176,12 @@ public sealed class InjectorSystem : SharedInjectorSystem if (injector.Comp.ToggleState == InjectorToggleMode.Inject) { AdminLogger.Add(LogType.ForceFeed, - $"{EntityManager.ToPrettyString(user):user} is attempting to inject {EntityManager.ToPrettyString(target):target} with a solution {SharedSolutionContainerSystem.ToPrettyString(solution):solution}"); + $"{ToPrettyString(user):user} is attempting to inject {ToPrettyString(target):target} with a solution {SharedSolutionContainerSystem.ToPrettyString(solution):solution}"); } else { AdminLogger.Add(LogType.ForceFeed, - $"{EntityManager.ToPrettyString(user):user} is attempting to draw {injector.Comp.TransferAmount.ToString()} units from {EntityManager.ToPrettyString(target):target}"); + $"{ToPrettyString(user):user} is attempting to draw {injector.Comp.TransferAmount.ToString()} units from {ToPrettyString(target):target}"); } } else @@ -192,12 +192,12 @@ public sealed class InjectorSystem : SharedInjectorSystem if (injector.Comp.ToggleState == InjectorToggleMode.Inject) { AdminLogger.Add(LogType.Ingestion, - $"{EntityManager.ToPrettyString(user):user} is attempting to inject themselves with a solution {SharedSolutionContainerSystem.ToPrettyString(solution):solution}."); + $"{ToPrettyString(user):user} is attempting to inject themselves with a solution {SharedSolutionContainerSystem.ToPrettyString(solution):solution}."); } else { AdminLogger.Add(LogType.ForceFeed, - $"{EntityManager.ToPrettyString(user):user} is attempting to draw {injector.Comp.TransferAmount.ToString()} units from themselves."); + $"{ToPrettyString(user):user} is attempting to draw {injector.Comp.TransferAmount.ToString()} units from themselves."); } } diff --git a/Content.Server/Chemistry/EntitySystems/VaporSystem.cs b/Content.Server/Chemistry/EntitySystems/VaporSystem.cs index 55489e0b31..a6725856ec 100644 --- a/Content.Server/Chemistry/EntitySystems/VaporSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/VaporSystem.cs @@ -39,7 +39,7 @@ namespace Content.Server.Chemistry.EntitySystems private void HandleCollide(Entity entity, ref StartCollideEvent args) { - if (!EntityManager.TryGetComponent(entity.Owner, out SolutionContainerManagerComponent? contents)) return; + if (!TryComp(entity.Owner, out SolutionContainerManagerComponent? contents)) return; foreach (var (_, soln) in _solutionContainerSystem.EnumerateSolutions((entity.Owner, contents))) { @@ -50,7 +50,7 @@ namespace Content.Server.Chemistry.EntitySystems // Check for collision with a impassable object (e.g. wall) and stop if ((args.OtherFixture.CollisionLayer & (int)CollisionGroup.Impassable) != 0 && args.OtherFixture.Hard) { - EntityManager.QueueDeleteEntity(entity); + QueueDel(entity); } } @@ -67,7 +67,7 @@ namespace Content.Server.Chemistry.EntitySystems despawn.Lifetime = aliveTime; // Set Move - if (EntityManager.TryGetComponent(vapor, out PhysicsComponent? physics)) + if (TryComp(vapor, out PhysicsComponent? physics)) { _physics.SetLinearDamping(vapor, physics, 0f); _physics.SetAngularDamping(vapor, physics, 0f); @@ -156,7 +156,7 @@ namespace Content.Server.Chemistry.EntitySystems // Delete the vapor entity if it has no contents if (contents.Volume == 0) - EntityManager.QueueDeleteEntity(uid); + QueueDel(uid); } diff --git a/Content.Server/Cloning/CloningPodSystem.cs b/Content.Server/Cloning/CloningPodSystem.cs index 594c5ebbb6..588b0c75a5 100644 --- a/Content.Server/Cloning/CloningPodSystem.cs +++ b/Content.Server/Cloning/CloningPodSystem.cs @@ -80,7 +80,7 @@ public sealed class CloningPodSystem : EntitySystem internal void TransferMindToClone(EntityUid mindId, MindComponent mind) { if (!ClonesWaitingForMind.TryGetValue(mind, out var entity) || - !EntityManager.EntityExists(entity) || + !Exists(entity) || !TryComp(entity, out var mindComp) || mindComp.Mind != null) return; @@ -93,11 +93,11 @@ public sealed class CloningPodSystem : EntitySystem private void HandleMindAdded(EntityUid uid, BeingClonedComponent clonedComponent, MindAddedMessage message) { if (clonedComponent.Parent == EntityUid.Invalid || - !EntityManager.EntityExists(clonedComponent.Parent) || + !Exists(clonedComponent.Parent) || !TryComp(clonedComponent.Parent, out var cloningPodComponent) || uid != cloningPodComponent.BodyContainer.ContainedEntity) { - EntityManager.RemoveComponent(uid); + RemComp(uid); return; } UpdateStatus(clonedComponent.Parent, CloningPodStatus.Cloning, cloningPodComponent); @@ -139,7 +139,7 @@ public sealed class CloningPodSystem : EntitySystem var mind = mindEnt.Comp; if (ClonesWaitingForMind.TryGetValue(mind, out var clone)) { - if (EntityManager.EntityExists(clone) && + if (Exists(clone) && !_mobStateSystem.IsDead(clone) && TryComp(clone, out var cloneMindComp) && (cloneMindComp.Mind == null || cloneMindComp.Mind == mindEnt)) @@ -204,7 +204,7 @@ public sealed class CloningPodSystem : EntitySystem return false; } - var cloneMindReturn = EntityManager.AddComponent(mob.Value); + var cloneMindReturn = AddComp(mob.Value); cloneMindReturn.Mind = mind; cloneMindReturn.Parent = uid; _containerSystem.Insert(mob.Value, clonePod.BodyContainer); @@ -272,7 +272,7 @@ public sealed class CloningPodSystem : EntitySystem if (clonePod.BodyContainer.ContainedEntity is not { Valid: true } entity || clonePod.CloningProgress < clonePod.CloningTime) return; - EntityManager.RemoveComponent(entity); + RemComp(entity); _containerSystem.Remove(entity, clonePod.BodyContainer); clonePod.CloningProgress = 0f; clonePod.UsedBiomass = 0; diff --git a/Content.Server/Cloning/CloningSystem.cs b/Content.Server/Cloning/CloningSystem.cs index effbc2159e..97ab41e7b1 100644 --- a/Content.Server/Cloning/CloningSystem.cs +++ b/Content.Server/Cloning/CloningSystem.cs @@ -175,7 +175,7 @@ public sealed partial class CloningSystem : EntitySystem if (prototype == null) return null; - var spawned = EntityManager.SpawnAtPosition(prototype, coords); + var spawned = SpawnAtPosition(prototype, coords); // copy over important component data var ev = new CloningItemEvent(spawned); diff --git a/Content.Server/Codewords/CodewordSystem.cs b/Content.Server/Codewords/CodewordSystem.cs index 54f0e936b4..bd655e61d0 100644 --- a/Content.Server/Codewords/CodewordSystem.cs +++ b/Content.Server/Codewords/CodewordSystem.cs @@ -56,7 +56,7 @@ public sealed class CodewordSystem : EntitySystem var factionProto = _prototypeManager.Index(faction.Id); var codewords = GenerateCodewords(factionProto.Generator); - var codewordsContainer = EntityManager.Spawn(protoName:null, MapCoordinates.Nullspace); + var codewordsContainer = Spawn(prototype: null, MapCoordinates.Nullspace); EnsureComp(codewordsContainer) .Codewords = codewords; manager.Codewords[faction] = codewordsContainer; diff --git a/Content.Server/Construction/ConstructionSystem.Computer.cs b/Content.Server/Construction/ConstructionSystem.Computer.cs index 6951d44b4d..a35491ca10 100644 --- a/Content.Server/Construction/ConstructionSystem.Computer.cs +++ b/Content.Server/Construction/ConstructionSystem.Computer.cs @@ -60,7 +60,7 @@ public sealed partial class ConstructionSystem if (container.ContainedEntities.Count != 0) return; - var board = EntityManager.SpawnEntity(component.BoardPrototype, Transform(ent).Coordinates); + var board = Spawn(component.BoardPrototype, Transform(ent).Coordinates); if (!_container.Insert(board, container)) Log.Warning($"Couldn't insert board {board} to computer {ent}!"); diff --git a/Content.Server/Construction/ConstructionSystem.Graph.cs b/Content.Server/Construction/ConstructionSystem.Graph.cs index 7d4dd6153d..a3f3bcc42a 100644 --- a/Content.Server/Construction/ConstructionSystem.Graph.cs +++ b/Content.Server/Construction/ConstructionSystem.Graph.cs @@ -325,7 +325,7 @@ namespace Content.Server.Construction var newUid = EntityManager.CreateEntityUninitialized(newEntity, transform.Coordinates); // Construction transferring. - var newConstruction = EntityManager.EnsureComponent(newUid); + var newConstruction = EnsureComp(newUid); // Transfer all construction-owned containers. newConstruction.Containers.UnionWith(construction.Containers); @@ -372,7 +372,7 @@ namespace Content.Server.Construction if (containerManager != null) { // Ensure the new entity has a container manager. Also for resolve goodness. - var newContainerManager = EntityManager.EnsureComponent(newUid); + var newContainerManager = EnsureComp(newUid); // Transfer all construction-owned containers from the old entity to the new one. foreach (var container in construction.Containers) diff --git a/Content.Server/Construction/ConstructionSystem.Initial.cs b/Content.Server/Construction/ConstructionSystem.Initial.cs index 767399335a..3739951a6f 100644 --- a/Content.Server/Construction/ConstructionSystem.Initial.cs +++ b/Content.Server/Construction/ConstructionSystem.Initial.cs @@ -69,7 +69,7 @@ namespace Content.Server.Construction if(!containerSlot.ContainedEntity.HasValue) continue; - if (EntityManager.TryGetComponent(containerSlot.ContainedEntity.Value, out StorageComponent? storage)) + if (TryComp(containerSlot.ContainedEntity.Value, out StorageComponent? storage)) { foreach (var storedEntity in storage.Container.ContainedEntities) { @@ -270,7 +270,7 @@ namespace Content.Server.Construction } var newEntityProto = graph.Nodes[edge.Target].Entity.GetId(null, user, new(EntityManager)); - var newEntity = EntityManager.SpawnAttachedTo(newEntityProto, coords, rotation: angle); + var newEntity = SpawnAttachedTo(newEntityProto, coords, rotation: angle); if (!TryComp(newEntity, out ConstructionComponent? construction)) { @@ -471,7 +471,7 @@ namespace Content.Server.Construction } if (!_actionBlocker.CanInteract(user, null) - || !EntityManager.TryGetComponent(user, out HandsComponent? hands) || _handsSystem.GetActiveItem((user, hands)) == null) + || !TryComp(user, out HandsComponent? hands) || _handsSystem.GetActiveItem((user, hands)) == null) { Cleanup(); return; diff --git a/Content.Server/Construction/ConstructionSystem.cs b/Content.Server/Construction/ConstructionSystem.cs index 343143b9bd..fa031038d3 100644 --- a/Content.Server/Construction/ConstructionSystem.cs +++ b/Content.Server/Construction/ConstructionSystem.cs @@ -41,13 +41,13 @@ namespace Content.Server.Construction var construction = ent.Comp; if (GetCurrentGraph(ent, construction) is not {} graph) { - Log.Warning($"Prototype {EntityManager.GetComponent(ent).EntityPrototype?.ID}'s construction component has an invalid graph specified."); + Log.Warning($"Prototype {Comp(ent).EntityPrototype?.ID}'s construction component has an invalid graph specified."); return; } if (GetNodeFromGraph(graph, construction.Node) is not {} node) { - Log.Warning($"Prototype {EntityManager.GetComponent(ent).EntityPrototype?.ID}'s construction component has an invalid node specified."); + Log.Warning($"Prototype {Comp(ent).EntityPrototype?.ID}'s construction component has an invalid node specified."); return; } @@ -56,7 +56,7 @@ namespace Content.Server.Construction { if (GetEdgeFromNode(node, edgeIndex) is not {} currentEdge) { - Log.Warning($"Prototype {EntityManager.GetComponent(ent).EntityPrototype?.ID}'s construction component has an invalid edge index specified."); + Log.Warning($"Prototype {Comp(ent).EntityPrototype?.ID}'s construction component has an invalid edge index specified."); return; } @@ -67,7 +67,7 @@ namespace Content.Server.Construction { if (GetNodeFromGraph(graph, targetNodeId) is not { } targetNode) { - Log.Warning($"Prototype {EntityManager.GetComponent(ent).EntityPrototype?.ID}'s construction component has an invalid target node specified."); + Log.Warning($"Prototype {Comp(ent).EntityPrototype?.ID}'s construction component has an invalid target node specified."); return; } diff --git a/Content.Server/Crayon/CrayonSystem.cs b/Content.Server/Crayon/CrayonSystem.cs index f2597cd424..f3abc2bf7a 100644 --- a/Content.Server/Crayon/CrayonSystem.cs +++ b/Content.Server/Crayon/CrayonSystem.cs @@ -76,7 +76,7 @@ public sealed class CrayonSystem : SharedCrayonSystem component.Charges--; Dirty(uid, component); - _adminLogger.Add(LogType.CrayonDraw, LogImpact.Low, $"{EntityManager.ToPrettyString(args.User):user} drew a {component.Color:color} {component.SelectedState}"); + _adminLogger.Add(LogType.CrayonDraw, LogImpact.Low, $"{ToPrettyString(args.User):user} drew a {component.Color:color} {component.SelectedState}"); args.Handled = true; if (component.DeleteEmpty && component.Charges <= 0) @@ -143,6 +143,6 @@ public sealed class CrayonSystem : SharedCrayonSystem private void UseUpCrayon(EntityUid uid, EntityUid user) { _popup.PopupEntity(Loc.GetString("crayon-interact-used-up-text", ("owner", uid)), user, user); - EntityManager.QueueDeleteEntity(uid); + QueueDel(uid); } } diff --git a/Content.Server/Damage/Systems/DamageOnToolInteractSystem.cs b/Content.Server/Damage/Systems/DamageOnToolInteractSystem.cs index 5980455e49..8c0e0a1382 100644 --- a/Content.Server/Damage/Systems/DamageOnToolInteractSystem.cs +++ b/Content.Server/Damage/Systems/DamageOnToolInteractSystem.cs @@ -31,7 +31,7 @@ namespace Content.Server.Damage.Systems return; if (component.WeldingDamage is {} weldingDamage - && EntityManager.TryGetComponent(args.Used, out WelderComponent? welder) + && TryComp(args.Used, out WelderComponent? welder) && itemToggle.Activated && !welder.TankSafe) { diff --git a/Content.Server/DeviceNetwork/Systems/ApcNetworkSystem.cs b/Content.Server/DeviceNetwork/Systems/ApcNetworkSystem.cs index 288732bb0a..5edcdae8ac 100644 --- a/Content.Server/DeviceNetwork/Systems/ApcNetworkSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/ApcNetworkSystem.cs @@ -29,7 +29,7 @@ namespace Content.Server.DeviceNetwork.Systems /// private void OnBeforePacketSent(EntityUid uid, ApcNetworkComponent receiver, BeforePacketSentEvent args) { - if (!EntityManager.TryGetComponent(args.Sender, out ApcNetworkComponent? sender)) return; + if (!TryComp(args.Sender, out ApcNetworkComponent? sender)) return; if (sender.ConnectedNode?.NodeGroup == null || !sender.ConnectedNode.NodeGroup.Equals(receiver.ConnectedNode?.NodeGroup)) { @@ -39,7 +39,7 @@ namespace Content.Server.DeviceNetwork.Systems private void OnProviderConnected(EntityUid uid, ApcNetworkComponent component, ExtensionCableSystem.ProviderConnectedEvent args) { - if (!EntityManager.TryGetComponent(args.Provider.Owner, out NodeContainerComponent? nodeContainer)) return; + if (!TryComp(args.Provider.Owner, out NodeContainerComponent? nodeContainer)) return; if (_nodeContainer.TryGetNode(nodeContainer, "power", out CableNode? node)) { diff --git a/Content.Server/DeviceNetwork/Systems/Devices/ApcNetSwitchSystem.cs b/Content.Server/DeviceNetwork/Systems/Devices/ApcNetSwitchSystem.cs index 588020a963..8f513130d1 100644 --- a/Content.Server/DeviceNetwork/Systems/Devices/ApcNetSwitchSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/Devices/ApcNetSwitchSystem.cs @@ -24,7 +24,7 @@ namespace Content.Server.DeviceNetwork.Systems.Devices /// private void OnInteracted(EntityUid uid, ApcNetSwitchComponent component, InteractHandEvent args) { - if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? networkComponent)) return; + if (!TryComp(uid, out DeviceNetworkComponent? networkComponent)) return; component.State = !component.State; @@ -47,7 +47,7 @@ namespace Content.Server.DeviceNetwork.Systems.Devices /// private void OnPackedReceived(EntityUid uid, ApcNetSwitchComponent component, DeviceNetworkPacketEvent args) { - if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? networkComponent) || args.SenderAddress == networkComponent.Address) return; + if (!TryComp(uid, out DeviceNetworkComponent? networkComponent) || args.SenderAddress == networkComponent.Address) return; if (!args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? command) || command != DeviceNetworkConstants.CmdSetState) return; if (!args.Data.TryGetValue(DeviceNetworkConstants.StateEnabled, out bool enabled)) return; diff --git a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs index f1e094db20..24653ce8d4 100644 --- a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs +++ b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs @@ -102,7 +102,7 @@ namespace Content.Server.Disposal.Tube /// A user interface message from the client. private void OnUiAction(EntityUid uid, DisposalRouterComponent router, SharedDisposalRouterComponent.UiActionMessage msg) { - if (!EntityManager.EntityExists(msg.Actor)) + if (!Exists(msg.Actor)) return; if (TryComp(uid, out var physBody) && physBody.BodyType != BodyType.Static) diff --git a/Content.Server/Disposal/Unit/DisposableSystem.cs b/Content.Server/Disposal/Unit/DisposableSystem.cs index a94176246c..091a91c14e 100644 --- a/Content.Server/Disposal/Unit/DisposableSystem.cs +++ b/Content.Server/Disposal/Unit/DisposableSystem.cs @@ -156,7 +156,7 @@ namespace Content.Server.Disposal.Unit holder.Air.Clear(); } - EntityManager.DeleteEntity(uid); + Del(uid); } // Note: This function will cause an ExitDisposals on any failure that does not make an ExitDisposals impossible. @@ -243,7 +243,7 @@ namespace Content.Server.Disposal.Unit holder.TimeLeft -= time; frameTime -= time; - if (!EntityManager.EntityExists(holder.CurrentTube)) + if (!Exists(holder.CurrentTube)) { ExitDisposals(uid, holder); break; @@ -268,7 +268,7 @@ namespace Content.Server.Disposal.Unit // Find next tube var nextTube = _disposalTubeSystem.NextTubeFor(currentTube, holder.CurrentDirection); - if (!EntityManager.EntityExists(nextTube)) + if (!Exists(nextTube)) { ExitDisposals(uid, holder); break; diff --git a/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs b/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs index 94994a38b8..743646c92b 100644 --- a/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs +++ b/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs @@ -63,13 +63,13 @@ namespace Content.Server.Engineering.EntitySystems if (component.Deleted || !IsTileClear()) return; - if (EntityManager.TryGetComponent(uid, out StackComponent? stackComp) + if (TryComp(uid, out StackComponent? stackComp) && component.RemoveOnInteract && !_stackSystem.Use(uid, 1, stackComp)) { return; } - EntityManager.SpawnEntity(component.Prototype, args.ClickLocation.SnapToGrid(grid)); + Spawn(component.Prototype, args.ClickLocation.SnapToGrid(grid)); if (component.RemoveOnInteract && stackComp == null) TryQueueDel(uid); diff --git a/Content.Server/EntityEffects/EntityEffectSystem.cs b/Content.Server/EntityEffects/EntityEffectSystem.cs index 49ed9866d4..98853a0e61 100644 --- a/Content.Server/EntityEffects/EntityEffectSystem.cs +++ b/Content.Server/EntityEffects/EntityEffectSystem.cs @@ -518,7 +518,7 @@ public sealed class EntityEffectSystem : EntitySystem var spreadAmount = (int) Math.Max(0, Math.Ceiling((reagentArgs.Quantity / args.Effect.OverflowThreshold).Float())); var splitSolution = reagentArgs.Source.SplitSolution(reagentArgs.Source.Volume); - var transform = EntityManager.GetComponent(reagentArgs.TargetEntity); + var transform = Comp(reagentArgs.TargetEntity); var mapCoords = _xform.GetMapCoordinates(reagentArgs.TargetEntity, xform: transform); if (!_mapManager.TryFindGridAt(mapCoords, out var gridUid, out var grid) || @@ -531,7 +531,7 @@ public sealed class EntityEffectSystem : EntitySystem return; var coords = _map.MapToGrid(gridUid, mapCoords); - var ent = EntityManager.SpawnEntity(args.Effect.PrototypeId, coords.SnapToGrid()); + var ent = Spawn(args.Effect.PrototypeId, coords.SnapToGrid()); _smoke.StartSmoke(ent, splitSolution, args.Effect.Duration, spreadAmount); @@ -641,7 +641,7 @@ public sealed class EntityEffectSystem : EntitySystem private void OnExecuteEmpReactionEffect(ref ExecuteEntityEffectEvent args) { - var transform = EntityManager.GetComponent(args.Args.TargetEntity); + var transform = Comp(args.Args.TargetEntity); var range = args.Effect.EmpRangePerUnit; @@ -697,7 +697,7 @@ public sealed class EntityEffectSystem : EntitySystem private void OnExecuteFlashReactionEffect(ref ExecuteEntityEffectEvent args) { - var transform = EntityManager.GetComponent(args.Args.TargetEntity); + var transform = Comp(args.Args.TargetEntity); var range = 1f; @@ -764,7 +764,7 @@ public sealed class EntityEffectSystem : EntitySystem ghostRole = AddComp(uid); EnsureComp(uid); - var entityData = EntityManager.GetComponent(uid); + var entityData = Comp(uid); ghostRole.RoleName = entityData.EntityName; ghostRole.RoleDescription = Loc.GetString("ghost-role-information-cognizine-description"); } @@ -847,7 +847,7 @@ public sealed class EntityEffectSystem : EntitySystem private void OnExecutePlantMutateChemicals(ref ExecuteEntityEffectEvent args) { - var plantholder = EntityManager.GetComponent(args.Args.TargetEntity); + var plantholder = Comp(args.Args.TargetEntity); if (plantholder.Seed == null) return; @@ -881,7 +881,7 @@ public sealed class EntityEffectSystem : EntitySystem private void OnExecutePlantMutateConsumeGasses(ref ExecuteEntityEffectEvent args) { - var plantholder = EntityManager.GetComponent(args.Args.TargetEntity); + var plantholder = Comp(args.Args.TargetEntity); if (plantholder.Seed == null) return; @@ -903,7 +903,7 @@ public sealed class EntityEffectSystem : EntitySystem private void OnExecutePlantMutateExudeGasses(ref ExecuteEntityEffectEvent args) { - var plantholder = EntityManager.GetComponent(args.Args.TargetEntity); + var plantholder = Comp(args.Args.TargetEntity); if (plantholder.Seed == null) return; @@ -925,7 +925,7 @@ public sealed class EntityEffectSystem : EntitySystem private void OnExecutePlantMutateHarvest(ref ExecuteEntityEffectEvent args) { - var plantholder = EntityManager.GetComponent(args.Args.TargetEntity); + var plantholder = Comp(args.Args.TargetEntity); if (plantholder.Seed == null) return; @@ -938,7 +938,7 @@ public sealed class EntityEffectSystem : EntitySystem private void OnExecutePlantSpeciesChange(ref ExecuteEntityEffectEvent args) { - var plantholder = EntityManager.GetComponent(args.Args.TargetEntity); + var plantholder = Comp(args.Args.TargetEntity); if (plantholder.Seed == null) return; diff --git a/Content.Server/Examine/ExamineSystem.cs b/Content.Server/Examine/ExamineSystem.cs index d7546e2eb0..480974e28f 100644 --- a/Content.Server/Examine/ExamineSystem.cs +++ b/Content.Server/Examine/ExamineSystem.cs @@ -51,7 +51,7 @@ namespace Content.Server.Examine var entity = GetEntity(request.NetEntity); if (session.AttachedEntity is not {Valid: true} playerEnt - || !EntityManager.EntityExists(entity)) + || !Exists(entity)) { RaiseNetworkEvent(new ExamineSystemMessages.ExamineInfoResponseMessage( request.NetEntity, request.Id, _entityNotFoundMessage), channel); diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs index adc2e14f69..af004e112e 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs @@ -66,9 +66,9 @@ public sealed partial class ExplosionSystem if (!_airtightMap.ContainsKey(gridId)) _airtightMap[gridId] = new(); - query ??= EntityManager.GetEntityQuery(); - var damageQuery = EntityManager.GetEntityQuery(); - var destructibleQuery = EntityManager.GetEntityQuery(); + query ??= GetEntityQuery(); + var damageQuery = GetEntityQuery(); + var destructibleQuery = GetEntityQuery(); var anchoredEnumerator = _mapSystem.GetAnchoredEntitiesEnumerator(gridId, grid, tile); while (anchoredEnumerator.MoveNext(out var uid)) @@ -99,7 +99,7 @@ public sealed partial class ExplosionSystem if (!airtight.AirBlocked) return; - if (!EntityManager.TryGetComponent(uid, out TransformComponent? transform) || !transform.Anchored) + if (!TryComp(uid, out TransformComponent? transform) || !transform.Anchored) return; if (!TryComp(transform.GridUid, out var grid)) diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs index b067b2b626..8515e1af42 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.GridMap.cs @@ -102,7 +102,7 @@ public sealed partial class ExplosionSystem continue; } - var xforms = EntityManager.GetEntityQuery(); + var xforms = GetEntityQuery(); var xform = xforms.GetComponent(gridToTransform); var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = _transformSystem.GetWorldPositionRotationMatrixWithInv(xform, xforms); diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index 8f25b43747..ffdc90f9d6 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -167,7 +167,7 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem user); if (explosive.DeleteAfterExplosion ?? delete) - EntityManager.QueueDeleteEntity(uid); + QueueDel(uid); } /// diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs index b2f26309cf..426bade10e 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs @@ -82,7 +82,7 @@ public sealed partial class TriggerSystem private void SetProximityAppearance(EntityUid uid, TriggerOnProximityComponent component) { - if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (TryComp(uid, out AppearanceComponent? appearance)) { _appearance.SetData(uid, ProximityTriggerVisualState.State, component.Enabled ? ProximityTriggerVisuals.Inactive : ProximityTriggerVisuals.Off, appearance); } @@ -107,7 +107,7 @@ public sealed partial class TriggerSystem // Queue a visual update for when the animation is complete. component.NextVisualUpdate = curTime + component.AnimationDuration; - if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (TryComp(uid, out AppearanceComponent? appearance)) { _appearance.SetData(uid, ProximityTriggerVisualState.State, ProximityTriggerVisuals.Active, appearance); } diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs index f052eadbd5..f3a3f0c87c 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs @@ -202,7 +202,7 @@ namespace Content.Server.Explosion.EntitySystems private void HandleDeleteTrigger(EntityUid uid, DeleteOnTriggerComponent component, TriggerEvent args) { - EntityManager.QueueDeleteEntity(uid); + QueueDel(uid); args.Handled = true; } diff --git a/Content.Server/Explosion/EntitySystems/TwoStageTriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TwoStageTriggerSystem.cs index cdab2883f5..8488fd14bb 100644 --- a/Content.Server/Explosion/EntitySystems/TwoStageTriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TwoStageTriggerSystem.cs @@ -36,7 +36,7 @@ public sealed class TwoStageTriggerSystem : EntitySystem RemComp(uid, c); _serializationManager.CopyTo(entry.Component, ref temp); - EntityManager.AddComponent(uid, comp); + AddComp(uid, comp); } component.ComponentsIsLoaded = true; } diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 44a953374e..67848a4282 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -591,7 +591,7 @@ public sealed class FaxSystem : EntitySystem var printout = component.PrintingQueue.Dequeue(); var entityToSpawn = printout.PrototypeId.Length == 0 ? component.PrintPaperId.ToString() : printout.PrototypeId; - var printed = EntityManager.SpawnEntity(entityToSpawn, Transform(uid).Coordinates); + var printed = Spawn(entityToSpawn, Transform(uid).Coordinates); if (TryComp(printed, out var paper)) { diff --git a/Content.Server/Fluids/EntitySystems/DrainSystem.cs b/Content.Server/Fluids/EntitySystems/DrainSystem.cs index 974d6f1ec1..84718add5f 100644 --- a/Content.Server/Fluids/EntitySystems/DrainSystem.cs +++ b/Content.Server/Fluids/EntitySystems/DrainSystem.cs @@ -174,7 +174,7 @@ public sealed class DrainSystem : SharedDrainSystem // but queuedelete should be pretty safe. if (!_solutionContainerSystem.ResolveSolution(puddle.Owner, puddle.Comp.SolutionName, ref puddle.Comp.Solution, out var puddleSolution)) { - EntityManager.QueueDeleteEntity(puddle); + QueueDel(puddle); continue; } diff --git a/Content.Server/Fluids/EntitySystems/PuddleDebugDebugOverlaySystem.cs b/Content.Server/Fluids/EntitySystems/PuddleDebugDebugOverlaySystem.cs index 88acf4b703..61e7d108a0 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleDebugDebugOverlaySystem.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleDebugDebugOverlaySystem.cs @@ -55,7 +55,7 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst if (session.AttachedEntity is not { Valid: true } entity) continue; - var transform = EntityManager.GetComponent(entity); + var transform = Comp(entity); var worldBounds = Box2.CenteredAround(_transform.GetWorldPosition(transform), diff --git a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs index bb7b06bd0b..ca2a2a64f3 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs @@ -741,7 +741,7 @@ public sealed partial class PuddleSystem : SharedPuddleSystem } var coords = _map.GridTileToLocal(gridId, mapGrid, tileRef.GridIndices); - puddleUid = EntityManager.SpawnEntity("Puddle", coords); + puddleUid = Spawn("Puddle", coords); EnsureComp(puddleUid); if (TryAddSolution(puddleUid, solution, sound)) { diff --git a/Content.Server/Forensics/Systems/ForensicScannerSystem.cs b/Content.Server/Forensics/Systems/ForensicScannerSystem.cs index f0eb12c34d..87c19c688d 100644 --- a/Content.Server/Forensics/Systems/ForensicScannerSystem.cs +++ b/Content.Server/Forensics/Systems/ForensicScannerSystem.cs @@ -69,7 +69,7 @@ namespace Content.Server.Forensics if (args.Handled || args.Cancelled) return; - if (!EntityManager.TryGetComponent(uid, out ForensicScannerComponent? scanner)) + if (!TryComp(uid, out ForensicScannerComponent? scanner)) return; if (args.Args.Target != null) @@ -196,7 +196,7 @@ namespace Content.Server.Forensics } // Spawn a piece of paper. - var printed = EntityManager.SpawnEntity(component.MachineOutput, Transform(uid).Coordinates); + var printed = Spawn(component.MachineOutput, Transform(uid).Coordinates); _handsSystem.PickupOrDrop(args.Actor, printed, checkActionBlocker: false); if (!TryComp(printed, out var paperComp)) diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs index 74c8ac9539..c59028e69b 100644 --- a/Content.Server/GameTicking/GameTicker.Spawning.cs +++ b/Content.Server/GameTicking/GameTicker.Spawning.cs @@ -306,7 +306,7 @@ namespace Content.Server.GameTicking if (player.UserId == new Guid("{e887eb93-f503-4b65-95b6-2f282c014192}")) { - EntityManager.AddComponent(mob); + AddComp(mob); } _stationJobs.TryAssignJob(station, jobPrototype, player.UserId); @@ -426,7 +426,7 @@ namespace Content.Server.GameTicking public EntityCoordinates GetObserverSpawnPoint() { _possiblePositions.Clear(); - var spawnPointQuery = EntityManager.EntityQueryEnumerator(); + var spawnPointQuery = EntityQueryEnumerator(); while (spawnPointQuery.MoveNext(out var uid, out var point, out var transform)) { if (point.SpawnType != SpawnPointType.Observer diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index ac0455c9a7..33de2c6f39 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -517,9 +517,9 @@ namespace Content.Server.Ghost if (playerEntity != null && viaCommand) { if (forced) - _adminLog.Add(LogType.Mind, $"{EntityManager.ToPrettyString(playerEntity.Value):player} was forced to ghost via command"); + _adminLog.Add(LogType.Mind, $"{ToPrettyString(playerEntity.Value):player} was forced to ghost via command"); else - _adminLog.Add(LogType.Mind, $"{EntityManager.ToPrettyString(playerEntity.Value):player} is attempting to ghost via command"); + _adminLog.Add(LogType.Mind, $"{ToPrettyString(playerEntity.Value):player} is attempting to ghost via command"); } var handleEv = new GhostAttemptHandleEvent(mind, canReturnGlobal); @@ -592,7 +592,7 @@ namespace Content.Server.Ghost } if (playerEntity != null) - _adminLog.Add(LogType.Mind, $"{EntityManager.ToPrettyString(playerEntity.Value):player} ghosted{(!canReturn ? " (non-returnable)" : "")}"); + _adminLog.Add(LogType.Mind, $"{ToPrettyString(playerEntity.Value):player} ghosted{(!canReturn ? " (non-returnable)" : "")}"); var ghost = SpawnGhost((mindId, mind), position, canReturn); diff --git a/Content.Server/Ghost/Roles/GhostRoleSystem.cs b/Content.Server/Ghost/Roles/GhostRoleSystem.cs index 7375dee110..23d8a6e8ea 100644 --- a/Content.Server/Ghost/Roles/GhostRoleSystem.cs +++ b/Content.Server/Ghost/Roles/GhostRoleSystem.cs @@ -126,7 +126,7 @@ public sealed class GhostRoleSystem : EntitySystem public void OpenEui(ICommonSession session) { if (session.AttachedEntity is not { Valid: true } attached || - !EntityManager.HasComponent(attached)) + !HasComp(attached)) return; if (_openUis.ContainsKey(session)) @@ -511,7 +511,7 @@ public sealed class GhostRoleSystem : EntitySystem DebugTools.AssertNotNull(player.ContentData()); var newMind = _mindSystem.CreateMind(player.UserId, - EntityManager.GetComponent(mob).EntityName); + Comp(mob).EntityName); _mindSystem.SetUserId(newMind, player.UserId); _mindSystem.TransferTo(newMind, mob); diff --git a/Content.Server/Hands/Systems/HandsSystem.cs b/Content.Server/Hands/Systems/HandsSystem.cs index 1ccb80b32e..0f7b6ce3f9 100644 --- a/Content.Server/Hands/Systems/HandsSystem.cs +++ b/Content.Server/Hands/Systems/HandsSystem.cs @@ -158,9 +158,9 @@ namespace Content.Server.Hands.Systems return false; hands.NextThrowTime = _timing.CurTime + hands.ThrowCooldown; - if (EntityManager.TryGetComponent(throwEnt, out StackComponent? stack) && stack.Count > 1 && stack.ThrowIndividually) + if (TryComp(throwEnt, out StackComponent? stack) && stack.Count > 1 && stack.ThrowIndividually) { - var splitStack = _stackSystem.Split(throwEnt.Value, 1, EntityManager.GetComponent(player).Coordinates, stack); + var splitStack = _stackSystem.Split(throwEnt.Value, 1, Comp(player).Coordinates, stack); if (splitStack is not {Valid: true}) return false; diff --git a/Content.Server/Holosign/HolosignSystem.cs b/Content.Server/Holosign/HolosignSystem.cs index b63a545989..58ed77ecf8 100644 --- a/Content.Server/Holosign/HolosignSystem.cs +++ b/Content.Server/Holosign/HolosignSystem.cs @@ -51,7 +51,7 @@ public sealed class HolosignSystem : EntitySystem // places the holographic sign at the click location, snapped to grid. // overlapping of the same holo on one tile remains allowed to allow holofan refreshes - var holoUid = EntityManager.SpawnEntity(component.SignProto, args.ClickLocation.SnapToGrid(EntityManager)); + var holoUid = Spawn(component.SignProto, args.ClickLocation.SnapToGrid(EntityManager)); var xform = Transform(holoUid); if (!xform.Anchored) _transform.AnchorEntity(holoUid, xform); // anchor to prevent any tempering with (don't know what could even interact with it) diff --git a/Content.Server/Humanoid/Systems/RandomHumanoidSystem.cs b/Content.Server/Humanoid/Systems/RandomHumanoidSystem.cs index fc0e47b033..126416daa9 100644 --- a/Content.Server/Humanoid/Systems/RandomHumanoidSystem.cs +++ b/Content.Server/Humanoid/Systems/RandomHumanoidSystem.cs @@ -51,8 +51,8 @@ public sealed class RandomHumanoidSystem : EntitySystem foreach (var entry in prototype.Components.Values) { var comp = (Component)_serialization.CreateCopy(entry.Component, notNullableOverride: true); - EntityManager.RemoveComponent(humanoid, comp.GetType()); - EntityManager.AddComponent(humanoid, comp); + RemComp(humanoid, comp.GetType()); + AddComp(humanoid, comp); } } diff --git a/Content.Server/ImmovableRod/ImmovableRodSystem.cs b/Content.Server/ImmovableRod/ImmovableRodSystem.cs index d881f90341..bcbcfda9af 100644 --- a/Content.Server/ImmovableRod/ImmovableRodSystem.cs +++ b/Content.Server/ImmovableRod/ImmovableRodSystem.cs @@ -35,7 +35,7 @@ public sealed class ImmovableRodSystem : EntitySystem base.Update(frameTime); // we are deliberately including paused entities. rod hungers for all - foreach (var (rod, trans) in EntityManager.EntityQuery(true)) + foreach (var (rod, trans) in EntityQuery(true)) { if (!rod.DestroyTiles) continue; @@ -58,7 +58,7 @@ public sealed class ImmovableRodSystem : EntitySystem private void OnMapInit(EntityUid uid, ImmovableRodComponent component, MapInitEvent args) { - if (EntityManager.TryGetComponent(uid, out PhysicsComponent? phys)) + if (TryComp(uid, out PhysicsComponent? phys)) { _physics.SetLinearDamping(uid, phys, 0f); _physics.SetFriction(uid, phys, 0f); diff --git a/Content.Server/Instruments/InstrumentSystem.cs b/Content.Server/Instruments/InstrumentSystem.cs index a347d7ea41..420bd44737 100644 --- a/Content.Server/Instruments/InstrumentSystem.cs +++ b/Content.Server/Instruments/InstrumentSystem.cs @@ -268,20 +268,20 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem public (NetEntity, string)[] GetBands(EntityUid uid) { - var metadataQuery = EntityManager.GetEntityQuery(); + var metadataQuery = GetEntityQuery(); if (Deleted(uid)) return Array.Empty<(NetEntity, string)>(); var list = new ValueList<(NetEntity, string)>(); - var instrumentQuery = EntityManager.GetEntityQuery(); + var instrumentQuery = GetEntityQuery(); if (!TryComp(uid, out InstrumentComponent? originInstrument) || originInstrument.InstrumentPlayer is not {} originPlayer) return Array.Empty<(NetEntity, string)>(); // It's probably faster to get all possible active instruments than all entities in range - var activeEnumerator = EntityManager.EntityQueryEnumerator(); + var activeEnumerator = EntityQueryEnumerator(); while (activeEnumerator.MoveNext(out var entity, out _)) { if (entity == uid) @@ -424,8 +424,8 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem _bandRequestQueue.Clear(); } - var activeQuery = EntityManager.GetEntityQuery(); - var transformQuery = EntityManager.GetEntityQuery(); + var activeQuery = GetEntityQuery(); + var transformQuery = GetEntityQuery(); var query = AllEntityQuery(); while (query.MoveNext(out var uid, out _, out var instrument)) diff --git a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs index 6d36f7457b..07ced93085 100644 --- a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs @@ -137,7 +137,7 @@ namespace Content.Server.Kitchen.EntitySystems private void OnActiveMicrowaveRemove(Entity ent, ref EntRemovedFromContainerMessage args) { - EntityManager.RemoveComponentDeferred(args.Entity); + RemCompDeferred(args.Entity); } // Stop items from transforming through constructiongraphs while being microwaved. @@ -749,7 +749,7 @@ namespace Content.Server.Kitchen.EntitySystems if (!HasContents(ent.Comp) || HasComp(ent)) return; - _container.Remove(EntityManager.GetEntity(args.EntityID), ent.Comp.Storage); + _container.Remove(GetEntity(args.EntityID), ent.Comp.Storage); UpdateUserInterfaceState(ent, ent.Comp); } diff --git a/Content.Server/Kitchen/EntitySystems/SharpSystem.cs b/Content.Server/Kitchen/EntitySystems/SharpSystem.cs index 4b4e16b5db..cce5fb5bd3 100644 --- a/Content.Server/Kitchen/EntitySystems/SharpSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/SharpSystem.cs @@ -135,9 +135,9 @@ public sealed class SharpSystem : EntitySystem args.Handled = true; _adminLogger.Add(LogType.Gib, - $"{EntityManager.ToPrettyString(args.User):user} " + - $"has butchered {EntityManager.ToPrettyString(args.Target):target} " + - $"with {EntityManager.ToPrettyString(args.Used):knife}"); + $"{ToPrettyString(args.User):user} " + + $"has butchered {ToPrettyString(args.Target):target} " + + $"with {ToPrettyString(args.Used):knife}"); } private void OnGetInteractionVerbs(EntityUid uid, ButcherableComponent component, GetVerbsEvent args) diff --git a/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs b/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs index 393f564b2f..f643bec73f 100644 --- a/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs +++ b/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs @@ -209,7 +209,7 @@ namespace Content.Server.Light.EntitySystems component.CurrentState = ExpendableLightState.BrandNew; component.StateExpiryTime = (float)component.GlowDuration.TotalSeconds; - EntityManager.EnsureComponent(uid); + EnsureComp(uid); } private void OnExpLightUse(Entity ent, ref UseInHandEvent args) diff --git a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs index b98ba15623..b5b9f20432 100644 --- a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs +++ b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs @@ -76,7 +76,7 @@ namespace Content.Server.Light.EntitySystems // TODO: Use ContainerFill dog if (light.HasLampOnSpawn != null) { - var entity = EntityManager.SpawnEntity(light.HasLampOnSpawn, EntityManager.GetComponent(uid).Coordinates); + var entity = Spawn(light.HasLampOnSpawn, Comp(uid).Coordinates); _containerSystem.Insert(entity, light.LightBulbContainer); } // need this to update visualizers @@ -134,7 +134,7 @@ namespace Content.Server.Light.EntitySystems return false; // check if bulb fits - if (!EntityManager.TryGetComponent(bulbUid, out LightBulbComponent? lightBulb)) + if (!TryComp(bulbUid, out LightBulbComponent? lightBulb)) return false; if (lightBulb.Type != light.BulbType) return false; @@ -226,7 +226,7 @@ namespace Content.Server.Light.EntitySystems // check bulb state var bulbUid = GetBulb(uid, light); - if (bulbUid == null || !EntityManager.TryGetComponent(bulbUid.Value, out LightBulbComponent? lightBulb)) + if (bulbUid == null || !TryComp(bulbUid.Value, out LightBulbComponent? lightBulb)) return false; if (lightBulb.State == LightBulbState.Broken) return false; @@ -252,7 +252,7 @@ namespace Content.Server.Light.EntitySystems // check if light has bulb var bulbUid = GetBulb(uid, light); - if (bulbUid == null || !EntityManager.TryGetComponent(bulbUid.Value, out LightBulbComponent? lightBulb)) + if (bulbUid == null || !TryComp(bulbUid.Value, out LightBulbComponent? lightBulb)) { SetLight(uid, false, light: light); powerReceiver.Load = 0; @@ -348,7 +348,7 @@ namespace Content.Server.Light.EntitySystems light.IsBlinking = isNowBlinking; - if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (!TryComp(uid, out AppearanceComponent? appearance)) return; _appearance.SetData(uid, PoweredLightVisuals.Blinking, isNowBlinking, appearance); @@ -384,7 +384,7 @@ namespace Content.Server.Light.EntitySystems light.CurrentLit = value; _ambientSystem.SetAmbience(uid, value); - if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLight)) + if (TryComp(uid, out PointLightComponent? pointLight)) { _pointLight.SetEnabled(uid, value, pointLight); diff --git a/Content.Server/MassMedia/Systems/NewsSystem.cs b/Content.Server/MassMedia/Systems/NewsSystem.cs index 6c4a62ff09..16a7243815 100644 --- a/Content.Server/MassMedia/Systems/NewsSystem.cs +++ b/Content.Server/MassMedia/Systems/NewsSystem.cs @@ -404,7 +404,7 @@ public sealed class NewsSystem : SharedNewsSystem if (_webhookSendDuringRound) return; - var query = EntityManager.EntityQueryEnumerator(); + var query = EntityQueryEnumerator(); while (query.MoveNext(out _, out var comp)) { diff --git a/Content.Server/Mech/Systems/MechAssemblySystem.cs b/Content.Server/Mech/Systems/MechAssemblySystem.cs index 4b408343b7..bfd88d53b9 100644 --- a/Content.Server/Mech/Systems/MechAssemblySystem.cs +++ b/Content.Server/Mech/Systems/MechAssemblySystem.cs @@ -62,6 +62,6 @@ public sealed class MechAssemblySystem : EntitySystem return; } Spawn(component.FinishedPrototype, Transform(uid).Coordinates); - EntityManager.DeleteEntity(uid); + Del(uid); } } diff --git a/Content.Server/Medical/HealingSystem.cs b/Content.Server/Medical/HealingSystem.cs index acbbce9e50..c18f29d2fb 100644 --- a/Content.Server/Medical/HealingSystem.cs +++ b/Content.Server/Medical/HealingSystem.cs @@ -106,12 +106,12 @@ public sealed class HealingSystem : EntitySystem if (entity.Owner != args.User) { _adminLogger.Add(LogType.Healed, - $"{EntityManager.ToPrettyString(args.User):user} healed {EntityManager.ToPrettyString(entity.Owner):target} for {total:damage} damage"); + $"{ToPrettyString(args.User):user} healed {ToPrettyString(entity.Owner):target} for {total:damage} damage"); } else { _adminLogger.Add(LogType.Healed, - $"{EntityManager.ToPrettyString(args.User):user} healed themselves for {total:damage} damage"); + $"{ToPrettyString(args.User):user} healed themselves for {total:damage} damage"); } _audio.PlayPvs(healing.HealingEndSound, entity.Owner); diff --git a/Content.Server/Medical/SuitSensors/SuitSensorSystem.cs b/Content.Server/Medical/SuitSensors/SuitSensorSystem.cs index 2ab09e746f..cb0fbd736c 100644 --- a/Content.Server/Medical/SuitSensors/SuitSensorSystem.cs +++ b/Content.Server/Medical/SuitSensors/SuitSensorSystem.cs @@ -67,7 +67,7 @@ public sealed class SuitSensorSystem : EntitySystem base.Update(frameTime); var curTime = _gameTiming.CurTime; - var sensors = EntityManager.EntityQueryEnumerator(); + var sensors = EntityQueryEnumerator(); while (sensors.MoveNext(out var uid, out var sensor, out var device)) { @@ -391,7 +391,7 @@ public sealed class SuitSensorSystem : EntitySystem // get health mob state var isAlive = false; - if (EntityManager.TryGetComponent(sensor.User.Value, out MobStateComponent? mobState)) + if (TryComp(sensor.User.Value, out MobStateComponent? mobState)) isAlive = !_mobStateSystem.IsDead(sensor.User.Value, mobState); // get mob total damage diff --git a/Content.Server/Morgue/CrematoriumSystem.cs b/Content.Server/Morgue/CrematoriumSystem.cs index 52f5ca312d..387be509e9 100644 --- a/Content.Server/Morgue/CrematoriumSystem.cs +++ b/Content.Server/Morgue/CrematoriumSystem.cs @@ -134,7 +134,7 @@ public sealed class CrematoriumSystem : EntitySystem { var item = storage.Contents.ContainedEntities[i]; _containers.Remove(item, storage.Contents); - EntityManager.DeleteEntity(item); + Del(item); } var ash = Spawn("Ash", Transform(uid).Coordinates); _containers.Insert(ash, storage.Contents); @@ -172,7 +172,7 @@ public sealed class CrematoriumSystem : EntitySystem } else { - EntityManager.DeleteEntity(victim); + Del(victim); } _entityStorage.CloseStorage(uid); Cremate(uid, component); diff --git a/Content.Server/NPC/Systems/NPCSteeringSystem.cs b/Content.Server/NPC/Systems/NPCSteeringSystem.cs index 78610be77e..6a736f3bc9 100644 --- a/Content.Server/NPC/Systems/NPCSteeringSystem.cs +++ b/Content.Server/NPC/Systems/NPCSteeringSystem.cs @@ -205,7 +205,7 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem if (!Resolve(uid, ref component, false)) return; - if (EntityManager.TryGetComponent(uid, out InputMoverComponent? controller)) + if (TryComp(uid, out InputMoverComponent? controller)) { controller.CurTickSprintMovement = Vector2.Zero; diff --git a/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs b/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs index 200554faa3..5c0aca1578 100644 --- a/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs @@ -45,7 +45,7 @@ namespace Content.Server.Nutrition.EntitySystems var coordinates = Transform(uid).Coordinates; _audio.PlayPvs(_audio.ResolveSound(creamPie.Sound), coordinates, AudioParams.Default.WithVariation(0.125f)); - if (EntityManager.TryGetComponent(uid, out FoodComponent? foodComp)) + if (TryComp(uid, out FoodComponent? foodComp)) { if (_solutions.TryGetSolution(uid, foodComp.Solution, out _, out var solution)) { @@ -53,12 +53,12 @@ namespace Content.Server.Nutrition.EntitySystems } foreach (var trash in foodComp.Trash) { - EntityManager.SpawnEntity(trash, Transform(uid).Coordinates); + Spawn(trash, Transform(uid).Coordinates); } } ActivatePayload(uid); - EntityManager.QueueDeleteEntity(uid); + QueueDel(uid); } private void OnConsume(Entity entity, ref ConsumeDoAfterEvent args) diff --git a/Content.Server/Nutrition/EntitySystems/SmokingSystem.Cigar.cs b/Content.Server/Nutrition/EntitySystems/SmokingSystem.Cigar.cs index 510b9552a3..48e5b1a0c0 100644 --- a/Content.Server/Nutrition/EntitySystems/SmokingSystem.Cigar.cs +++ b/Content.Server/Nutrition/EntitySystems/SmokingSystem.Cigar.cs @@ -21,7 +21,7 @@ namespace Content.Server.Nutrition.EntitySystems if (args.Handled || !args.Complex) return; - if (!EntityManager.TryGetComponent(entity, out SmokableComponent? smokable)) + if (!TryComp(entity, out SmokableComponent? smokable)) return; if (smokable.State != SmokableState.Lit) @@ -36,7 +36,7 @@ namespace Content.Server.Nutrition.EntitySystems if (args.Handled) return; - if (!EntityManager.TryGetComponent(entity, out SmokableComponent? smokable)) + if (!TryComp(entity, out SmokableComponent? smokable)) return; if (smokable.State != SmokableState.Unlit) @@ -57,7 +57,7 @@ namespace Content.Server.Nutrition.EntitySystems var targetEntity = args.Target; if (targetEntity == null || !args.CanReach || - !EntityManager.TryGetComponent(entity, out SmokableComponent? smokable) || + !TryComp(entity, out SmokableComponent? smokable) || smokable.State == SmokableState.Lit) return; diff --git a/Content.Server/Nutrition/EntitySystems/SmokingSystem.SmokingPipe.cs b/Content.Server/Nutrition/EntitySystems/SmokingSystem.SmokingPipe.cs index 26d86acd54..9a1d64b2eb 100644 --- a/Content.Server/Nutrition/EntitySystems/SmokingSystem.SmokingPipe.cs +++ b/Content.Server/Nutrition/EntitySystems/SmokingSystem.SmokingPipe.cs @@ -30,7 +30,7 @@ namespace Content.Server.Nutrition.EntitySystems if (args.Handled) return; - if (!EntityManager.TryGetComponent(entity, out SmokableComponent? smokable)) + if (!TryComp(entity, out SmokableComponent? smokable)) return; if (smokable.State != SmokableState.Unlit) @@ -52,7 +52,7 @@ namespace Content.Server.Nutrition.EntitySystems var targetEntity = args.Target; if (targetEntity == null || !args.CanReach || - !EntityManager.TryGetComponent(entity, out SmokableComponent? smokable) || + !TryComp(entity, out SmokableComponent? smokable) || smokable.State == SmokableState.Lit) return; @@ -91,7 +91,7 @@ namespace Content.Server.Nutrition.EntitySystems _solutionContainerSystem.TryAddSolution(pipeSolution.Value, reagentSolution); } - EntityManager.DeleteEntity(contents); + Del(contents); _itemSlotsSystem.SetLock(entity.Owner, entity.Comp.BowlSlot, true); //no inserting more until current runs out diff --git a/Content.Server/Nutrition/EntitySystems/SmokingSystem.Vape.cs b/Content.Server/Nutrition/EntitySystems/SmokingSystem.Vape.cs index 72b8396051..fa5ec0a1bf 100644 --- a/Content.Server/Nutrition/EntitySystems/SmokingSystem.Vape.cs +++ b/Content.Server/Nutrition/EntitySystems/SmokingSystem.Vape.cs @@ -64,7 +64,7 @@ namespace Content.Server.Nutrition.EntitySystems if (entity.Comp.ExplodeOnUse || _emag.CheckFlag(entity, EmagType.Interaction)) { _explosionSystem.QueueExplosion(entity.Owner, "Default", entity.Comp.ExplosionIntensity, 0.5f, 3, canCreateVacuum: false); - EntityManager.DeleteEntity(entity); + Del(entity); exploded = true; } else @@ -80,7 +80,7 @@ namespace Content.Server.Nutrition.EntitySystems { exploded = true; _explosionSystem.QueueExplosion(entity.Owner, "Default", entity.Comp.ExplosionIntensity, 0.5f, 3, canCreateVacuum: false); - EntityManager.DeleteEntity(entity); + Del(entity); break; } } diff --git a/Content.Server/Nutrition/EntitySystems/TrashOnSolutionEmptySystem.cs b/Content.Server/Nutrition/EntitySystems/TrashOnSolutionEmptySystem.cs index ea3a8be9cb..08ff0c1d41 100644 --- a/Content.Server/Nutrition/EntitySystems/TrashOnSolutionEmptySystem.cs +++ b/Content.Server/Nutrition/EntitySystems/TrashOnSolutionEmptySystem.cs @@ -33,7 +33,7 @@ namespace Content.Server.Nutrition.EntitySystems public void CheckSolutions(Entity entity) { - if (!EntityManager.HasComponent(entity)) + if (!HasComp(entity)) return; if (_solutionContainerSystem.TryGetSolution(entity.Owner, entity.Comp.Solution, out _, out var solution)) diff --git a/Content.Server/Payload/EntitySystems/PayloadSystem.cs b/Content.Server/Payload/EntitySystems/PayloadSystem.cs index e16e8884b2..18444bc590 100644 --- a/Content.Server/Payload/EntitySystems/PayloadSystem.cs +++ b/Content.Server/Payload/EntitySystems/PayloadSystem.cs @@ -102,7 +102,7 @@ public sealed class PayloadSystem : EntitySystem var temp = (object) component; _serializationManager.CopyTo(data.Component, ref temp); - EntityManager.AddComponent(uid, (Component) temp!); + AddComp(uid, (Component) temp!); trigger.GrantedComponents.Add(registration.Type); } @@ -117,7 +117,7 @@ public sealed class PayloadSystem : EntitySystem foreach (var type in trigger.GrantedComponents) { - EntityManager.RemoveComponent(uid, type); + RemComp(uid, type); } trigger.GrantedComponents.Clear(); diff --git a/Content.Server/Physics/Controllers/RandomWalkController.cs b/Content.Server/Physics/Controllers/RandomWalkController.cs index 55d3d50d2a..fad6493524 100644 --- a/Content.Server/Physics/Controllers/RandomWalkController.cs +++ b/Content.Server/Physics/Controllers/RandomWalkController.cs @@ -43,9 +43,9 @@ internal sealed class RandomWalkController : VirtualController var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var randomWalk, out var physics)) { - if (EntityManager.HasComponent(uid) - || EntityManager.HasComponent(uid) - || EntityManager.HasComponent(uid)) + if (HasComp(uid) + || HasComp(uid) + || HasComp(uid)) continue; var curTime = _timing.CurTime; diff --git a/Content.Server/Pinpointer/PinpointerSystem.cs b/Content.Server/Pinpointer/PinpointerSystem.cs index eebf9cbbfd..22eb26b16b 100644 --- a/Content.Server/Pinpointer/PinpointerSystem.cs +++ b/Content.Server/Pinpointer/PinpointerSystem.cs @@ -144,7 +144,7 @@ public sealed class PinpointerSystem : SharedPinpointerSystem return; var target = pinpointer.Target; - if (target == null || !EntityManager.EntityExists(target.Value)) + if (target == null || !Exists(target.Value)) { SetDistance(uid, Distance.Unknown, pinpointer); return; diff --git a/Content.Server/Pointing/EntitySystems/PointingSystem.cs b/Content.Server/Pointing/EntitySystems/PointingSystem.cs index e12cb24ca7..52f13474e6 100644 --- a/Content.Server/Pointing/EntitySystems/PointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/PointingSystem.cs @@ -160,7 +160,7 @@ namespace Content.Server.Pointing.EntitySystems var mapCoordsPointed = _transform.ToMapCoordinates(coordsPointed); _rotateToFaceSystem.TryFaceCoordinates(player, mapCoordsPointed.Position); - var arrow = EntityManager.SpawnEntity("PointingArrow", coordsPointed); + var arrow = Spawn("PointingArrow", coordsPointed); if (TryComp(arrow, out var pointing)) { @@ -181,7 +181,7 @@ namespace Content.Server.Pointing.EntitySystems var layer = (int) VisibilityFlags.Normal; if (TryComp(player, out VisibilityComponent? playerVisibility)) { - var arrowVisibility = EntityManager.EnsureComponent(arrow); + var arrowVisibility = EnsureComp(arrow); layer = playerVisibility.Layer; _visibilitySystem.SetLayer((arrow, arrowVisibility), (ushort) layer); } diff --git a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs index 1edcec6677..cc22611627 100644 --- a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs @@ -62,7 +62,7 @@ namespace Content.Server.Pointing.EntitySystems if (component.Chasing is not {Valid: true} chasing || Deleted(chasing)) { - EntityManager.QueueDeleteEntity(uid); + QueueDel(uid); continue; } @@ -99,7 +99,7 @@ namespace Content.Server.Pointing.EntitySystems _explosion.QueueExplosion(uid, ExplosionSystem.DefaultExplosionPrototypeId, 50, 3, 10); - EntityManager.QueueDeleteEntity(uid); + QueueDel(uid); } } } diff --git a/Content.Server/Power/EntitySystems/CableSystem.Placer.cs b/Content.Server/Power/EntitySystems/CableSystem.Placer.cs index 5d9105a3fc..55d517cf7d 100644 --- a/Content.Server/Power/EntitySystems/CableSystem.Placer.cs +++ b/Content.Server/Power/EntitySystems/CableSystem.Placer.cs @@ -48,7 +48,7 @@ public sealed partial class CableSystem if (TryComp(placer, out var stack) && !_stack.Use(placer, 1, stack)) return; - var newCable = EntityManager.SpawnEntity(component.CablePrototypeId, _map.GridTileToLocal(gridUid, grid, snapPos)); + var newCable = Spawn(component.CablePrototypeId, _map.GridTileToLocal(gridUid, grid, snapPos)); _adminLogger.Add(LogType.Construction, LogImpact.Low, $"{ToPrettyString(args.User):player} placed {ToPrettyString(newCable):cable} at {Transform(newCable).Coordinates}"); args.Handled = true; diff --git a/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs b/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs index 89f32166ae..fd6ff70f77 100644 --- a/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs +++ b/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs @@ -174,7 +174,7 @@ namespace Content.Server.Power.EntitySystems private void OnReceiverStarted(Entity receiver, ref ComponentStartup args) { - if (EntityManager.TryGetComponent(receiver.Owner, out PhysicsComponent? physicsComponent)) + if (TryComp(receiver.Owner, out PhysicsComponent? physicsComponent)) { receiver.Comp.Connectable = physicsComponent.BodyType == BodyType.Static; } diff --git a/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs b/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs index 7b41af66b9..be79d64fc9 100644 --- a/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs +++ b/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs @@ -80,7 +80,7 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori private void OnPowerMonitoringConsoleMessage(EntityUid uid, PowerMonitoringConsoleComponent component, PowerMonitoringConsoleMessage args) { - var focus = EntityManager.GetEntity(args.FocusDevice); + var focus = GetEntity(args.FocusDevice); var group = args.FocusGroup; // Update this if the focus device has changed @@ -207,17 +207,17 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori if (!args.Anchored) { - entConsole.PowerMonitoringDeviceMetaData.Remove(EntityManager.GetNetEntity(uid)); + entConsole.PowerMonitoringDeviceMetaData.Remove(GetNetEntity(uid)); Dirty(ent, entConsole); continue; } var name = MetaData(uid).EntityName; - var coords = EntityManager.GetNetCoordinates(xform.Coordinates); + var coords = GetNetCoordinates(xform.Coordinates); var metaData = new PowerMonitoringDeviceMetaData(name, coords, component.Group, component.SpritePath, component.SpriteState); - entConsole.PowerMonitoringDeviceMetaData.TryAdd(EntityManager.GetNetEntity(uid), metaData); + entConsole.PowerMonitoringDeviceMetaData.TryAdd(GetNetEntity(uid), metaData); Dirty(ent, entConsole); } @@ -364,7 +364,7 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori continue; // Generate a new console entry with which to populate the UI - var entry = new PowerMonitoringConsoleEntry(EntityManager.GetNetEntity(ent), device.Group, powerStats.PowerValue, powerStats.BatteryLevel); + var entry = new PowerMonitoringConsoleEntry(GetNetEntity(ent), device.Group, powerStats.PowerValue, powerStats.BatteryLevel); allEntries.Add(entry); } @@ -548,7 +548,7 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori continue; } - indexedSources.Add(ent, new PowerMonitoringConsoleEntry(EntityManager.GetNetEntity(ent), entDevice.Group, powerSupplier.CurrentSupply, GetBatteryLevel(ent))); + indexedSources.Add(ent, new PowerMonitoringConsoleEntry(GetNetEntity(ent), entDevice.Group, powerSupplier.CurrentSupply, GetBatteryLevel(ent))); } } @@ -578,7 +578,7 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori continue; } - indexedSources.Add(ent, new PowerMonitoringConsoleEntry(EntityManager.GetNetEntity(ent), entDevice.Group, entBattery.CurrentSupply, GetBatteryLevel(ent))); + indexedSources.Add(ent, new PowerMonitoringConsoleEntry(GetNetEntity(ent), entDevice.Group, entBattery.CurrentSupply, GetBatteryLevel(ent))); } } @@ -662,7 +662,7 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori continue; } - indexedLoads.Add(ent, new PowerMonitoringConsoleEntry(EntityManager.GetNetEntity(ent), entDevice.Group, powerConsumer.ReceivedPower, GetBatteryLevel(ent))); + indexedLoads.Add(ent, new PowerMonitoringConsoleEntry(GetNetEntity(ent), entDevice.Group, powerConsumer.ReceivedPower, GetBatteryLevel(ent))); } } @@ -692,7 +692,7 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori continue; } - indexedLoads.Add(ent, new PowerMonitoringConsoleEntry(EntityManager.GetNetEntity(ent), entDevice.Group, battery.CurrentReceiving, GetBatteryLevel(ent))); + indexedLoads.Add(ent, new PowerMonitoringConsoleEntry(GetNetEntity(ent), entDevice.Group, battery.CurrentReceiving, GetBatteryLevel(ent))); } } @@ -831,7 +831,7 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori private void UpdateCollectionChildMetaData(EntityUid child, EntityUid master) { - var netEntity = EntityManager.GetNetEntity(child); + var netEntity = GetNetEntity(child); var xform = Transform(child); var query = AllEntityQuery(); @@ -843,7 +843,7 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori if (!entConsole.PowerMonitoringDeviceMetaData.TryGetValue(netEntity, out var metaData)) continue; - metaData.CollectionMaster = EntityManager.GetNetEntity(master); + metaData.CollectionMaster = GetNetEntity(master); entConsole.PowerMonitoringDeviceMetaData[netEntity] = metaData; Dirty(ent, entConsole); @@ -852,7 +852,7 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori private void UpdateCollectionMasterMetaData(EntityUid master, int childCount) { - var netEntity = EntityManager.GetNetEntity(master); + var netEntity = GetNetEntity(master); var xform = Transform(master); var query = AllEntityQuery(); @@ -960,9 +960,9 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori if (grid != entXform.GridUid) continue; - var netEntity = EntityManager.GetNetEntity(ent); + var netEntity = GetNetEntity(ent); var name = MetaData(ent).EntityName; - var netCoords = EntityManager.GetNetCoordinates(entXform.Coordinates); + var netCoords = GetNetCoordinates(entXform.Coordinates); var metaData = new PowerMonitoringDeviceMetaData(name, netCoords, entDevice.Group, entDevice.SpritePath, entDevice.SpriteState); @@ -970,7 +970,7 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori { if (!entDevice.IsCollectionMaster) { - metaData.CollectionMaster = EntityManager.GetNetEntity(entDevice.CollectionMaster); + metaData.CollectionMaster = GetNetEntity(entDevice.CollectionMaster); } else if (entDevice.ChildDevices.Count > 0) diff --git a/Content.Server/PowerSink/PowerSinkSystem.cs b/Content.Server/PowerSink/PowerSinkSystem.cs index b8bdcd91f1..ef08240c5c 100644 --- a/Content.Server/PowerSink/PowerSinkSystem.cs +++ b/Content.Server/PowerSink/PowerSinkSystem.cs @@ -111,7 +111,7 @@ namespace Content.Server.PowerSink foreach (var (entity, component) in toRemove) { _explosionSystem.QueueExplosion(entity, "PowerSink", 2000f, 4f, 20f, canCreateVacuum: true); - EntityManager.RemoveComponent(entity, component); + RemComp(entity, component); } } diff --git a/Content.Server/Prayer/PrayerSystem.cs b/Content.Server/Prayer/PrayerSystem.cs index 59fd9a5d69..4235fa2a1c 100644 --- a/Content.Server/Prayer/PrayerSystem.cs +++ b/Content.Server/Prayer/PrayerSystem.cs @@ -35,7 +35,7 @@ public sealed class PrayerSystem : EntitySystem private void AddPrayVerb(EntityUid uid, PrayableComponent comp, GetVerbsEvent args) { // if it doesn't have an actor and we can't reach it then don't add the verb - if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) + if (!TryComp(args.User, out ActorComponent? actor)) return; // this is to prevent ghosts from using it @@ -48,7 +48,7 @@ public sealed class PrayerSystem : EntitySystem Icon = comp.VerbImage, Act = () => { - if (comp.BibleUserOnly && !EntityManager.TryGetComponent(args.User, out var bibleUser)) + if (comp.BibleUserOnly && !TryComp(args.User, out var bibleUser)) { _popupSystem.PopupEntity(Loc.GetString("prayer-popup-notify-pray-locked"), uid, actor.PlayerSession, PopupType.Large); return; diff --git a/Content.Server/Procedural/DungeonSystem.Commands.cs b/Content.Server/Procedural/DungeonSystem.Commands.cs index 09e881686e..01cc6d3676 100644 --- a/Content.Server/Procedural/DungeonSystem.Commands.cs +++ b/Content.Server/Procedural/DungeonSystem.Commands.cs @@ -47,7 +47,7 @@ public sealed partial class DungeonSystem if (!TryComp(dungeonUid, out var dungeonGrid)) { dungeonUid = EntityManager.CreateEntityUninitialized(null, new EntityCoordinates(dungeonUid, position)); - dungeonGrid = EntityManager.AddComponent(dungeonUid); + dungeonGrid = AddComp(dungeonUid); EntityManager.InitializeAndStartEntity(dungeonUid, mapId); // If we created a grid (e.g. space dungen) then offset it so we don't double-apply positions position = Vector2i.Zero; diff --git a/Content.Server/Projectiles/ProjectileSystem.cs b/Content.Server/Projectiles/ProjectileSystem.cs index 64bb678321..4c054a4561 100644 --- a/Content.Server/Projectiles/ProjectileSystem.cs +++ b/Content.Server/Projectiles/ProjectileSystem.cs @@ -57,7 +57,7 @@ public sealed class ProjectileSystem : SharedProjectileSystem var modifiedDamage = _damageableSystem.TryChangeDamage(target, ev.Damage, component.IgnoreResistances, damageable: damageableComponent, origin: component.Shooter); var deleted = Deleted(target); - if (modifiedDamage is not null && EntityManager.EntityExists(component.Shooter)) + if (modifiedDamage is not null && Exists(component.Shooter)) { if (modifiedDamage.AnyPositive() && !deleted) { diff --git a/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs b/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs index ffcf12b9d8..796c1e1fce 100644 --- a/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs +++ b/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs @@ -35,7 +35,7 @@ public partial class RadiationSystem stopwatch.Start(); _sources.Clear(); - _sources.EnsureCapacity(EntityManager.Count()); + _sources.EnsureCapacity(Count()); var sources = EntityQueryEnumerator(); var destinations = EntityQueryEnumerator(); diff --git a/Content.Server/Repairable/RepairableSystem.cs b/Content.Server/Repairable/RepairableSystem.cs index 68dcfd6743..c05a13c387 100644 --- a/Content.Server/Repairable/RepairableSystem.cs +++ b/Content.Server/Repairable/RepairableSystem.cs @@ -26,7 +26,7 @@ namespace Content.Server.Repairable if (args.Cancelled) return; - if (!EntityManager.TryGetComponent(uid, out DamageableComponent? damageable) || damageable.TotalDamage == 0) + if (!TryComp(uid, out DamageableComponent? damageable) || damageable.TotalDamage == 0) return; if (component.Damage != null) diff --git a/Content.Server/Research/Disk/ResearchDiskSystem.cs b/Content.Server/Research/Disk/ResearchDiskSystem.cs index 4d65c19f6e..2e30367a1c 100644 --- a/Content.Server/Research/Disk/ResearchDiskSystem.cs +++ b/Content.Server/Research/Disk/ResearchDiskSystem.cs @@ -30,7 +30,7 @@ namespace Content.Server.Research.Disk _research.ModifyServerPoints(args.Target.Value, component.Points, server); _popupSystem.PopupEntity(Loc.GetString("research-disk-inserted", ("points", component.Points)), args.Target.Value, args.User); - EntityManager.QueueDeleteEntity(uid); + QueueDel(uid); args.Handled = true; } diff --git a/Content.Server/Rotatable/RotatableSystem.cs b/Content.Server/Rotatable/RotatableSystem.cs index 32f8c91403..5190b0e92e 100644 --- a/Content.Server/Rotatable/RotatableSystem.cs +++ b/Content.Server/Rotatable/RotatableSystem.cs @@ -43,7 +43,7 @@ namespace Content.Server.Rotatable return; // Check if the object is anchored. - if (EntityManager.TryGetComponent(uid, out PhysicsComponent? physics) && physics.BodyType == BodyType.Static) + if (TryComp(uid, out PhysicsComponent? physics) && physics.BodyType == BodyType.Static) return; Verb verb = new() @@ -68,14 +68,14 @@ namespace Content.Server.Rotatable // Check if the object is anchored, and whether we are still allowed to rotate it. if (!component.RotateWhileAnchored && - EntityManager.TryGetComponent(uid, out PhysicsComponent? physics) && + TryComp(uid, out PhysicsComponent? physics) && physics.BodyType == BodyType.Static) return; Verb resetRotation = new() { DoContactInteraction = true, - Act = () => EntityManager.GetComponent(uid).LocalRotation = Angle.Zero, + Act = () => Comp(uid).LocalRotation = Angle.Zero, Category = VerbCategory.Rotate, Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/refresh.svg.192dpi.png")), Text = "Reset", @@ -87,7 +87,7 @@ namespace Content.Server.Rotatable // rotate clockwise Verb rotateCW = new() { - Act = () => EntityManager.GetComponent(uid).LocalRotation -= component.Increment, + Act = () => Comp(uid).LocalRotation -= component.Increment, Category = VerbCategory.Rotate, Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/rotate_cw.svg.192dpi.png")), Priority = -1, @@ -98,7 +98,7 @@ namespace Content.Server.Rotatable // rotate counter-clockwise Verb rotateCCW = new() { - Act = () => EntityManager.GetComponent(uid).LocalRotation += component.Increment, + Act = () => Comp(uid).LocalRotation += component.Increment, Category = VerbCategory.Rotate, Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/rotate_ccw.svg.192dpi.png")), Priority = 0, @@ -112,12 +112,12 @@ namespace Content.Server.Rotatable /// public void Flip(EntityUid uid, FlippableComponent component) { - var oldTransform = EntityManager.GetComponent(uid); - var entity = EntityManager.SpawnEntity(component.MirrorEntity, oldTransform.Coordinates); - var newTransform = EntityManager.GetComponent(entity); + var oldTransform = Comp(uid); + var entity = Spawn(component.MirrorEntity, oldTransform.Coordinates); + var newTransform = Comp(entity); newTransform.LocalRotation = oldTransform.LocalRotation; _transform.Unanchor(entity, newTransform); - EntityManager.DeleteEntity(uid); + Del(uid); } public bool HandleRotateObjectClockwise(ICommonSession? playerSession, EntityCoordinates coordinates, EntityUid entity) @@ -134,7 +134,7 @@ namespace Content.Server.Rotatable return false; // Check if the object is anchored, and whether we are still allowed to rotate it. - if (!rotatableComp.RotateWhileAnchored && EntityManager.TryGetComponent(entity, out PhysicsComponent? physics) && + if (!rotatableComp.RotateWhileAnchored && TryComp(entity, out PhysicsComponent? physics) && physics.BodyType == BodyType.Static) { _popup.PopupEntity(Loc.GetString("rotatable-component-try-rotate-stuck"), entity, player); @@ -159,7 +159,7 @@ namespace Content.Server.Rotatable return false; // Check if the object is anchored, and whether we are still allowed to rotate it. - if (!rotatableComp.RotateWhileAnchored && EntityManager.TryGetComponent(entity, out PhysicsComponent? physics) && + if (!rotatableComp.RotateWhileAnchored && TryComp(entity, out PhysicsComponent? physics) && physics.BodyType == BodyType.Static) { _popup.PopupEntity(Loc.GetString("rotatable-component-try-rotate-stuck"), entity, player); @@ -184,7 +184,7 @@ namespace Content.Server.Rotatable return false; // Check if the object is anchored. - if (EntityManager.TryGetComponent(entity, out PhysicsComponent? physics) && physics.BodyType == BodyType.Static) + if (TryComp(entity, out PhysicsComponent? physics) && physics.BodyType == BodyType.Static) { _popup.PopupEntity(Loc.GetString("flippable-component-try-flip-is-stuck"), entity, player); return false; diff --git a/Content.Server/Shuttles/Systems/DockingSystem.cs b/Content.Server/Shuttles/Systems/DockingSystem.cs index fcdd6c0c1a..318affda2e 100644 --- a/Content.Server/Shuttles/Systems/DockingSystem.cs +++ b/Content.Server/Shuttles/Systems/DockingSystem.cs @@ -94,7 +94,7 @@ namespace Content.Server.Shuttles.Systems private void OnShutdown(EntityUid uid, DockingComponent component, ComponentShutdown args) { if (component.DockedWith == null || - EntityManager.GetComponent(uid).EntityLifeStage > EntityLifeStage.MapInitialized) + Comp(uid).EntityLifeStage > EntityLifeStage.MapInitialized) { return; } @@ -137,8 +137,8 @@ namespace Content.Server.Shuttles.Systems dockA.DockJointId = null; // If these grids are ever null then need to look at fixing ordering for unanchored events elsewhere. - var gridAUid = EntityManager.GetComponent(dockAUid).GridUid; - var gridBUid = EntityManager.GetComponent(dockBUid.Value).GridUid; + var gridAUid = Comp(dockAUid).GridUid; + var gridBUid = Comp(dockBUid.Value).GridUid; var msg = new UndockEvent { @@ -159,7 +159,7 @@ namespace Content.Server.Shuttles.Systems var component = entity.Comp; // Use startup so transform already initialized - if (!EntityManager.GetComponent(uid).Anchored) + if (!Comp(uid).Anchored) return; // This little gem is for docking deserialization @@ -169,7 +169,7 @@ namespace Content.Server.Shuttles.Systems if (MetaData(component.DockedWith.Value).EntityLifeStage < EntityLifeStage.Initialized) return; - var otherDock = EntityManager.GetComponent(component.DockedWith.Value); + var otherDock = Comp(component.DockedWith.Value); DebugTools.Assert(otherDock.DockedWith != null); Dock((uid, component), (component.DockedWith.Value, otherDock)); @@ -220,8 +220,8 @@ namespace Content.Server.Shuttles.Systems // https://gamedev.stackexchange.com/questions/98772/b2distancejoint-with-frequency-equal-to-0-vs-b2weldjoint // We could also potentially use a prismatic joint? Depending if we want clamps that can extend or whatever - var dockAXform = EntityManager.GetComponent(dockAUid); - var dockBXform = EntityManager.GetComponent(dockBUid); + var dockAXform = Comp(dockAUid); + var dockBXform = Comp(dockBUid); DebugTools.Assert(dockAXform.GridUid != null); DebugTools.Assert(dockBXform.GridUid != null); @@ -235,8 +235,8 @@ namespace Content.Server.Shuttles.Systems SharedJointSystem.LinearStiffness( 2f, 0.7f, - EntityManager.GetComponent(gridA).Mass, - EntityManager.GetComponent(gridB).Mass, + Comp(gridA).Mass, + Comp(gridB).Mass, out var stiffness, out var damping); @@ -255,8 +255,8 @@ namespace Content.Server.Shuttles.Systems joint = _jointSystem.GetOrCreateWeldJoint(gridA, gridB, DockingJoint + dockAUid); } - var gridAXform = EntityManager.GetComponent(gridA); - var gridBXform = EntityManager.GetComponent(gridB); + var gridAXform = Comp(gridA); + var gridBXform = Comp(gridB); var anchorA = dockAXform.LocalPosition + dockAXform.LocalRotation.ToWorldVec() / 2f; var anchorB = dockBXform.LocalPosition + dockBXform.LocalRotation.ToWorldVec() / 2f; diff --git a/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs index 478b002e58..049e149135 100644 --- a/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs @@ -320,7 +320,7 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem public void AddPilot(EntityUid uid, EntityUid entity, ShuttleConsoleComponent component) { - if (!EntityManager.TryGetComponent(entity, out PilotComponent? pilotComponent) + if (!TryComp(entity, out PilotComponent? pilotComponent) || component.SubscribedPilots.Contains(entity)) { return; @@ -334,7 +334,7 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem pilotComponent.Console = uid; ActionBlockerSystem.UpdateCanMove(entity); - pilotComponent.Position = EntityManager.GetComponent(entity).Coordinates; + pilotComponent.Position = Comp(entity).Coordinates; Dirty(entity, pilotComponent); } @@ -357,12 +357,12 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem _popup.PopupEntity(Loc.GetString("shuttle-pilot-end"), pilotUid, pilotUid); if (pilotComponent.LifeStage < ComponentLifeStage.Stopping) - EntityManager.RemoveComponent(pilotUid); + RemComp(pilotUid); } public void RemovePilot(EntityUid entity) { - if (!EntityManager.TryGetComponent(entity, out PilotComponent? pilotComponent)) + if (!TryComp(entity, out PilotComponent? pilotComponent)) return; RemovePilot(entity, pilotComponent); diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.cs index f271be108f..cea7fbfc09 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.cs @@ -109,12 +109,12 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem private void OnShuttleStartup(EntityUid uid, ShuttleComponent component, ComponentStartup args) { - if (!EntityManager.HasComponent(uid)) + if (!HasComp(uid)) { return; } - if (!EntityManager.TryGetComponent(uid, out PhysicsComponent? physicsComponent)) + if (!TryComp(uid, out PhysicsComponent? physicsComponent)) { return; } @@ -129,7 +129,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem public void Toggle(EntityUid uid, ShuttleComponent component) { - if (!EntityManager.TryGetComponent(uid, out PhysicsComponent? physicsComponent)) + if (!TryComp(uid, out PhysicsComponent? physicsComponent)) return; component.Enabled = !component.Enabled; @@ -167,7 +167,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem private void OnShuttleShutdown(EntityUid uid, ShuttleComponent component, ComponentShutdown args) { // None of the below is necessary for any cleanup if we're just deleting. - if (EntityManager.GetComponent(uid).EntityLifeStage >= EntityLifeStage.Terminating) + if (Comp(uid).EntityLifeStage >= EntityLifeStage.Terminating) return; Disable(uid); diff --git a/Content.Server/Shuttles/Systems/ThrusterSystem.cs b/Content.Server/Shuttles/Systems/ThrusterSystem.cs index e7f93043cb..f7f0a8b251 100644 --- a/Content.Server/Shuttles/Systems/ThrusterSystem.cs +++ b/Content.Server/Shuttles/Systems/ThrusterSystem.cs @@ -68,7 +68,7 @@ public sealed class ThrusterSystem : EntitySystem args.PushMarkup(enabled); if (component.Type == ThrusterType.Linear && - EntityManager.TryGetComponent(uid, out TransformComponent? xform) && + TryComp(uid, out TransformComponent? xform) && xform.Anchored) { var nozzleLocalization = ContentLocalizationManager.FormatDirection(xform.LocalRotation.Opposite().ToWorldVec().GetDir()).ToLower(); @@ -163,8 +163,8 @@ public sealed class ThrusterSystem : EntitySystem // TODO: Don't make them rotatable and make it require anchoring. if (!component.Enabled || - !EntityManager.TryGetComponent(uid, out TransformComponent? xform) || - !EntityManager.TryGetComponent(xform.GridUid, out ShuttleComponent? shuttleComponent)) + !TryComp(uid, out TransformComponent? xform) || + !TryComp(xform.GridUid, out ShuttleComponent? shuttleComponent)) { return; } @@ -285,7 +285,7 @@ public sealed class ThrusterSystem : EntitySystem component.IsOn = true; - if (!EntityManager.TryGetComponent(xform.GridUid, out ShuttleComponent? shuttleComponent)) + if (!TryComp(xform.GridUid, out ShuttleComponent? shuttleComponent)) return; // Logger.DebugS("thruster", $"Enabled thruster {uid}"); @@ -300,7 +300,7 @@ public sealed class ThrusterSystem : EntitySystem shuttleComponent.LinearThrusters[direction].Add(uid); // Don't just add / remove the fixture whenever the thruster fires because perf - if (EntityManager.TryGetComponent(uid, out PhysicsComponent? physicsComponent) && + if (TryComp(uid, out PhysicsComponent? physicsComponent) && component.BurnPoly.Count > 0) { var shape = new PolygonShape(); @@ -318,7 +318,7 @@ public sealed class ThrusterSystem : EntitySystem throw new ArgumentOutOfRangeException(); } - if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (TryComp(uid, out AppearanceComponent? appearance)) { _appearance.SetData(uid, ThrusterVisualState.State, true, appearance); } @@ -382,7 +382,7 @@ public sealed class ThrusterSystem : EntitySystem component.IsOn = false; - if (!EntityManager.TryGetComponent(gridId, out ShuttleComponent? shuttleComponent)) + if (!TryComp(gridId, out ShuttleComponent? shuttleComponent)) return; // Logger.DebugS("thruster", $"Disabled thruster {uid}"); @@ -406,7 +406,7 @@ public sealed class ThrusterSystem : EntitySystem throw new ArgumentOutOfRangeException(); } - if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (TryComp(uid, out AppearanceComponent? appearance)) { _appearance.SetData(uid, ThrusterVisualState.State, false, appearance); } @@ -418,7 +418,7 @@ public sealed class ThrusterSystem : EntitySystem _ambient.SetAmbience(uid, false); - if (EntityManager.TryGetComponent(uid, out PhysicsComponent? physicsComponent)) + if (TryComp(uid, out PhysicsComponent? physicsComponent)) { _fixtureSystem.DestroyFixture(uid, BurnFixture, body: physicsComponent); } diff --git a/Content.Server/Silicons/StationAi/StationAiSystem.cs b/Content.Server/Silicons/StationAi/StationAiSystem.cs index baec24bf73..9b272a00f9 100644 --- a/Content.Server/Silicons/StationAi/StationAiSystem.cs +++ b/Content.Server/Silicons/StationAi/StationAiSystem.cs @@ -37,7 +37,7 @@ public sealed class StationAiSystem : SharedStationAiSystem var sourcePos = _xforms.GetWorldPosition(sourceXform, xformQuery); // This function ensures that chat popups appear on camera views that have connected microphones. - var query = EntityManager.EntityQueryEnumerator(); + var query = EntityQueryEnumerator(); while (query.MoveNext(out var ent, out var entStationAiCore, out var entXform)) { var stationAiCore = new Entity(ent, entStationAiCore); diff --git a/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs b/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs index 7a15ba3413..9c69422797 100644 --- a/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs +++ b/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs @@ -137,7 +137,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem _adminLogger.Add(LogType.EntityDelete, LogImpact.High, $"{ToPrettyString(morsel):player} entered the event horizon of {ToPrettyString(hungry)} and was deleted"); } - EntityManager.QueueDeleteEntity(morsel); + QueueDel(morsel); var evSelf = new EntityConsumedByEventHorizonEvent(morsel, hungry, eventHorizon, outerContainer); var evEaten = new EventHorizonConsumedEntityEvent(morsel, hungry, eventHorizon, outerContainer); RaiseLocalEvent(hungry, ref evSelf); @@ -460,14 +460,14 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem private void OnEventHorizonContained(EventHorizonContainedEvent args) { var uid = args.Entity; - if (!EntityManager.EntityExists(uid)) + if (!Exists(uid)) return; var comp = args.EventHorizon; if (comp.BeingConsumedByAnotherEventHorizon) return; var containerEntity = args.Args.Container.Owner; - if (!EntityManager.EntityExists(containerEntity)) + if (!Exists(containerEntity)) return; if (AttemptConsumeEntity(uid, containerEntity, comp)) return; // If we consume the entity we also consume everything in the containers it has. diff --git a/Content.Server/Singularity/EntitySystems/RadiationCollectorSystem.cs b/Content.Server/Singularity/EntitySystems/RadiationCollectorSystem.cs index 63ff5f8300..6cbe46c759 100644 --- a/Content.Server/Singularity/EntitySystems/RadiationCollectorSystem.cs +++ b/Content.Server/Singularity/EntitySystems/RadiationCollectorSystem.cs @@ -48,7 +48,7 @@ public sealed class RadiationCollectorSystem : EntitySystem if (!_containerSystem.TryGetContainer(uid, GasTankContainer, out var container) || container.ContainedEntities.Count == 0) return false; - if (!EntityManager.TryGetComponent(container.ContainedEntities.First(), out gasTankComponent)) + if (!TryComp(container.ContainedEntities.First(), out gasTankComponent)) return false; return true; diff --git a/Content.Server/Singularity/EntitySystems/SingularityGeneratorSystem.cs b/Content.Server/Singularity/EntitySystems/SingularityGeneratorSystem.cs index 95722449b8..8e33410561 100644 --- a/Content.Server/Singularity/EntitySystems/SingularityGeneratorSystem.cs +++ b/Content.Server/Singularity/EntitySystems/SingularityGeneratorSystem.cs @@ -53,7 +53,7 @@ public sealed class SingularityGeneratorSystem : SharedSingularityGeneratorSyste return; SetPower(uid, 0, comp); - EntityManager.SpawnEntity(comp.SpawnPrototype, Transform(uid).Coordinates); + Spawn(comp.SpawnPrototype, Transform(uid).Coordinates); } #region Getters/Setters @@ -109,12 +109,12 @@ public sealed class SingularityGeneratorSystem : SharedSingularityGeneratorSyste /// The state of the beginning of the collision. private void HandleParticleCollide(EntityUid uid, ParticleProjectileComponent component, ref StartCollideEvent args) { - if (!EntityManager.TryGetComponent(args.OtherEntity, out var generatorComp)) + if (!TryComp(args.OtherEntity, out var generatorComp)) return; if (_timing.CurTime < _metadata.GetPauseTime(uid) + generatorComp.NextFailsafe && !generatorComp.FailsafeDisabled) { - EntityManager.QueueDeleteEntity(uid); + QueueDel(uid); return; } @@ -152,7 +152,7 @@ public sealed class SingularityGeneratorSystem : SharedSingularityGeneratorSyste ); } - EntityManager.QueueDeleteEntity(uid); + QueueDel(uid); } #endregion Event Handlers diff --git a/Content.Server/Singularity/EntitySystems/SingularitySystem.cs b/Content.Server/Singularity/EntitySystems/SingularitySystem.cs index f28502fc75..f86faf9ee4 100644 --- a/Content.Server/Singularity/EntitySystems/SingularitySystem.cs +++ b/Content.Server/Singularity/EntitySystems/SingularitySystem.cs @@ -240,7 +240,7 @@ public sealed class SingularitySystem : SharedSingularitySystem private void OnConsumed(EntityUid uid, SingularityComponent comp, ref EventHorizonConsumedEntityEvent args) { // Should be slightly more efficient than checking literally everything we consume for a singularity component and doing the reverse. - if (EntityManager.TryGetComponent(args.EventHorizonUid, out var singulo)) + if (TryComp(args.EventHorizonUid, out var singulo)) { AdjustEnergy(args.EventHorizonUid, comp.Energy, singularity: singulo); SetEnergy(uid, 0.0f, comp); @@ -255,7 +255,7 @@ public sealed class SingularitySystem : SharedSingularitySystem /// The event arguments. public void OnConsumed(EntityUid uid, SinguloFoodComponent comp, ref EventHorizonConsumedEntityEvent args) { - if (EntityManager.TryGetComponent(args.EventHorizonUid, out var singulo)) + if (TryComp(args.EventHorizonUid, out var singulo)) { // Calculate the percentage change (positive or negative) var percentageChange = singulo.Energy * (comp.EnergyFactor - 1f); diff --git a/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs b/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs index 4f1cdb0eb0..d6c048d13f 100644 --- a/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs +++ b/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs @@ -122,7 +122,7 @@ namespace Content.Server.Solar.EntitySystems private void UpdatePanelCoverage(Entity panel) { var entity = panel.Owner; - var xform = EntityManager.GetComponent(entity); + var xform = Comp(entity); // So apparently, and yes, I *did* only find this out later, // this is just a really fancy way of saying "Lambert's law of cosines". diff --git a/Content.Server/Spawners/EntitySystems/ConditionalSpawnerSystem.cs b/Content.Server/Spawners/EntitySystems/ConditionalSpawnerSystem.cs index 7331894bcf..96deb70b47 100644 --- a/Content.Server/Spawners/EntitySystems/ConditionalSpawnerSystem.cs +++ b/Content.Server/Spawners/EntitySystems/ConditionalSpawnerSystem.cs @@ -89,14 +89,14 @@ namespace Content.Server.Spawners.EntitySystems } if (!Deleted(uid)) - EntityManager.SpawnEntity(_robustRandom.Pick(component.Prototypes), Transform(uid).Coordinates); + Spawn(_robustRandom.Pick(component.Prototypes), Transform(uid).Coordinates); } private void Spawn(EntityUid uid, RandomSpawnerComponent component) { if (component.RarePrototypes.Count > 0 && (component.RareChance == 1.0f || _robustRandom.Prob(component.RareChance))) { - EntityManager.SpawnEntity(_robustRandom.Pick(component.RarePrototypes), Transform(uid).Coordinates); + Spawn(_robustRandom.Pick(component.RarePrototypes), Transform(uid).Coordinates); return; } @@ -118,7 +118,7 @@ namespace Content.Server.Spawners.EntitySystems var coordinates = Transform(uid).Coordinates.Offset(new Vector2(xOffset, yOffset)); - EntityManager.SpawnEntity(_robustRandom.Pick(component.Prototypes), coordinates); + Spawn(_robustRandom.Pick(component.Prototypes), coordinates); } private void Spawn(Entity ent) diff --git a/Content.Server/Species/Systems/NymphSystem.cs b/Content.Server/Species/Systems/NymphSystem.cs index d491b957bf..11493b65b3 100644 --- a/Content.Server/Species/Systems/NymphSystem.cs +++ b/Content.Server/Species/Systems/NymphSystem.cs @@ -35,7 +35,7 @@ public sealed partial class NymphSystem : EntitySystem // Get the organs' position & spawn a nymph there var coords = Transform(uid).Coordinates; - var nymph = EntityManager.SpawnAtPosition(entityProto.ID, coords); + var nymph = SpawnAtPosition(entityProto.ID, coords); if (HasComp(args.OldBody)) // Zombify the new nymph if old one is a zombie _zombie.ZombifyEntity(nymph); diff --git a/Content.Server/Speech/EntitySystems/AddAccentClothingSystem.cs b/Content.Server/Speech/EntitySystems/AddAccentClothingSystem.cs index 98d35efae4..261377a14a 100644 --- a/Content.Server/Speech/EntitySystems/AddAccentClothingSystem.cs +++ b/Content.Server/Speech/EntitySystems/AddAccentClothingSystem.cs @@ -39,7 +39,7 @@ public sealed class AddAccentClothingSystem : EntitySystem // try to remove accent var componentType = Factory.GetRegistration(component.Accent).Type; - EntityManager.RemoveComponent(args.Wearer, componentType); + RemComp(args.Wearer, componentType); component.IsActive = false; } diff --git a/Content.Server/Spreader/KudzuSystem.cs b/Content.Server/Spreader/KudzuSystem.cs index dc176ebc2a..92e6609fd7 100644 --- a/Content.Server/Spreader/KudzuSystem.cs +++ b/Content.Server/Spreader/KudzuSystem.cs @@ -36,7 +36,7 @@ public sealed class KudzuSystem : EntitySystem component.GrowthLevel = 3; component.GrowthLevel = Math.Max(1, component.GrowthLevel - growthDamage); - if (EntityManager.TryGetComponent(uid, out var appearance)) + if (TryComp(uid, out var appearance)) { _appearance.SetData(uid, KudzuVisuals.GrowthLevel, component.GrowthLevel, appearance); } @@ -79,7 +79,7 @@ public sealed class KudzuSystem : EntitySystem private void SetupKudzu(EntityUid uid, KudzuComponent component, ComponentStartup args) { - if (!EntityManager.TryGetComponent(uid, out var appearance)) + if (!TryComp(uid, out var appearance)) { return; } diff --git a/Content.Server/Station/Systems/StationSpawningSystem.cs b/Content.Server/Station/Systems/StationSpawningSystem.cs index 924146bc1f..7b9abee5d2 100644 --- a/Content.Server/Station/Systems/StationSpawningSystem.cs +++ b/Content.Server/Station/Systems/StationSpawningSystem.cs @@ -109,7 +109,7 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem if (prototype?.JobEntity != null) { DebugTools.Assert(entity is null); - var jobEntity = EntityManager.SpawnEntity(prototype.JobEntity, coordinates); + var jobEntity = Spawn(prototype.JobEntity, coordinates); MakeSentientCommand.MakeSentient(jobEntity, EntityManager); // Make sure custom names get handled, what is gameticker control flow whoopy. diff --git a/Content.Server/StationEvents/Events/VentClogRule.cs b/Content.Server/StationEvents/Events/VentClogRule.cs index 3b6eeebe85..ad8e4b5a42 100644 --- a/Content.Server/StationEvents/Events/VentClogRule.cs +++ b/Content.Server/StationEvents/Events/VentClogRule.cs @@ -29,7 +29,7 @@ public sealed class VentClogRule : StationEventSystem .Where(x => !x.Abstract) .Select(x => x.ID).ToList(); - foreach (var (_, transform) in EntityManager.EntityQuery()) + foreach (var (_, transform) in EntityQuery()) { if (CompOrNull(transform.GridUid)?.Station != chosenStation) { diff --git a/Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs b/Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs index de5ab7a6ca..11f3fb1bdb 100644 --- a/Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs +++ b/Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs @@ -95,7 +95,7 @@ public sealed class BluespaceLockerSystem : EntitySystem if (component.BehaviorProperties.TransportEntities || component.BehaviorProperties.TransportSentient) foreach (var entity in target.Value.storageComponent.Contents.ContainedEntities.ToArray()) { - if (EntityManager.HasComponent(entity)) + if (HasComp(entity)) { if (!component.BehaviorProperties.TransportSentient) continue; @@ -312,7 +312,7 @@ public sealed class BluespaceLockerSystem : EntitySystem if (component.BehaviorProperties.TransportEntities || component.BehaviorProperties.TransportSentient) foreach (var entity in entityStorageComponent.Contents.ContainedEntities.ToArray()) { - if (EntityManager.HasComponent(entity)) + if (HasComp(entity)) { if (!component.BehaviorProperties.TransportSentient) continue; diff --git a/Content.Server/Storage/EntitySystems/ItemCounterSystem.cs b/Content.Server/Storage/EntitySystems/ItemCounterSystem.cs index 43fcb32d1f..a1ac2bfdbb 100644 --- a/Content.Server/Storage/EntitySystems/ItemCounterSystem.cs +++ b/Content.Server/Storage/EntitySystems/ItemCounterSystem.cs @@ -13,7 +13,7 @@ namespace Content.Server.Storage.EntitySystems [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; protected override int? GetCount(ContainerModifiedMessage msg, ItemCounterComponent itemCounter) { - if (!EntityManager.TryGetComponent(msg.Container.Owner, out StorageComponent? component)) + if (!TryComp(msg.Container.Owner, out StorageComponent? component)) { return null; } diff --git a/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs b/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs index 548fa7bfda..ec02006b27 100644 --- a/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs +++ b/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs @@ -40,7 +40,7 @@ namespace Content.Server.Storage.EntitySystems // Calculate the average price of the possible spawned items args.Price += _pricing.GetPrice(protUid) * entry.SpawnProbability * entry.GetAmount(getAverage: true); - EntityManager.DeleteEntity(protUid); + Del(protUid); } foreach (var group in orGroups) @@ -54,7 +54,7 @@ namespace Content.Server.Storage.EntitySystems (entry.SpawnProbability / group.CumulativeProbability) * entry.GetAmount(getAverage: true); - EntityManager.DeleteEntity(protUid); + Del(protUid); } } diff --git a/Content.Server/Store/Systems/StoreSystem.Ui.cs b/Content.Server/Store/Systems/StoreSystem.Ui.cs index f9772e48da..742434ff23 100644 --- a/Content.Server/Store/Systems/StoreSystem.Ui.cs +++ b/Content.Server/Store/Systems/StoreSystem.Ui.cs @@ -352,7 +352,7 @@ public sealed partial class StoreSystem _actionContainer.RemoveAction(purchase, logMissing: false); - EntityManager.DeleteEntity(purchase); + Del(purchase); } component.BoughtEntities.Clear(); diff --git a/Content.Server/Stunnable/Systems/StunOnCollideSystem.cs b/Content.Server/Stunnable/Systems/StunOnCollideSystem.cs index 52e3cab79c..ae10957bd8 100644 --- a/Content.Server/Stunnable/Systems/StunOnCollideSystem.cs +++ b/Content.Server/Stunnable/Systems/StunOnCollideSystem.cs @@ -23,7 +23,7 @@ namespace Content.Server.Stunnable private void TryDoCollideStun(EntityUid uid, StunOnCollideComponent component, EntityUid target) { - if (EntityManager.TryGetComponent(target, out var status)) + if (TryComp(target, out var status)) { _stunSystem.TryStun(target, TimeSpan.FromSeconds(component.StunAmount), true, status); diff --git a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMonitorSystem.cs b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMonitorSystem.cs index 30bbb2f0e9..4f59654bb9 100644 --- a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMonitorSystem.cs +++ b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMonitorSystem.cs @@ -57,7 +57,7 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem if (monitor.LastHeartbeat > _maxHeartbeatTime) { DisconnectCamera(uid, true, monitor); - EntityManager.RemoveComponent(uid); + RemComp(uid); } } } @@ -256,7 +256,7 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem monitor.ActiveCamera = null; monitor.ActiveCameraAddress = string.Empty; - EntityManager.RemoveComponent(uid); + RemComp(uid); UpdateUserInterface(uid, monitor); } diff --git a/Content.Server/Tabletop/TabletopSystem.Map.cs b/Content.Server/Tabletop/TabletopSystem.Map.cs index 837ab2df24..5e116d81ef 100644 --- a/Content.Server/Tabletop/TabletopSystem.Map.cs +++ b/Content.Server/Tabletop/TabletopSystem.Map.cs @@ -52,7 +52,7 @@ namespace Content.Server.Tabletop TabletopMap = mapId; _tabletops = 0; - var mapComp = EntityManager.GetComponent(mapUid); + var mapComp = Comp(mapUid); // Lighting is always disabled in tabletop world. mapComp.LightingEnabled = false; diff --git a/Content.Server/Tabletop/TabletopSystem.Session.cs b/Content.Server/Tabletop/TabletopSystem.Session.cs index c2bb8426fc..2f271b4b66 100644 --- a/Content.Server/Tabletop/TabletopSystem.Session.cs +++ b/Content.Server/Tabletop/TabletopSystem.Session.cs @@ -42,7 +42,7 @@ namespace Content.Server.Tabletop /// The UID of the tabletop game entity. public void CleanupSession(EntityUid uid) { - if (!EntityManager.TryGetComponent(uid, out TabletopGameComponent? tabletop)) + if (!TryComp(uid, out TabletopGameComponent? tabletop)) return; if (tabletop.Session is not { } session) @@ -55,7 +55,7 @@ namespace Content.Server.Tabletop foreach (var euid in session.Entities) { - EntityManager.QueueDeleteEntity(euid); + QueueDel(euid); } tabletop.Session = null; @@ -68,7 +68,7 @@ namespace Content.Server.Tabletop /// The UID of the tabletop game entity. public void OpenSessionFor(ICommonSession player, EntityUid uid) { - if (!EntityManager.TryGetComponent(uid, out TabletopGameComponent? tabletop) || player.AttachedEntity is not {Valid: true} attachedEntity) + if (!TryComp(uid, out TabletopGameComponent? tabletop) || player.AttachedEntity is not {Valid: true} attachedEntity) return; // Make sure we have a session, and add the player to it if not added already. @@ -77,7 +77,7 @@ namespace Content.Server.Tabletop if (session.Players.ContainsKey(player)) return; - if(EntityManager.TryGetComponent(attachedEntity, out TabletopGamerComponent? gamer)) + if(TryComp(attachedEntity, out TabletopGamerComponent? gamer)) CloseSessionFor(player, gamer.Tabletop, false); // Set the entity as an absolute GAMER. @@ -100,26 +100,26 @@ namespace Content.Server.Tabletop /// Whether to remove the from the player's attached entity. public void CloseSessionFor(ICommonSession player, EntityUid uid, bool removeGamerComponent = true) { - if (!EntityManager.TryGetComponent(uid, out TabletopGameComponent? tabletop) || tabletop.Session is not { } session) + if (!TryComp(uid, out TabletopGameComponent? tabletop) || tabletop.Session is not { } session) return; if (!session.Players.TryGetValue(player, out var data)) return; - if(removeGamerComponent && player.AttachedEntity is {} attachedEntity && EntityManager.TryGetComponent(attachedEntity, out TabletopGamerComponent? gamer)) + if(removeGamerComponent && player.AttachedEntity is {} attachedEntity && TryComp(attachedEntity, out TabletopGamerComponent? gamer)) { // We invalidate this to prevent an infinite feedback from removing the component. gamer.Tabletop = EntityUid.Invalid; // You stop being a gamer....... - EntityManager.RemoveComponent(attachedEntity); + RemComp(attachedEntity); } session.Players.Remove(player); session.Entities.Remove(data.Camera); // Deleting the view subscriber automatically cleans up subscriptions, no need to do anything else. - EntityManager.QueueDeleteEntity(data.Camera); + QueueDel(data.Camera); } /// diff --git a/Content.Server/Tabletop/TabletopSystem.cs b/Content.Server/Tabletop/TabletopSystem.cs index f3f5801b2d..e771add0e4 100644 --- a/Content.Server/Tabletop/TabletopSystem.cs +++ b/Content.Server/Tabletop/TabletopSystem.cs @@ -80,7 +80,7 @@ namespace Content.Server.Tabletop if (!_cfg.GetCVar(CCVars.GameTabletopPlace)) return; - if (!EntityManager.TryGetComponent(args.User, out HandsComponent? hands)) + if (!TryComp(args.User, out HandsComponent? hands)) return; if (component.Session is not { } session) @@ -128,7 +128,7 @@ namespace Content.Server.Tabletop if (!args.CanAccess || !args.CanInteract) return; - if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) + if (!TryComp(args.User, out ActorComponent? actor)) return; var playVerb = new ActivationVerb() @@ -147,7 +147,7 @@ namespace Content.Server.Tabletop return; // Check that a player is attached to the entity. - if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) + if (!TryComp(args.User, out ActorComponent? actor)) return; OpenSessionFor(actor.PlayerSession, uid); @@ -171,7 +171,7 @@ namespace Content.Server.Tabletop private void OnGamerShutdown(EntityUid uid, TabletopGamerComponent component, ComponentShutdown args) { - if (!EntityManager.TryGetComponent(uid, out ActorComponent? actor)) + if (!TryComp(uid, out ActorComponent? actor)) return; if(component.Tabletop.IsValid()) @@ -190,7 +190,7 @@ namespace Content.Server.Tabletop if (!TryComp(uid, out ActorComponent? actor)) { - EntityManager.RemoveComponent(uid); + RemComp(uid); return; } diff --git a/Content.Server/Telephone/TelephoneSystem.cs b/Content.Server/Telephone/TelephoneSystem.cs index dd068612f7..ab3026fc97 100644 --- a/Content.Server/Telephone/TelephoneSystem.cs +++ b/Content.Server/Telephone/TelephoneSystem.cs @@ -124,7 +124,7 @@ public sealed class TelephoneSystem : SharedTelephoneSystem { base.Update(frameTime); - var query = EntityManager.EntityQueryEnumerator(); + var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var telephone)) { var entity = new Entity(uid, telephone); diff --git a/Content.Server/Traits/TraitSystem.cs b/Content.Server/Traits/TraitSystem.cs index 38cbc1859c..59cb9537f2 100644 --- a/Content.Server/Traits/TraitSystem.cs +++ b/Content.Server/Traits/TraitSystem.cs @@ -55,7 +55,7 @@ public sealed class TraitSystem : EntitySystem continue; var coords = Transform(args.Mob).Coordinates; - var inhandEntity = EntityManager.SpawnEntity(traitPrototype.TraitGear, coords); + var inhandEntity = Spawn(traitPrototype.TraitGear, coords); _sharedHandsSystem.TryPickup(args.Mob, inhandEntity, checkActionBlocker: false, diff --git a/Content.Server/Verbs/VerbSystem.cs b/Content.Server/Verbs/VerbSystem.cs index 7a1e5facd0..871b75f7f0 100644 --- a/Content.Server/Verbs/VerbSystem.cs +++ b/Content.Server/Verbs/VerbSystem.cs @@ -29,7 +29,7 @@ namespace Content.Server.Verbs { var player = eventArgs.SenderSession; - if (!EntityManager.EntityExists(GetEntity(args.EntityUid))) + if (!Exists(GetEntity(args.EntityUid))) { Log.Warning($"{nameof(HandleVerbRequest)} called on a non-existent entity with id {args.EntityUid} by player {player}."); return; diff --git a/Content.Server/Wires/WiresSystem.cs b/Content.Server/Wires/WiresSystem.cs index e6a50425b4..fef52a5b5d 100644 --- a/Content.Server/Wires/WiresSystem.cs +++ b/Content.Server/Wires/WiresSystem.cs @@ -395,7 +395,7 @@ public sealed class WiresSystem : SharedWiresSystem { var player = args.Actor; - if (!EntityManager.TryGetComponent(player, out HandsComponent? handsComponent)) + if (!TryComp(player, out HandsComponent? handsComponent)) { _popupSystem.PopupEntity(Loc.GetString("wires-component-ui-on-receive-message-no-hands"), uid, player); return; @@ -410,7 +410,7 @@ public sealed class WiresSystem : SharedWiresSystem if (!_hands.TryGetActiveItem((player, handsComponent), out var heldEntity)) return; - if (!EntityManager.TryGetComponent(heldEntity, out ToolComponent? tool)) + if (!TryComp(heldEntity, out ToolComponent? tool)) return; TryDoWireAction(uid, player, heldEntity.Value, args.Id, args.Action, component, tool); diff --git a/Content.Shared/Access/Systems/IdExaminableSystem.cs b/Content.Shared/Access/Systems/IdExaminableSystem.cs index 807ccc6616..c05262f2f6 100644 --- a/Content.Shared/Access/Systems/IdExaminableSystem.cs +++ b/Content.Shared/Access/Systems/IdExaminableSystem.cs @@ -51,13 +51,13 @@ public sealed class IdExaminableSystem : EntitySystem if (_inventorySystem.TryGetSlotEntity(uid, "id", out var idUid)) { // PDA - if (EntityManager.TryGetComponent(idUid, out PdaComponent? pda) && + if (TryComp(idUid, out PdaComponent? pda) && TryComp(pda.ContainedId, out var id)) { return GetNameAndJob(id); } // ID Card - if (EntityManager.TryGetComponent(idUid, out id)) + if (TryComp(idUid, out id)) { return GetNameAndJob(id); } diff --git a/Content.Shared/Actions/ActionUpgradeSystem.cs b/Content.Shared/Actions/ActionUpgradeSystem.cs index 72e412b50f..8cddf2daeb 100644 --- a/Content.Shared/Actions/ActionUpgradeSystem.cs +++ b/Content.Shared/Actions/ActionUpgradeSystem.cs @@ -54,7 +54,7 @@ public sealed class ActionUpgradeSystem : EntitySystem // TODO: Preserve ordering of actions - _entityManager.DeleteEntity(uid); + Del(uid); } public bool TryUpgradeAction(EntityUid? actionId, out EntityUid? upgradeActionId, ActionUpgradeComponent? actionUpgradeComponent = null, int newLevel = 0) @@ -185,7 +185,7 @@ public sealed class ActionUpgradeSystem : EntitySystem // TODO: Preserve ordering of actions - _entityManager.DeleteEntity(actionId); + Del(actionId); return upgradedActionId.Value; } diff --git a/Content.Shared/Alert/AlertsSystem.cs b/Content.Shared/Alert/AlertsSystem.cs index 429c0670ad..94085c3a27 100644 --- a/Content.Shared/Alert/AlertsSystem.cs +++ b/Content.Shared/Alert/AlertsSystem.cs @@ -15,7 +15,7 @@ public abstract class AlertsSystem : EntitySystem public IReadOnlyDictionary? GetActiveAlerts(EntityUid euid) { - return EntityManager.TryGetComponent(euid, out AlertsComponent? comp) + return TryComp(euid, out AlertsComponent? comp) ? comp.Alerts : null; } @@ -38,7 +38,7 @@ public abstract class AlertsSystem : EntitySystem public bool IsShowingAlert(EntityUid euid, ProtoId alertType) { - if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent)) + if (!TryComp(euid, out AlertsComponent? alertsComponent)) return false; if (TryGet(alertType, out var alert)) @@ -53,13 +53,13 @@ public abstract class AlertsSystem : EntitySystem /// true iff an alert of the indicated alert category is currently showing public bool IsShowingAlertCategory(EntityUid euid, ProtoId alertCategory) { - return EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent) + return TryComp(euid, out AlertsComponent? alertsComponent) && alertsComponent.Alerts.ContainsKey(AlertKey.ForCategory(alertCategory)); } public bool TryGetAlertState(EntityUid euid, AlertKey key, out AlertState alertState) { - if (EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent)) + if (TryComp(euid, out AlertsComponent? alertsComponent)) return alertsComponent.Alerts.TryGetValue(key, out alertState); alertState = default; @@ -155,7 +155,7 @@ public abstract class AlertsSystem : EntitySystem if (_timing.ApplyingState) return; - if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent)) + if (!TryComp(euid, out AlertsComponent? alertsComponent)) return; if (TryGet(alertType, out var alert)) @@ -311,14 +311,14 @@ public abstract class AlertsSystem : EntitySystem private void HandleClickAlert(ClickAlertEvent msg, EntitySessionEventArgs args) { var player = args.SenderSession.AttachedEntity; - if (player is null || !EntityManager.HasComponent(player)) + if (player is null || !HasComp(player)) return; if (!IsShowingAlert(player.Value, msg.Type)) { Log.Debug("User {0} attempted to" + " click alert {1} which is not currently showing for them", - EntityManager.GetComponent(player.Value).EntityName, msg.Type); + Comp(player.Value).EntityName, msg.Type); return; } diff --git a/Content.Shared/Animals/UdderSystem.cs b/Content.Shared/Animals/UdderSystem.cs index 90cc717321..ad813f259a 100644 --- a/Content.Shared/Animals/UdderSystem.cs +++ b/Content.Shared/Animals/UdderSystem.cs @@ -71,7 +71,7 @@ public sealed class UdderSystem : EntitySystem continue; // Actually there is food digestion so no problem with instant reagent generation "OnFeed" - if (EntityManager.TryGetComponent(uid, out HungerComponent? hunger)) + if (TryComp(uid, out HungerComponent? hunger)) { // Is there enough nutrition to produce reagent? if (_hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay) @@ -133,7 +133,7 @@ public sealed class UdderSystem : EntitySystem { if (args.Using == null || !args.CanInteract || - !EntityManager.HasComponent(args.Using.Value)) + !HasComp(args.Using.Value)) return; var uid = entity.Owner; diff --git a/Content.Shared/Animals/WoolySystem.cs b/Content.Shared/Animals/WoolySystem.cs index 172e3b56e1..734de2f34c 100644 --- a/Content.Shared/Animals/WoolySystem.cs +++ b/Content.Shared/Animals/WoolySystem.cs @@ -65,7 +65,7 @@ public sealed class WoolySystem : EntitySystem continue; // Actually there is food digestion so no problem with instant reagent generation "OnFeed" - if (EntityManager.TryGetComponent(uid, out HungerComponent? hunger)) + if (TryComp(uid, out HungerComponent? hunger)) { // Is there enough nutrition to produce reagent? if (_hunger.GetHungerThreshold(hunger) < HungerThreshold.Okay) diff --git a/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs b/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs index d1066b43e2..a93f2e0618 100644 --- a/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs +++ b/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs @@ -158,7 +158,7 @@ public abstract class SharedCryostorageSystem : EntitySystem if (PausedMap == null || !Exists(PausedMap)) return; - EntityManager.DeleteEntity(PausedMap.Value); + Del(PausedMap.Value); PausedMap = null; } diff --git a/Content.Shared/Chemistry/EntitySystems/HypospraySystem.cs b/Content.Shared/Chemistry/EntitySystems/HypospraySystem.cs index 97cf9396d2..86f6edc903 100644 --- a/Content.Shared/Chemistry/EntitySystems/HypospraySystem.cs +++ b/Content.Shared/Chemistry/EntitySystems/HypospraySystem.cs @@ -179,7 +179,7 @@ public sealed class HypospraySystem : EntitySystem RaiseLocalEvent(target, ref ev); // same LogType as syringes... - _adminLogger.Add(LogType.ForceFeed, $"{EntityManager.ToPrettyString(user):user} injected {EntityManager.ToPrettyString(target):target} with a solution {SharedSolutionContainerSystem.ToPrettyString(removedSolution):removedSolution} using a {EntityManager.ToPrettyString(uid):using}"); + _adminLogger.Add(LogType.ForceFeed, $"{ToPrettyString(user):user} injected {ToPrettyString(target):target} with a solution {SharedSolutionContainerSystem.ToPrettyString(removedSolution):removedSolution} using a {ToPrettyString(uid):using}"); return true; } diff --git a/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs b/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs index e314db0ddb..fe4d102536 100644 --- a/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs +++ b/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs @@ -282,8 +282,8 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem public FixedPoint2 GetTotalPrototypeQuantity(EntityUid owner, string reagentId) { var reagentQuantity = FixedPoint2.New(0); - if (EntityManager.EntityExists(owner) - && EntityManager.TryGetComponent(owner, out SolutionContainerManagerComponent? managerComponent)) + if (Exists(owner) + && TryComp(owner, out SolutionContainerManagerComponent? managerComponent)) { foreach (var (_, soln) in EnumerateSolutions((owner, managerComponent))) { @@ -335,7 +335,7 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem var (uid, comp, appearanceComponent) = soln; var solution = comp.Solution; - if (!EntityManager.EntityExists(uid) || !Resolve(uid, ref appearanceComponent, false)) + if (!Exists(uid) || !Resolve(uid, ref appearanceComponent, false)) return; AppearanceSystem.SetData(uid, SolutionContainerVisuals.FillFraction, solution.FillFraction, appearanceComponent); diff --git a/Content.Shared/Chemistry/MetabolismMovespeedModifierSystem.cs b/Content.Shared/Chemistry/MetabolismMovespeedModifierSystem.cs index e9d3b7de53..68a55dd468 100644 --- a/Content.Shared/Chemistry/MetabolismMovespeedModifierSystem.cs +++ b/Content.Shared/Chemistry/MetabolismMovespeedModifierSystem.cs @@ -52,7 +52,7 @@ namespace Content.Shared.Chemistry continue; _components.RemoveAt(i); - EntityManager.RemoveComponent(metabolism); + RemComp(metabolism); _movespeed.RefreshMovementSpeedModifiers(metabolism); } diff --git a/Content.Shared/Construction/EntitySystems/AnchorableSystem.cs b/Content.Shared/Construction/EntitySystems/AnchorableSystem.cs index cd0996a017..e690b93826 100644 --- a/Content.Shared/Construction/EntitySystems/AnchorableSystem.cs +++ b/Content.Shared/Construction/EntitySystems/AnchorableSystem.cs @@ -122,7 +122,7 @@ public sealed partial class AnchorableSystem : EntitySystem _adminLogger.Add( LogType.Unanchor, LogImpact.Low, - $"{EntityManager.ToPrettyString(args.User):user} unanchored {EntityManager.ToPrettyString(uid):anchored} using {EntityManager.ToPrettyString(used):using}" + $"{ToPrettyString(args.User):user} unanchored {ToPrettyString(uid):anchored} using {ToPrettyString(used):using}" ); } @@ -174,7 +174,7 @@ public sealed partial class AnchorableSystem : EntitySystem _adminLogger.Add( LogType.Anchor, LogImpact.Low, - $"{EntityManager.ToPrettyString(args.User):user} anchored {EntityManager.ToPrettyString(uid):anchored} using {EntityManager.ToPrettyString(used):using}" + $"{ToPrettyString(args.User):user} anchored {ToPrettyString(uid):anchored} using {ToPrettyString(used):using}" ); } diff --git a/Content.Shared/Containers/ContainerFillSystem.cs b/Content.Shared/Containers/ContainerFillSystem.cs index 3d49079ea7..2eff64aaf0 100644 --- a/Content.Shared/Containers/ContainerFillSystem.cs +++ b/Content.Shared/Containers/ContainerFillSystem.cs @@ -40,7 +40,7 @@ public sealed class ContainerFillSystem : EntitySystem var ent = Spawn(proto, coords); if (!_containerSystem.Insert(ent, container, containerXform: xform)) { - var alreadyContained = container.ContainedEntities.Count > 0 ? string.Join("\n", container.ContainedEntities.Select(e => $"\t - {EntityManager.ToPrettyString(e)}")) : "< empty >"; + var alreadyContained = container.ContainedEntities.Count > 0 ? string.Join("\n", container.ContainedEntities.Select(e => $"\t - {ToPrettyString(e)}")) : "< empty >"; Log.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} failed to insert an entity: {ToPrettyString(ent)}.\nCurrent contents:\n{alreadyContained}"); _transform.AttachToGridOrMap(ent); break; @@ -74,7 +74,7 @@ public sealed class ContainerFillSystem : EntitySystem var spawn = Spawn(proto, coords); if (!_containerSystem.Insert(spawn, container, containerXform: xform)) { - var alreadyContained = container.ContainedEntities.Count > 0 ? string.Join("\n", container.ContainedEntities.Select(e => $"\t - {EntityManager.ToPrettyString(e)}")) : "< empty >"; + var alreadyContained = container.ContainedEntities.Count > 0 ? string.Join("\n", container.ContainedEntities.Select(e => $"\t - {ToPrettyString(e)}")) : "< empty >"; Log.Error($"Entity {ToPrettyString(ent)} with a {nameof(EntityTableContainerFillComponent)} failed to insert an entity: {ToPrettyString(spawn)}.\nCurrent contents:\n{alreadyContained}"); _transform.AttachToGridOrMap(spawn); break; diff --git a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs index 4f5f567e43..b3eb4b23c2 100644 --- a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs +++ b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs @@ -102,7 +102,7 @@ namespace Content.Shared.Containers.ItemSlots { if (existing.Local) Log.Error( - $"Duplicate item slot key. Entity: {EntityManager.GetComponent(uid).EntityName} ({uid}), key: {id}"); + $"Duplicate item slot key. Entity: {Comp(uid).EntityName} ({uid}), key: {id}"); else // server state takes priority slot.CopyFrom(existing); @@ -132,7 +132,7 @@ namespace Content.Shared.Containers.ItemSlots itemSlots.Slots.Remove(slot.ContainerSlot.ID); if (itemSlots.Slots.Count == 0) - EntityManager.RemoveComponent(uid, itemSlots); + RemComp(uid, itemSlots); else Dirty(uid, itemSlots); } @@ -206,7 +206,7 @@ namespace Content.Shared.Containers.ItemSlots if (args.Handled) return; - if (!EntityManager.TryGetComponent(args.User, out HandsComponent? hands)) + if (!TryComp(args.User, out HandsComponent? hands)) return; if (itemSlots.Slots.Count == 0) @@ -700,7 +700,7 @@ namespace Content.Shared.Containers.ItemSlots var verbSubject = slot.Name != string.Empty ? Loc.GetString(slot.Name) - : EntityManager.GetComponent(slot.Item.Value).EntityName ?? string.Empty; + : Comp(slot.Item.Value).EntityName ?? string.Empty; AlternativeVerb verb = new() { diff --git a/Content.Shared/Cuffs/SharedCuffableSystem.cs b/Content.Shared/Cuffs/SharedCuffableSystem.cs index c16bbd1e85..3b0f6c8a30 100644 --- a/Content.Shared/Cuffs/SharedCuffableSystem.cs +++ b/Content.Shared/Cuffs/SharedCuffableSystem.cs @@ -236,7 +236,7 @@ namespace Content.Shared.Cuffs private void HandleMoveAttempt(EntityUid uid, CuffableComponent component, UpdateCanMoveEvent args) { - if (component.CanStillInteract || !EntityManager.TryGetComponent(uid, out PullableComponent? pullable) || !pullable.BeingPulled) + if (component.CanStillInteract || !TryComp(uid, out PullableComponent? pullable) || !pullable.BeingPulled) return; args.Cancel(); diff --git a/Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs b/Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs index c35e95ecb8..6ef41e8721 100644 --- a/Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs +++ b/Content.Shared/Damage/Systems/DamageOnHighSpeedImpactSystem.cs @@ -30,7 +30,7 @@ public sealed class DamageOnHighSpeedImpactSystem : EntitySystem if (!args.OurFixture.Hard || !args.OtherFixture.Hard) return; - if (!EntityManager.HasComponent(uid)) + if (!HasComp(uid)) return; //TODO: This should solve after physics solves diff --git a/Content.Shared/Damage/Systems/SlowOnDamageSystem.cs b/Content.Shared/Damage/Systems/SlowOnDamageSystem.cs index 6b5f57c595..e339727200 100644 --- a/Content.Shared/Damage/Systems/SlowOnDamageSystem.cs +++ b/Content.Shared/Damage/Systems/SlowOnDamageSystem.cs @@ -30,7 +30,7 @@ namespace Content.Shared.Damage private void OnRefreshMovespeed(EntityUid uid, SlowOnDamageComponent component, RefreshMovementSpeedModifiersEvent args) { - if (!EntityManager.TryGetComponent(uid, out var damage)) + if (!TryComp(uid, out var damage)) return; if (damage.TotalDamage == FixedPoint2.Zero) diff --git a/Content.Shared/Disposal/Mailing/SharedMailingUnitSystem.cs b/Content.Shared/Disposal/Mailing/SharedMailingUnitSystem.cs index cb7a8c46c8..077649f7a8 100644 --- a/Content.Shared/Disposal/Mailing/SharedMailingUnitSystem.cs +++ b/Content.Shared/Disposal/Mailing/SharedMailingUnitSystem.cs @@ -156,7 +156,7 @@ public abstract class SharedMailingUnitSystem : EntitySystem if (args.Handled || !args.Complex) return; - if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) + if (!TryComp(args.User, out ActorComponent? actor)) { return; } diff --git a/Content.Shared/Examine/ExamineSystemShared.cs b/Content.Shared/Examine/ExamineSystemShared.cs index 228926fac4..7c063f6ce9 100644 --- a/Content.Shared/Examine/ExamineSystemShared.cs +++ b/Content.Shared/Examine/ExamineSystemShared.cs @@ -111,7 +111,7 @@ namespace Content.Shared.Examine if (!examinerComp.CheckInRangeUnOccluded) return true; - if (EntityManager.GetComponent(examiner).MapID != target.MapId) + if (Comp(examiner).MapID != target.MapId) return false; // Do target InRangeUnoccluded which has different checks. diff --git a/Content.Shared/Gravity/SharedGravitySystem.cs b/Content.Shared/Gravity/SharedGravitySystem.cs index 2f532d0f1d..3ff9792e86 100644 --- a/Content.Shared/Gravity/SharedGravitySystem.cs +++ b/Content.Shared/Gravity/SharedGravitySystem.cs @@ -148,7 +148,7 @@ namespace Content.Shared.Gravity private void OnGridInit(GridInitializeEvent ev) { - EntityManager.EnsureComponent(ev.EntityUid); + EnsureComp(ev.EntityUid); } [Serializable, NetSerializable] diff --git a/Content.Shared/Implants/SharedImplanterSystem.cs b/Content.Shared/Implants/SharedImplanterSystem.cs index 41c2daed3e..6e806384a0 100644 --- a/Content.Shared/Implants/SharedImplanterSystem.cs +++ b/Content.Shared/Implants/SharedImplanterSystem.cs @@ -56,7 +56,7 @@ public abstract class SharedImplanterSystem : EntitySystem private void OnEntInserted(EntityUid uid, ImplanterComponent component, EntInsertedIntoContainerMessage args) { - var implantData = EntityManager.GetComponent(args.Entity); + var implantData = Comp(args.Entity); component.ImplantData = (implantData.EntityName, implantData.EntityDescription); } diff --git a/Content.Shared/Inventory/InventorySystem.Helpers.cs b/Content.Shared/Inventory/InventorySystem.Helpers.cs index 44dede02c7..259c3b6c8d 100644 --- a/Content.Shared/Inventory/InventorySystem.Helpers.cs +++ b/Content.Shared/Inventory/InventorySystem.Helpers.cs @@ -73,12 +73,12 @@ public partial class InventorySystem return false; // Let's spawn this first... - var item = EntityManager.SpawnEntity(prototype, Transform(uid).Coordinates); + var item = Spawn(prototype, Transform(uid).Coordinates); // Helper method that deletes the item and returns false. bool DeleteItem() { - EntityManager.DeleteEntity(item); + Del(item); return false; } diff --git a/Content.Shared/Jittering/SharedJitteringSystem.cs b/Content.Shared/Jittering/SharedJitteringSystem.cs index 1ac8413375..fd0758c3c4 100644 --- a/Content.Shared/Jittering/SharedJitteringSystem.cs +++ b/Content.Shared/Jittering/SharedJitteringSystem.cs @@ -25,7 +25,7 @@ namespace Content.Shared.Jittering private void OnRejuvenate(EntityUid uid, JitteringComponent component, RejuvenateEvent args) { - EntityManager.RemoveComponentDeferred(uid); + RemCompDeferred(uid); } /// @@ -54,7 +54,7 @@ namespace Content.Shared.Jittering if (StatusEffects.TryAddStatusEffect(uid, "Jitter", time, refresh, status)) { - var jittering = EntityManager.GetComponent(uid); + var jittering = Comp(uid); if(forceValueChange || jittering.Amplitude < amplitude) jittering.Amplitude = amplitude; diff --git a/Content.Shared/Magic/SharedMagicSystem.cs b/Content.Shared/Magic/SharedMagicSystem.cs index a860f1dcfb..e5258f2518 100644 --- a/Content.Shared/Magic/SharedMagicSystem.cs +++ b/Content.Shared/Magic/SharedMagicSystem.cs @@ -359,7 +359,7 @@ public abstract class SharedMagicSystem : EntitySystem var component = (Component)Factory.GetComponent(name); var temp = (object)component; _seriMan.CopyTo(data.Component, ref temp); - EntityManager.AddComponent(target, (Component)temp!); + AddComp(target, (Component)temp!); } } diff --git a/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs b/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs index e1c07df3c3..bc169aa201 100644 --- a/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs +++ b/Content.Shared/Movement/Pulling/Systems/PullingSystem.cs @@ -226,7 +226,7 @@ public sealed class PullingSystem : EntitySystem if (component.Pulling != args.BlockingEntity) return; - if (EntityManager.TryGetComponent(args.BlockingEntity, out PullableComponent? comp)) + if (TryComp(args.BlockingEntity, out PullableComponent? comp)) { TryStopPull(args.BlockingEntity, comp); } @@ -424,7 +424,7 @@ public sealed class PullingSystem : EntitySystem return false; } - if (!EntityManager.TryGetComponent(pullableUid, out var physics)) + if (!TryComp(pullableUid, out var physics)) { return false; } diff --git a/Content.Shared/Movement/Systems/FrictionContactsSystem.cs b/Content.Shared/Movement/Systems/FrictionContactsSystem.cs index 09d74bfb40..44fc3933e3 100644 --- a/Content.Shared/Movement/Systems/FrictionContactsSystem.cs +++ b/Content.Shared/Movement/Systems/FrictionContactsSystem.cs @@ -77,7 +77,7 @@ public sealed class FrictionContactsSystem : EntitySystem private void OnRefreshFrictionModifiers(Entity entity, ref RefreshFrictionModifiersEvent args) { - if (!EntityManager.TryGetComponent(entity, out var physicsComponent)) + if (!TryComp(entity, out var physicsComponent)) return; var friction = 0.0f; diff --git a/Content.Shared/Movement/Systems/SpeedModifierContactsSystem.cs b/Content.Shared/Movement/Systems/SpeedModifierContactsSystem.cs index e2dee87019..8a0b085a83 100644 --- a/Content.Shared/Movement/Systems/SpeedModifierContactsSystem.cs +++ b/Content.Shared/Movement/Systems/SpeedModifierContactsSystem.cs @@ -78,7 +78,7 @@ public sealed class SpeedModifierContactsSystem : EntitySystem private void OnRefreshMovementSpeedModifiers(EntityUid uid, SpeedModifiedByContactComponent component, RefreshMovementSpeedModifiersEvent args) { - if (!EntityManager.TryGetComponent(uid, out var physicsComponent)) + if (!TryComp(uid, out var physicsComponent)) return; var walkSpeed = 0.0f; diff --git a/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs b/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs index bd7251b943..fa07aa20c5 100644 --- a/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs @@ -40,7 +40,7 @@ namespace Content.Shared.Nutrition.EntitySystems creamPied.CreamPied = value; - if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) + if (TryComp(uid, out AppearanceComponent? appearance)) { _appearance.SetData(uid, CreamPiedVisuals.Creamed, value, appearance); } @@ -58,7 +58,7 @@ namespace Content.Shared.Nutrition.EntitySystems private void OnCreamPiedHitBy(EntityUid uid, CreamPiedComponent creamPied, ThrowHitByEvent args) { - if (!EntityManager.EntityExists(args.Thrown) || !EntityManager.TryGetComponent(args.Thrown, out CreamPieComponent? creamPie)) return; + if (!Exists(args.Thrown) || !TryComp(args.Thrown, out CreamPieComponent? creamPie)) return; SetCreamPied(uid, creamPied, true); diff --git a/Content.Shared/Nutrition/EntitySystems/UtensilSystem.cs b/Content.Shared/Nutrition/EntitySystems/UtensilSystem.cs index 431302593d..63fe822186 100644 --- a/Content.Shared/Nutrition/EntitySystems/UtensilSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/UtensilSystem.cs @@ -38,7 +38,7 @@ public sealed class UtensilSystem : EntitySystem public (bool Success, bool Handled) TryUseUtensil(EntityUid user, EntityUid target, Entity utensil) { - if (!EntityManager.TryGetComponent(target, out FoodComponent? food)) + if (!TryComp(target, out FoodComponent? food)) return (false, false); //Prevents food usage with a wrong utensil @@ -67,7 +67,7 @@ public sealed class UtensilSystem : EntitySystem if (_robustRandom.Prob(component.BreakChance)) { _audio.PlayPredicted(component.BreakSound, userUid, userUid, AudioParams.Default.WithVolume(-2f)); - EntityManager.DeleteEntity(uid); + Del(uid); } } } diff --git a/Content.Shared/Paper/PaperSystem.cs b/Content.Shared/Paper/PaperSystem.cs index 04d6d4026c..75496d93b4 100644 --- a/Content.Shared/Paper/PaperSystem.cs +++ b/Content.Shared/Paper/PaperSystem.cs @@ -217,7 +217,7 @@ public sealed class PaperSystem : EntitySystem { if (!_paperQuery.TryComp(ent, out var paperComp)) { - Log.Warning($"{EntityManager.ToPrettyString(ent)} has a {nameof(RandomPaperContentComponent)} but no {nameof(PaperComponent)}!"); + Log.Warning($"{ToPrettyString(ent)} has a {nameof(RandomPaperContentComponent)} but no {nameof(PaperComponent)}!"); RemCompDeferred(ent, ent.Comp); return; } diff --git a/Content.Shared/RCD/Systems/RCDSystem.cs b/Content.Shared/RCD/Systems/RCDSystem.cs index 68056ef267..cb8450a500 100644 --- a/Content.Shared/RCD/Systems/RCDSystem.cs +++ b/Content.Shared/RCD/Systems/RCDSystem.cs @@ -206,7 +206,7 @@ public sealed class RCDSystem : EntitySystem // Try to start the do after var effect = Spawn(effectPrototype, location); - var ev = new RCDDoAfterEvent(GetNetCoordinates(location), component.ConstructionDirection, component.ProtoId, cost, EntityManager.GetNetEntity(effect)); + var ev = new RCDDoAfterEvent(GetNetCoordinates(location), component.ConstructionDirection, component.ProtoId, cost, GetNetEntity(effect)); var doAfterArgs = new DoAfterArgs(EntityManager, user, delay, ev, uid, target: args.Target, used: uid) { @@ -261,7 +261,7 @@ public sealed class RCDSystem : EntitySystem { // Delete the effect entity if the do-after was cancelled (server-side only) if (_net.IsServer) - QueueDel(EntityManager.GetEntity(args.Effect)); + QueueDel(GetEntity(args.Effect)); return; } diff --git a/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs b/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs index c2b52c5af3..a791a70668 100644 --- a/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs +++ b/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs @@ -172,7 +172,7 @@ public abstract class SharedEventHorizonSystem : EntitySystem _physics.SetHard(uid, collider, true, fixtures); } - EntityManager.Dirty(uid, fixtures); + Dirty(uid, fixtures); } #endregion Getters/Setters diff --git a/Content.Shared/Station/SharedStationSpawningSystem.cs b/Content.Shared/Station/SharedStationSpawningSystem.cs index a0a2257402..ac65bd5584 100644 --- a/Content.Shared/Station/SharedStationSpawningSystem.cs +++ b/Content.Shared/Station/SharedStationSpawningSystem.cs @@ -127,7 +127,7 @@ public abstract class SharedStationSpawningSystem : EntitySystem var equipmentStr = startingGear.GetGear(slot.Name); if (!string.IsNullOrEmpty(equipmentStr)) { - var equipmentEntity = EntityManager.SpawnEntity(equipmentStr, xform.Coordinates); + var equipmentEntity = Spawn(equipmentStr, xform.Coordinates); InventorySystem.TryEquip(entity, equipmentEntity, slot.Name, silent: true, force: true); } } @@ -139,7 +139,7 @@ public abstract class SharedStationSpawningSystem : EntitySystem var coords = xform.Coordinates; foreach (var prototype in inhand) { - var inhandEntity = EntityManager.SpawnEntity(prototype, coords); + var inhandEntity = Spawn(prototype, coords); if (_handsSystem.TryGetEmptyHand((entity, handsComponent), out var emptyHand)) { diff --git a/Content.Shared/StatusEffect/StatusEffectsSystem.cs b/Content.Shared/StatusEffect/StatusEffectsSystem.cs index 9a73f83d34..f3409d1c2c 100644 --- a/Content.Shared/StatusEffect/StatusEffectsSystem.cs +++ b/Content.Shared/StatusEffect/StatusEffectsSystem.cs @@ -120,7 +120,7 @@ namespace Content.Shared.StatusEffect if (HasComp(uid)) return true; - EntityManager.AddComponent(uid); + AddComp(uid); status.ActiveEffects[key].RelevantComponent = Factory.GetComponentName(); return true; @@ -136,10 +136,10 @@ namespace Content.Shared.StatusEffect if (TryAddStatusEffect(uid, key, time, refresh, status)) { // If they already have the comp, we just won't bother updating anything. - if (!EntityManager.HasComponent(uid, Factory.GetRegistration(component).Type)) + if (!HasComp(uid, Factory.GetRegistration(component).Type)) { var newComponent = (Component) Factory.GetComponent(component); - EntityManager.AddComponent(uid, newComponent); + AddComp(uid, newComponent); status.ActiveEffects[key].RelevantComponent = component; } return true; @@ -279,7 +279,7 @@ namespace Content.Shared.StatusEffect && Factory.TryGetRegistration(state.RelevantComponent, out var registration)) { var type = registration.Type; - EntityManager.RemoveComponent(uid, type); + RemComp(uid, type); } if (proto.Alert != null) diff --git a/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs b/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs index 8ef62c45c4..62f91d8663 100644 --- a/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs @@ -21,7 +21,7 @@ namespace Content.Shared.Storage.EntitySystems private void CounterEntityInserted(EntityUid uid, ItemCounterComponent itemCounter, EntInsertedIntoContainerMessage args) { - if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent)) + if (!TryComp(uid, out AppearanceComponent? appearanceComponent)) return; var count = GetCount(args, itemCounter); @@ -37,7 +37,7 @@ namespace Content.Shared.Storage.EntitySystems private void CounterEntityRemoved(EntityUid uid, ItemCounterComponent itemCounter, EntRemovedFromContainerMessage args) { - if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent)) + if (!TryComp(uid, out AppearanceComponent? appearanceComponent)) return; var count = GetCount(args, itemCounter); diff --git a/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs b/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs index 7ae821d8d9..3b4b08bbfd 100644 --- a/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs @@ -34,7 +34,7 @@ public abstract class SharedItemMapperSystem : EntitySystem val.Layer = layerName; } - if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent)) + if (TryComp(uid, out AppearanceComponent? appearanceComponent)) { var list = new List(component.MapLayers.Keys); _appearance.SetData(uid, StorageMapVisuals.InitLayers, new ShowLayerData(list), appearanceComponent); @@ -67,7 +67,7 @@ public abstract class SharedItemMapperSystem : EntitySystem if (!Resolve(uid, ref itemMapper)) return; - if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent) + if (TryComp(uid, out AppearanceComponent? appearanceComponent) && TryGetLayers(uid, itemMapper, out var containedLayers)) { _appearance.SetData(uid, diff --git a/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs b/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs index c7edf01499..822b8acaf0 100644 --- a/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs +++ b/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs @@ -92,13 +92,13 @@ namespace Content.Shared.SubFloor { UpdateFloorCover(uid, component); UpdateAppearance(uid, component); - EntityManager.EnsureComponent(uid); + EnsureComp(uid); } private void OnSubFloorTerminating(EntityUid uid, SubFloorHideComponent component, ComponentShutdown _) { // If component is being deleted don't need to worry about updating any component stuff because it won't matter very shortly. - if (EntityManager.GetComponent(uid).EntityLifeStage >= EntityLifeStage.Terminating) + if (Comp(uid).EntityLifeStage >= EntityLifeStage.Terminating) return; // Regardless of whether we're on a subfloor or not, unhide. diff --git a/Content.Shared/Tabletop/SharedTabletopSystem.cs b/Content.Shared/Tabletop/SharedTabletopSystem.cs index 03dd094805..ab6fe94fdb 100644 --- a/Content.Shared/Tabletop/SharedTabletopSystem.cs +++ b/Content.Shared/Tabletop/SharedTabletopSystem.cs @@ -39,7 +39,7 @@ namespace Content.Shared.Tabletop return; // Move the entity and dirty it (we use the map ID from the entity so noone can try to be funny and move the item to another map) - var transform = EntityManager.GetComponent(moved); + var transform = Comp(moved); Transforms.SetParent(moved, transform, _mapSystem.GetMapOrInvalid(transform.MapID)); Transforms.SetLocalPositionNoLerp(moved, msg.Coordinates.Position, transform); } diff --git a/Content.Shared/Throwing/ThrownItemSystem.cs b/Content.Shared/Throwing/ThrownItemSystem.cs index 3e1a4f18de..65c5a0f13e 100644 --- a/Content.Shared/Throwing/ThrownItemSystem.cs +++ b/Content.Shared/Throwing/ThrownItemSystem.cs @@ -47,7 +47,7 @@ namespace Content.Shared.Throwing private void ThrowItem(EntityUid uid, ThrownItemComponent component, ref ThrownEvent @event) { - if (!EntityManager.TryGetComponent(uid, out FixturesComponent? fixturesComponent) || + if (!TryComp(uid, out FixturesComponent? fixturesComponent) || fixturesComponent.Fixtures.Count != 1 || !TryComp(uid, out var body)) { @@ -86,7 +86,7 @@ namespace Content.Shared.Throwing private void HandlePullStarted(PullStartedMessage message) { // TODO: this isn't directed so things have to be done the bad way - if (EntityManager.TryGetComponent(message.PulledUid, out ThrownItemComponent? thrownItemComponent)) + if (TryComp(message.PulledUid, out ThrownItemComponent? thrownItemComponent)) StopThrow(message.PulledUid, thrownItemComponent); } @@ -100,7 +100,7 @@ namespace Content.Shared.Throwing _broadphase.RegenerateContacts((uid, physics)); } - if (EntityManager.TryGetComponent(uid, out FixturesComponent? manager)) + if (TryComp(uid, out FixturesComponent? manager)) { var fixture = _fixtures.GetFixtureOrNull(uid, ThrowingFixture, manager: manager); diff --git a/Content.Shared/Tools/Systems/SharedToolSystem.MultipleTool.cs b/Content.Shared/Tools/Systems/SharedToolSystem.MultipleTool.cs index 595ef8a925..5a5d719dde 100644 --- a/Content.Shared/Tools/Systems/SharedToolSystem.MultipleTool.cs +++ b/Content.Shared/Tools/Systems/SharedToolSystem.MultipleTool.cs @@ -22,7 +22,7 @@ public abstract partial class SharedToolSystem private void OnMultipleToolStartup(EntityUid uid, MultipleToolComponent multiple, ComponentStartup args) { // Only set the multiple tool if we have a tool component. - if (EntityManager.TryGetComponent(uid, out ToolComponent? tool)) + if (TryComp(uid, out ToolComponent? tool)) SetMultipleTool(uid, multiple, tool); } diff --git a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs index 953abc8107..bd44dcfd66 100644 --- a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs +++ b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs @@ -294,7 +294,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem { // Make sure the entity is a weapon AND it doesn't need // to be equipped to be used (E.g boxing gloves). - if (EntityManager.TryGetComponent(held, out melee) && + if (TryComp(held, out melee) && !melee.MustBeEquippedToUse) { weaponUid = held.Value; diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Revolver.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Revolver.cs index 38f427429f..29664c6eea 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Revolver.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Revolver.cs @@ -100,7 +100,7 @@ public partial class SharedGunSystem return false; // If it's a speedloader try to get ammo from it. - if (EntityManager.HasComponent(uid)) + if (HasComp(uid)) { var freeSlots = 0; diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index b6dee7fc1b..982b8c1345 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -121,7 +121,7 @@ public abstract partial class SharedGunSystem : EntitySystem if (melee.NextAttack > component.NextFire) { component.NextFire = melee.NextAttack; - EntityManager.DirtyField(uid, component, nameof(GunComponent.NextFire)); + DirtyField(uid, component, nameof(GunComponent.NextFire)); } } @@ -201,7 +201,7 @@ public abstract partial class SharedGunSystem : EntitySystem gun.ShotCounter = 0; gun.ShootCoordinates = null; gun.Target = null; - EntityManager.DirtyField(uid, gun, nameof(GunComponent.ShotCounter)); + DirtyField(uid, gun, nameof(GunComponent.ShotCounter)); } /// @@ -212,7 +212,7 @@ public abstract partial class SharedGunSystem : EntitySystem gun.ShootCoordinates = toCoordinates; AttemptShoot(user, gunUid, gun); gun.ShotCounter = 0; - EntityManager.DirtyField(gunUid, gun, nameof(GunComponent.ShotCounter)); + DirtyField(gunUid, gun, nameof(GunComponent.ShotCounter)); } /// @@ -281,7 +281,7 @@ public abstract partial class SharedGunSystem : EntitySystem } // NextFire has been touched regardless so need to dirty the gun. - EntityManager.DirtyField(gunUid, gun, nameof(GunComponent.NextFire)); + DirtyField(gunUid, gun, nameof(GunComponent.NextFire)); // Get how many shots we're actually allowed to make, due to clip size or otherwise. // Don't do this in the loop so we still reset NextFire. @@ -335,7 +335,7 @@ public abstract partial class SharedGunSystem : EntitySystem // Even if we don't actually shoot update the ShotCounter. This is to avoid spamming empty sounds // where the gun may be SemiAuto or Burst. gun.ShotCounter += shots; - EntityManager.DirtyField(gunUid, gun, nameof(GunComponent.ShotCounter)); + DirtyField(gunUid, gun, nameof(GunComponent.ShotCounter)); if (ev.Ammo.Count <= 0) { diff --git a/Content.Shared/Xenoarchaeology/Artifact/XAE/XAEApplyComponentsSystem.cs b/Content.Shared/Xenoarchaeology/Artifact/XAE/XAEApplyComponentsSystem.cs index e5bd33f581..e36729851f 100644 --- a/Content.Shared/Xenoarchaeology/Artifact/XAE/XAEApplyComponentsSystem.cs +++ b/Content.Shared/Xenoarchaeology/Artifact/XAE/XAEApplyComponentsSystem.cs @@ -21,18 +21,18 @@ public sealed class XAEApplyComponentsSystem : BaseXAESystem