Clean up all missing EntitySystem proxy method uses (#38353)

This commit is contained in:
Tayrtahn
2025-06-26 19:50:49 -04:00
committed by GitHub
parent 73df3b1593
commit 75db49f9c0
185 changed files with 418 additions and 418 deletions

View File

@@ -211,7 +211,7 @@ namespace Content.Client.Actions
else
{
var request = new RequestPerformActionEvent(GetNetEntity(action));
EntityManager.RaisePredictiveEvent(request);
RaisePredictiveEvent(request);
}
}

View File

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

View File

@@ -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<ConstructionGhostComponent>(ghost.Value);
ghost = Spawn("constructionghost", loc);
var comp = Comp<ConstructionGhostComponent>(ghost.Value);
comp.Prototype = prototype;
comp.GhostId = ghost.GetHashCode();
EntityManager.GetComponent<TransformComponent>(ghost.Value).LocalRotation = dir.ToAngle();
Comp<TransformComponent>(ghost.Value).LocalRotation = dir.ToAngle();
_ghosts.Add(comp.GhostId, ghost.Value);
var sprite = EntityManager.GetComponent<SpriteComponent>(ghost.Value);
var sprite = Comp<SpriteComponent>(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<SpriteComponent>(dummy);
var targetSprite = EnsureComp<SpriteComponent>(dummy);
EntityManager.System<AppearanceSystem>().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<TransformComponent>(ghost.Value).Coordinates.Equals(loc))
if (Comp<TransformComponent>(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<TransformComponent>(ghostId);
var transform = Comp<TransformComponent>(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();

View File

@@ -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<SpriteComponent>(target))
if (HasComp<SpriteComponent>(target))
{
var spriteView = new SpriteView
{

View File

@@ -61,7 +61,7 @@ public sealed partial class TriggerSystem
private void OnProximityInit(EntityUid uid, TriggerOnProximityComponent component, ComponentInit args)
{
EntityManager.EnsureComponent<AnimationPlayerComponent>(uid);
EnsureComp<AnimationPlayerComponent>(uid);
}
private void OnProxAppChange(EntityUid uid, TriggerOnProximityComponent component, ref AppearanceChangeEvent args)

View File

@@ -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
/// </summary>
public void UIHandActivate(string handName)
{
EntityManager.RaisePredictiveEvent(new RequestActivateInHandEvent(handName));
RaisePredictiveEvent(new RequestActivateInHandEvent(handName));
}
public void UIInventoryExamine(string handName)

View File

@@ -36,7 +36,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
private void OnCvarChanged(bool value)
{
var humanoidQuery = EntityManager.AllEntityQueryEnumerator<HumanoidAppearanceComponent, SpriteComponent>();
var humanoidQuery = AllEntityQuery<HumanoidAppearanceComponent, SpriteComponent>();
while (humanoidQuery.MoveNext(out var uid, out var humanoidComp, out var spriteComp))
{
UpdateSprite((uid, humanoidComp, spriteComp));

View File

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

View File

@@ -63,7 +63,7 @@ public sealed class LightBehaviorSystem : EntitySystem
/// </summary>
private void CopyLightSettings(Entity<LightBehaviourComponent> 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<MetaDataComponent>(entity).EntityName} has a {nameof(LightBehaviourComponent)} but it has no {nameof(PointLightComponent)}! Check the prototype!");
Log.Warning($"{Comp<MetaDataComponent>(entity).EntityName} has a {nameof(LightBehaviourComponent)} but it has no {nameof(PointLightComponent)}! Check the prototype!");
}
}
@@ -84,7 +84,7 @@ public sealed class LightBehaviorSystem : EntitySystem
/// </summary>
public void StartLightBehaviour(Entity<LightBehaviourComponent> 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
/// <param name="resetToOriginalSettings">Should the light have its original settings applied?</param>
public void StopLightBehaviour(Entity<LightBehaviourComponent> 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<LightBehaviourComponent> entity)
{
//var uid = Owner;
if (!EntityManager.TryGetComponent(entity, out AnimationPlayerComponent? animation))
if (!TryComp(entity, out AnimationPlayerComponent? animation))
{
return false;
}

View File

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

View File

@@ -64,7 +64,7 @@ public sealed class OrbitVisualsSystem : EntitySystem
{
base.FrameUpdate(frameTime);
var query = EntityManager.EntityQueryEnumerator<OrbitVisualsComponent, SpriteComponent>();
var query = EntityQueryEnumerator<OrbitVisualsComponent, SpriteComponent>();
while (query.MoveNext(out var uid, out var orbit, out var sprite))
{
var progress = (float)(_timing.CurTime.TotalSeconds / orbit.OrbitLength) % 1;

View File

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

View File

@@ -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<EyeComponent>(camera, out var eyeComponent))
if (!TryComp<EyeComponent>(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<TabletopDraggableComponent>(_draggedEntity.Value))
if (broadcast && _draggedEntity != null && HasComp<TabletopDraggableComponent>(_draggedEntity.Value))
{
RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transforms.GetMapCoordinates(_draggedEntity.Value), GetNetEntity(_table!.Value)));
RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(_draggedEntity.Value), false));

View File

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

View File

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

View File

@@ -28,7 +28,7 @@ namespace Content.IntegrationTests.Tests.Disposal
SubscribeLocalEvent<DoInsertDisposalUnitEvent>(ev =>
{
var (_, toInsert, unit) = ev;
var insertTransform = EntityManager.GetComponent<TransformComponent>(toInsert);
var insertTransform = Comp<TransformComponent>(toInsert);
// Not in a tube yet
Assert.That(insertTransform.ParentUid, Is.EqualTo(unit));
}, after: new[] { typeof(SharedDisposalUnitSystem) });

View File

@@ -410,7 +410,7 @@ namespace Content.IntegrationTests.Tests.Networking
{
var uid = GetEntity(message.Uid);
var component = EntityManager.GetComponent<PredictionTestComponent>(uid);
var component = Comp<PredictionTestComponent>(uid);
var old = component.Foo;
if (Allow)
{

View File

@@ -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<MetaDataComponent>(component.TargetAccessReaderId).EntityName;
targetLabel = Loc.GetString("access-overrider-window-target-label") + " " + Comp<MetaDataComponent>(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<MetaDataComponent>(idCard).EntityName;
privilegedIdName = Comp<MetaDataComponent>(idCard).EntityName;
if (component.TargetAccessReaderId is { Valid: true })
{

View File

@@ -73,7 +73,7 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem
List<ProtoId<AccessLevelPrototype>>? possibleAccess = null;
if (component.PrivilegedIdSlot.Item is { Valid: true } item)
{
privilegedIdName = EntityManager.GetComponent<MetaDataComponent>(item).EntityName;
privilegedIdName = Comp<MetaDataComponent>(item).EntityName;
possibleAccess = _accessReader.FindAccessTags(item).ToList();
}
@@ -95,8 +95,8 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem
}
else
{
var targetIdComponent = EntityManager.GetComponent<IdCardComponent>(targetId);
var targetAccessComponent = EntityManager.GetComponent<AccessComponent>(targetId);
var targetIdComponent = Comp<IdCardComponent>(targetId);
var targetAccessComponent = Comp<AccessComponent>(targetId);
var jobProto = targetIdComponent.JobPrototype ?? new ProtoId<AccessLevelPrototype>(string.Empty);
if (TryComp<StationRecordKeyStorageComponent>(targetId, out var keyStorage)

View File

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

View File

@@ -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<MetaDataComponent>(session.AttachedEntity.Value).EntityName;
entityName = Comp<MetaDataComponent>(session.AttachedEntity.Value).EntityName;
identityName = Identity.Name(session.AttachedEntity.Value, EntityManager);
}

View File

@@ -83,7 +83,7 @@ public sealed partial class AdminVerbSystem
// All smite verbs have names so invokeverb works.
private void AddSmiteVerbs(GetVerbsEvent<Verb> 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);
},

View File

@@ -58,7 +58,7 @@ public sealed partial class AdminVerbSystem
private void AddTricksVerbs(GetVerbsEvent<Verb> args)
{
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
if (!TryComp(args.User, out ActorComponent? actor))
return;
var player = actor.PlayerSession;

View File

@@ -88,7 +88,7 @@ namespace Content.Server.Administration.Systems
private void AddAdminVerbs(GetVerbsEvent<Verb> 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<Verb> 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<MindContainerComponent>(args.Target))
!HasComp<MindContainerComponent>(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<SolutionContainerManagerComponent>(args.Target))
HasComp<SolutionContainerManagerComponent>(args.Target))
{
Verb verb = new()
{

View File

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

View File

@@ -29,7 +29,7 @@ public sealed class BlockGameArcadeSystem : EntitySystem
public override void Update(float frameTime)
{
var query = EntityManager.EntityQueryEnumerator<BlockGameArcadeComponent>();
var query = EntityQueryEnumerator<BlockGameArcadeComponent>();
while (query.MoveNext(out var _, out var blockGame))
{
blockGame.Game?.GameTick(frameTime);

View File

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

View File

@@ -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<AtmosMonitoringConsoleComponent, TransformComponent>();
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<AtmosMonitoringConsoleComponent>();
while (query.MoveNext(out var ent, out var entConsole))

View File

@@ -122,7 +122,7 @@ namespace Content.Server.Atmos.EntitySystems
public void InvalidatePosition(Entity<MapGridComponent?> grid, Vector2i pos)
{
var query = EntityManager.GetEntityQuery<AirtightComponent>();
var query = GetEntityQuery<AirtightComponent>();
_explosionSystem.UpdateAirtightMap(grid, pos, grid, query);
_atmosphereSystem.InvalidateTile(grid.Owner, pos);
}

View File

@@ -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<PhysicsComponent>();
var xforms = EntityManager.GetEntityQuery<TransformComponent>();
var metas = EntityManager.GetEntityQuery<MetaDataComponent>();
var pressureQuery = EntityManager.GetEntityQuery<MovedByPressureComponent>();
var bodies = GetEntityQuery<PhysicsComponent>();
var xforms = GetEntityQuery<TransformComponent>();
var metas = GetEntityQuery<MetaDataComponent>();
var pressureQuery = GetEntityQuery<MovedByPressureComponent>();
while (atmosphere.CurrentRunTiles.TryDequeue(out var tile))
{

View File

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

View File

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

View File

@@ -39,7 +39,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
private void OnExamined(Entity<GasRecyclerComponent> ent, ref ExaminedEvent args)
{
var comp = ent.Comp;
if (!EntityManager.GetComponent<TransformComponent>(ent).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
if (!Comp<TransformComponent>(ent).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
return;
if (!_nodeContainer.TryGetNode(ent.Owner, comp.InletName, out PipeNode? inlet))

View File

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

View File

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

View File

@@ -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<TransformComponent>(uid).Anchored)
if (Comp<TransformComponent>(uid).Anchored)
{
_userInterfaceSystem.OpenUi(uid, GasFilterUiKey.Key, actor.PlayerSession);
DirtyUI(uid, filter);

View File

@@ -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<MetaDataComponent>(uid).EntityName, mixer.TargetPressure, mixer.Enabled, mixer.InletOneConcentration));
new GasMixerBoundUserInterfaceState(Comp<MetaDataComponent>(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);
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -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<PaperComponent>(printed, out var paper))
{
// fill in the order data

View File

@@ -47,7 +47,7 @@ public sealed class NanoTaskCartridgeSystem : SharedNanoTaskCartridgeSystem
{
return;
}
if (!EntityManager.TryGetComponent<NanoTaskPrintedComponent>(args.Used, out var printed))
if (!TryComp<NanoTaskPrintedComponent>(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<NanoTaskCartridgeComponent>(uid.Value, program), ent.Owner);
}
}

View File

@@ -51,7 +51,7 @@ public sealed class SuicideSystem : EntitySystem
if (!TryComp<MobStateComponent>(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;
}

View File

@@ -390,7 +390,7 @@ public sealed partial class ChatSystem : SharedChatSystem
return;
}
if (!EntityManager.TryGetComponent<StationDataComponent>(station, out var stationDataComp)) return;
if (!TryComp<StationDataComponent>(station, out var stationDataComp)) return;
var filter = _stationSystem.GetInStation(stationDataComp);

View File

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

View File

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

View File

@@ -39,7 +39,7 @@ namespace Content.Server.Chemistry.EntitySystems
private void HandleCollide(Entity<VaporComponent> 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);
}

View File

@@ -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<MindContainerComponent>(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<CloningPodComponent>(clonedComponent.Parent, out var cloningPodComponent) ||
uid != cloningPodComponent.BodyContainer.ContainedEntity)
{
EntityManager.RemoveComponent<BeingClonedComponent>(uid);
RemComp<BeingClonedComponent>(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<MindContainerComponent>(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<BeingClonedComponent>(mob.Value);
var cloneMindReturn = AddComp<BeingClonedComponent>(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<BeingClonedComponent>(entity);
RemComp<BeingClonedComponent>(entity);
_containerSystem.Remove(entity, clonePod.BodyContainer);
clonePod.CloningProgress = 0f;
clonePod.UsedBiomass = 0;

View File

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

View File

@@ -56,7 +56,7 @@ public sealed class CodewordSystem : EntitySystem
var factionProto = _prototypeManager.Index<CodewordFactionPrototype>(faction.Id);
var codewords = GenerateCodewords(factionProto.Generator);
var codewordsContainer = EntityManager.Spawn(protoName:null, MapCoordinates.Nullspace);
var codewordsContainer = Spawn(prototype: null, MapCoordinates.Nullspace);
EnsureComp<CodewordComponent>(codewordsContainer)
.Codewords = codewords;
manager.Codewords[faction] = codewordsContainer;

View File

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

View File

@@ -325,7 +325,7 @@ namespace Content.Server.Construction
var newUid = EntityManager.CreateEntityUninitialized(newEntity, transform.Coordinates);
// Construction transferring.
var newConstruction = EntityManager.EnsureComponent<ConstructionComponent>(newUid);
var newConstruction = EnsureComp<ConstructionComponent>(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<ContainerManagerComponent>(newUid);
var newContainerManager = EnsureComp<ContainerManagerComponent>(newUid);
// Transfer all construction-owned containers from the old entity to the new one.
foreach (var container in construction.Containers)

View File

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

View File

@@ -41,13 +41,13 @@ namespace Content.Server.Construction
var construction = ent.Comp;
if (GetCurrentGraph(ent, construction) is not {} graph)
{
Log.Warning($"Prototype {EntityManager.GetComponent<MetaDataComponent>(ent).EntityPrototype?.ID}'s construction component has an invalid graph specified.");
Log.Warning($"Prototype {Comp<MetaDataComponent>(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<MetaDataComponent>(ent).EntityPrototype?.ID}'s construction component has an invalid node specified.");
Log.Warning($"Prototype {Comp<MetaDataComponent>(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<MetaDataComponent>(ent).EntityPrototype?.ID}'s construction component has an invalid edge index specified.");
Log.Warning($"Prototype {Comp<MetaDataComponent>(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<MetaDataComponent>(ent).EntityPrototype?.ID}'s construction component has an invalid target node specified.");
Log.Warning($"Prototype {Comp<MetaDataComponent>(ent).EntityPrototype?.ID}'s construction component has an invalid target node specified.");
return;
}

View File

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

View File

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

View File

@@ -29,7 +29,7 @@ namespace Content.Server.DeviceNetwork.Systems
/// </summary>
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))
{

View File

@@ -24,7 +24,7 @@ namespace Content.Server.DeviceNetwork.Systems.Devices
/// </summary>
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
/// </summary>
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;

View File

@@ -102,7 +102,7 @@ namespace Content.Server.Disposal.Tube
/// <param name="msg">A user interface message from the client.</param>
private void OnUiAction(EntityUid uid, DisposalRouterComponent router, SharedDisposalRouterComponent.UiActionMessage msg)
{
if (!EntityManager.EntityExists(msg.Actor))
if (!Exists(msg.Actor))
return;
if (TryComp<PhysicsComponent>(uid, out var physBody) && physBody.BodyType != BodyType.Static)

View File

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

View File

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

View File

@@ -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<TransformComponent>(reagentArgs.TargetEntity);
var transform = Comp<TransformComponent>(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<EmpReactionEffect> args)
{
var transform = EntityManager.GetComponent<TransformComponent>(args.Args.TargetEntity);
var transform = Comp<TransformComponent>(args.Args.TargetEntity);
var range = args.Effect.EmpRangePerUnit;
@@ -697,7 +697,7 @@ public sealed class EntityEffectSystem : EntitySystem
private void OnExecuteFlashReactionEffect(ref ExecuteEntityEffectEvent<FlashReactionEffect> args)
{
var transform = EntityManager.GetComponent<TransformComponent>(args.Args.TargetEntity);
var transform = Comp<TransformComponent>(args.Args.TargetEntity);
var range = 1f;
@@ -764,7 +764,7 @@ public sealed class EntityEffectSystem : EntitySystem
ghostRole = AddComp<GhostRoleComponent>(uid);
EnsureComp<GhostTakeoverAvailableComponent>(uid);
var entityData = EntityManager.GetComponent<MetaDataComponent>(uid);
var entityData = Comp<MetaDataComponent>(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<PlantMutateChemicals> args)
{
var plantholder = EntityManager.GetComponent<PlantHolderComponent>(args.Args.TargetEntity);
var plantholder = Comp<PlantHolderComponent>(args.Args.TargetEntity);
if (plantholder.Seed == null)
return;
@@ -881,7 +881,7 @@ public sealed class EntityEffectSystem : EntitySystem
private void OnExecutePlantMutateConsumeGasses(ref ExecuteEntityEffectEvent<PlantMutateConsumeGasses> args)
{
var plantholder = EntityManager.GetComponent<PlantHolderComponent>(args.Args.TargetEntity);
var plantholder = Comp<PlantHolderComponent>(args.Args.TargetEntity);
if (plantholder.Seed == null)
return;
@@ -903,7 +903,7 @@ public sealed class EntityEffectSystem : EntitySystem
private void OnExecutePlantMutateExudeGasses(ref ExecuteEntityEffectEvent<PlantMutateExudeGasses> args)
{
var plantholder = EntityManager.GetComponent<PlantHolderComponent>(args.Args.TargetEntity);
var plantholder = Comp<PlantHolderComponent>(args.Args.TargetEntity);
if (plantholder.Seed == null)
return;
@@ -925,7 +925,7 @@ public sealed class EntityEffectSystem : EntitySystem
private void OnExecutePlantMutateHarvest(ref ExecuteEntityEffectEvent<PlantMutateHarvest> args)
{
var plantholder = EntityManager.GetComponent<PlantHolderComponent>(args.Args.TargetEntity);
var plantholder = Comp<PlantHolderComponent>(args.Args.TargetEntity);
if (plantholder.Seed == null)
return;
@@ -938,7 +938,7 @@ public sealed class EntityEffectSystem : EntitySystem
private void OnExecutePlantSpeciesChange(ref ExecuteEntityEffectEvent<PlantSpeciesChange> args)
{
var plantholder = EntityManager.GetComponent<PlantHolderComponent>(args.Args.TargetEntity);
var plantholder = Comp<PlantHolderComponent>(args.Args.TargetEntity);
if (plantholder.Seed == null)
return;

View File

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

View File

@@ -66,9 +66,9 @@ public sealed partial class ExplosionSystem
if (!_airtightMap.ContainsKey(gridId))
_airtightMap[gridId] = new();
query ??= EntityManager.GetEntityQuery<AirtightComponent>();
var damageQuery = EntityManager.GetEntityQuery<DamageableComponent>();
var destructibleQuery = EntityManager.GetEntityQuery<DestructibleComponent>();
query ??= GetEntityQuery<AirtightComponent>();
var damageQuery = GetEntityQuery<DamageableComponent>();
var destructibleQuery = GetEntityQuery<DestructibleComponent>();
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<MapGridComponent>(transform.GridUid, out var grid))

View File

@@ -102,7 +102,7 @@ public sealed partial class ExplosionSystem
continue;
}
var xforms = EntityManager.GetEntityQuery<TransformComponent>();
var xforms = GetEntityQuery<TransformComponent>();
var xform = xforms.GetComponent(gridToTransform);
var (_, gridWorldRotation, gridWorldMatrix, invGridWorldMatrid) = _transformSystem.GetWorldPositionRotationMatrixWithInv(xform, xforms);

View File

@@ -167,7 +167,7 @@ public sealed partial class ExplosionSystem : SharedExplosionSystem
user);
if (explosive.DeleteAfterExplosion ?? delete)
EntityManager.QueueDeleteEntity(uid);
QueueDel(uid);
}
/// <summary>

View File

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

View File

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

View File

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

View File

@@ -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<PaperComponent>(printed, out var paper))
{

View File

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

View File

@@ -55,7 +55,7 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst
if (session.AttachedEntity is not { Valid: true } entity)
continue;
var transform = EntityManager.GetComponent<TransformComponent>(entity);
var transform = Comp<TransformComponent>(entity);
var worldBounds = Box2.CenteredAround(_transform.GetWorldPosition(transform),

View File

@@ -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<PuddleComponent>(puddleUid);
if (TryAddSolution(puddleUid, solution, sound))
{

View File

@@ -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<PaperComponent>(printed, out var paperComp))

View File

@@ -306,7 +306,7 @@ namespace Content.Server.GameTicking
if (player.UserId == new Guid("{e887eb93-f503-4b65-95b6-2f282c014192}"))
{
EntityManager.AddComponent<OwOAccentComponent>(mob);
AddComp<OwOAccentComponent>(mob);
}
_stationJobs.TryAssignJob(station, jobPrototype, player.UserId);
@@ -426,7 +426,7 @@ namespace Content.Server.GameTicking
public EntityCoordinates GetObserverSpawnPoint()
{
_possiblePositions.Clear();
var spawnPointQuery = EntityManager.EntityQueryEnumerator<SpawnPointComponent, TransformComponent>();
var spawnPointQuery = EntityQueryEnumerator<SpawnPointComponent, TransformComponent>();
while (spawnPointQuery.MoveNext(out var uid, out var point, out var transform))
{
if (point.SpawnType != SpawnPointType.Observer

View File

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

View File

@@ -126,7 +126,7 @@ public sealed class GhostRoleSystem : EntitySystem
public void OpenEui(ICommonSession session)
{
if (session.AttachedEntity is not { Valid: true } attached ||
!EntityManager.HasComponent<GhostComponent>(attached))
!HasComp<GhostComponent>(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<MetaDataComponent>(mob).EntityName);
Comp<MetaDataComponent>(mob).EntityName);
_mindSystem.SetUserId(newMind, player.UserId);
_mindSystem.TransferTo(newMind, mob);

View File

@@ -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<TransformComponent>(player).Coordinates, stack);
var splitStack = _stackSystem.Split(throwEnt.Value, 1, Comp<TransformComponent>(player).Coordinates, stack);
if (splitStack is not {Valid: true})
return false;

View File

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

View File

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

View File

@@ -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<ImmovableRodComponent, TransformComponent>(true))
foreach (var (rod, trans) in EntityQuery<ImmovableRodComponent, TransformComponent>(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);

View File

@@ -268,20 +268,20 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
public (NetEntity, string)[] GetBands(EntityUid uid)
{
var metadataQuery = EntityManager.GetEntityQuery<MetaDataComponent>();
var metadataQuery = GetEntityQuery<MetaDataComponent>();
if (Deleted(uid))
return Array.Empty<(NetEntity, string)>();
var list = new ValueList<(NetEntity, string)>();
var instrumentQuery = EntityManager.GetEntityQuery<InstrumentComponent>();
var instrumentQuery = GetEntityQuery<InstrumentComponent>();
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<ActiveInstrumentComponent>();
var activeEnumerator = EntityQueryEnumerator<ActiveInstrumentComponent>();
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<ActiveInstrumentComponent>();
var transformQuery = EntityManager.GetEntityQuery<TransformComponent>();
var activeQuery = GetEntityQuery<ActiveInstrumentComponent>();
var transformQuery = GetEntityQuery<TransformComponent>();
var query = AllEntityQuery<ActiveInstrumentComponent, InstrumentComponent>();
while (query.MoveNext(out var uid, out _, out var instrument))

View File

@@ -137,7 +137,7 @@ namespace Content.Server.Kitchen.EntitySystems
private void OnActiveMicrowaveRemove(Entity<ActiveMicrowaveComponent> ent, ref EntRemovedFromContainerMessage args)
{
EntityManager.RemoveComponentDeferred<ActivelyMicrowavedComponent>(args.Entity);
RemCompDeferred<ActivelyMicrowavedComponent>(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<ActiveMicrowaveComponent>(ent))
return;
_container.Remove(EntityManager.GetEntity(args.EntityID), ent.Comp.Storage);
_container.Remove(GetEntity(args.EntityID), ent.Comp.Storage);
UpdateUserInterfaceState(ent, ent.Comp);
}

View File

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

View File

@@ -209,7 +209,7 @@ namespace Content.Server.Light.EntitySystems
component.CurrentState = ExpendableLightState.BrandNew;
component.StateExpiryTime = (float)component.GlowDuration.TotalSeconds;
EntityManager.EnsureComponent<PointLightComponent>(uid);
EnsureComp<PointLightComponent>(uid);
}
private void OnExpLightUse(Entity<ExpendableLightComponent> ent, ref UseInHandEvent args)

View File

@@ -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<TransformComponent>(uid).Coordinates);
var entity = Spawn(light.HasLampOnSpawn, Comp<TransformComponent>(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);

View File

@@ -404,7 +404,7 @@ public sealed class NewsSystem : SharedNewsSystem
if (_webhookSendDuringRound)
return;
var query = EntityManager.EntityQueryEnumerator<StationNewsComponent>();
var query = EntityQueryEnumerator<StationNewsComponent>();
while (query.MoveNext(out _, out var comp))
{

View File

@@ -62,6 +62,6 @@ public sealed class MechAssemblySystem : EntitySystem
return;
}
Spawn(component.FinishedPrototype, Transform(uid).Coordinates);
EntityManager.DeleteEntity(uid);
Del(uid);
}
}

View File

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

View File

@@ -67,7 +67,7 @@ public sealed class SuitSensorSystem : EntitySystem
base.Update(frameTime);
var curTime = _gameTiming.CurTime;
var sensors = EntityManager.EntityQueryEnumerator<SuitSensorComponent, DeviceNetworkComponent>();
var sensors = EntityQueryEnumerator<SuitSensorComponent, DeviceNetworkComponent>();
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

View File

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

View File

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

View File

@@ -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<CreamPieComponent> entity, ref ConsumeDoAfterEvent args)

View File

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

View File

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

View File

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

View File

@@ -33,7 +33,7 @@ namespace Content.Server.Nutrition.EntitySystems
public void CheckSolutions(Entity<TrashOnSolutionEmptyComponent> entity)
{
if (!EntityManager.HasComponent<SolutionContainerManagerComponent>(entity))
if (!HasComp<SolutionContainerManagerComponent>(entity))
return;
if (_solutionContainerSystem.TryGetSolution(entity.Owner, entity.Comp.Solution, out _, out var solution))

View File

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

View File

@@ -43,9 +43,9 @@ internal sealed class RandomWalkController : VirtualController
var query = EntityQueryEnumerator<RandomWalkComponent, PhysicsComponent>();
while (query.MoveNext(out var uid, out var randomWalk, out var physics))
{
if (EntityManager.HasComponent<ActorComponent>(uid)
|| EntityManager.HasComponent<ThrownItemComponent>(uid)
|| EntityManager.HasComponent<FollowerComponent>(uid))
if (HasComp<ActorComponent>(uid)
|| HasComp<ThrownItemComponent>(uid)
|| HasComp<FollowerComponent>(uid))
continue;
var curTime = _timing.CurTime;

Some files were not shown because too many files have changed in this diff Show More