Gets rid of all ComponentManager usages. (#4707)
This commit is contained in:
committed by
GitHub
parent
7953e5b962
commit
0be5ff829b
@@ -118,7 +118,7 @@ namespace Content.Shared.SubFloor
|
||||
|
||||
private void UpdateAll()
|
||||
{
|
||||
foreach (var comp in ComponentManager.EntityQuery<SubFloorHideComponent>(true))
|
||||
foreach (var comp in EntityManager.EntityQuery<SubFloorHideComponent>(true))
|
||||
{
|
||||
UpdateEntity(comp.Owner.Uid);
|
||||
}
|
||||
@@ -130,14 +130,14 @@ namespace Content.Shared.SubFloor
|
||||
|
||||
foreach (var uid in grid.GetAnchoredEntities(position))
|
||||
{
|
||||
if(ComponentManager.HasComponent<SubFloorHideComponent>(uid))
|
||||
if(EntityManager.HasComponent<SubFloorHideComponent>(uid))
|
||||
UpdateEntity(uid, isSubFloor);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateEntity(EntityUid uid)
|
||||
{
|
||||
var transform = ComponentManager.GetComponent<ITransformComponent>(uid);
|
||||
var transform = EntityManager.GetComponent<ITransformComponent>(uid);
|
||||
|
||||
if (!_mapManager.TryGetGrid(transform.GridID, out var grid))
|
||||
{
|
||||
@@ -162,7 +162,7 @@ namespace Content.Shared.SubFloor
|
||||
|
||||
// We only need to query the subfloor component to check if it's enabled or not when we're not on subfloor.
|
||||
// Getting components is expensive, after all.
|
||||
if (!subFloor && ComponentManager.TryGetComponent(uid, out SubFloorHideComponent? subFloorHideComponent))
|
||||
if (!subFloor && EntityManager.TryGetComponent(uid, out SubFloorHideComponent? subFloorHideComponent))
|
||||
{
|
||||
// If the component isn't enabled, then subfloor will always be true, and the entity will be shown.
|
||||
if (!subFloorHideComponent.Enabled)
|
||||
@@ -170,7 +170,7 @@ namespace Content.Shared.SubFloor
|
||||
subFloor = true;
|
||||
}
|
||||
// We only need to query the TransformComp if the SubfloorHide is enabled and requires anchoring.
|
||||
else if (subFloorHideComponent.RequireAnchored && ComponentManager.TryGetComponent(uid, out ITransformComponent? transformComponent))
|
||||
else if (subFloorHideComponent.RequireAnchored && EntityManager.TryGetComponent(uid, out ITransformComponent? transformComponent))
|
||||
{
|
||||
// If we require the entity to be anchored but it's not, this will set subfloor to true, unhiding it.
|
||||
subFloor = !transformComponent.Anchored;
|
||||
@@ -181,19 +181,19 @@ namespace Content.Shared.SubFloor
|
||||
var subFloorVisible = ShowAll || subFloor;
|
||||
|
||||
// Show sprite
|
||||
if (ComponentManager.TryGetComponent(uid, out SharedSpriteComponent? spriteComponent))
|
||||
if (EntityManager.TryGetComponent(uid, out SharedSpriteComponent? spriteComponent))
|
||||
{
|
||||
spriteComponent.Visible = subFloorVisible;
|
||||
}
|
||||
|
||||
// Set an appearance data value so visualizers can use this as needed.
|
||||
if (ComponentManager.TryGetComponent(uid, out SharedAppearanceComponent? appearanceComponent))
|
||||
if (EntityManager.TryGetComponent(uid, out SharedAppearanceComponent? appearanceComponent))
|
||||
{
|
||||
appearanceComponent.SetData(SubFloorVisuals.SubFloor, subFloorVisible);
|
||||
}
|
||||
|
||||
// So for collision all we care about is that the component is running.
|
||||
if (ComponentManager.TryGetComponent(uid, out PhysicsComponent? physicsComponent))
|
||||
if (EntityManager.TryGetComponent(uid, out PhysicsComponent? physicsComponent))
|
||||
{
|
||||
physicsComponent.CanCollide = subFloor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user