Some more fixes
This commit is contained in:
@@ -85,7 +85,7 @@ namespace Content.Client.Actions
|
||||
{
|
||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
if (playerEntity == null ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent<ClientActionsComponent?>(playerEntity, out var actionsComponent)) return false;
|
||||
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return false;
|
||||
|
||||
actionsComponent.HandleHotbarKeybind(slot, args);
|
||||
return true;
|
||||
@@ -99,7 +99,7 @@ namespace Content.Client.Actions
|
||||
{
|
||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
if (playerEntity == null ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent<ClientActionsComponent?>(playerEntity, out var actionsComponent)) return false;
|
||||
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return false;
|
||||
|
||||
actionsComponent.HandleChangeHotbarKeybind(hotbar, args);
|
||||
return true;
|
||||
@@ -111,7 +111,7 @@ namespace Content.Client.Actions
|
||||
{
|
||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
if (playerEntity == null ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent<ClientActionsComponent?>(playerEntity, out var actionsComponent)) return false;
|
||||
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return false;
|
||||
|
||||
return actionsComponent.TargetingOnUse(args);
|
||||
}
|
||||
@@ -120,7 +120,7 @@ namespace Content.Client.Actions
|
||||
{
|
||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
if (playerEntity == null ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent<ClientActionsComponent?>(playerEntity, out var actionsComponent)) return;
|
||||
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return;
|
||||
|
||||
actionsComponent.ToggleActionsMenu();
|
||||
}
|
||||
|
||||
@@ -111,12 +111,12 @@ namespace Content.Server.Atmos.Components
|
||||
|
||||
public static class MovedByPressureExtensions
|
||||
{
|
||||
public static bool IsMovedByPressure(this IEntity entity)
|
||||
public static bool IsMovedByPressure(this EntityUid entity)
|
||||
{
|
||||
return entity.IsMovedByPressure(out _);
|
||||
}
|
||||
|
||||
public static bool IsMovedByPressure(this IEntity entity, [NotNullWhen(true)] out MovedByPressureComponent? moved)
|
||||
public static bool IsMovedByPressure(this EntityUid entity, [NotNullWhen(true)] out MovedByPressureComponent? moved)
|
||||
{
|
||||
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out moved) &&
|
||||
moved.Enabled;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Server.Coordinates.Helpers
|
||||
{
|
||||
public static class SnapgridHelper
|
||||
{
|
||||
public static void SnapToGrid(this IEntity entity, IEntityManager? entityManager = null, IMapManager? mapManager = null)
|
||||
public static void SnapToGrid(this EntityUid entity, IEntityManager? entityManager = null, IMapManager? mapManager = null)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates.SnapToGrid(entityManager, mapManager);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Server.PDA
|
||||
/// </summary>
|
||||
/// <param name="player">The player to check in.</param>
|
||||
/// <returns>The id card component.</returns>
|
||||
public static IdCardComponent? GetHeldId(this IEntity player)
|
||||
public static IdCardComponent? GetHeldId(this EntityUid player)
|
||||
{
|
||||
IdCardComponent? firstIdInPda = null;
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Content.Server.PDA
|
||||
/// <param name="player">The player to check in.</param>
|
||||
/// <param name="id">The id card component.</param>
|
||||
/// <returns>true if found, false otherwise.</returns>
|
||||
public static bool TryGetHeldId(this IEntity player, [NotNullWhen(true)] out IdCardComponent? id)
|
||||
public static bool TryGetHeldId(this EntityUid player, [NotNullWhen(true)] out IdCardComponent? id)
|
||||
{
|
||||
return (id = player.GetHeldId()) != null;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Content.Server.Popups
|
||||
/// </summary>
|
||||
/// <param name="source">The entity on which to popup the message.</param>
|
||||
/// <param name="message">The message to show.</param>
|
||||
public static void PopupMessageOtherClients(this IEntity source, string message)
|
||||
public static void PopupMessageOtherClients(this EntityUid source, string message)
|
||||
{
|
||||
var viewers = Filter.Empty()
|
||||
.AddPlayersByPvs(source)
|
||||
@@ -49,7 +49,7 @@ namespace Content.Server.Popups
|
||||
/// <param name="range">
|
||||
/// The range in which to search for players, defaulting to one screen.
|
||||
/// </param>
|
||||
public static void PopupMessageEveryone(this IEntity source, string message, IPlayerManager? playerManager = null, int range = 15)
|
||||
public static void PopupMessageEveryone(this EntityUid source, string message, IPlayerManager? playerManager = null, int range = 15)
|
||||
{
|
||||
source.PopupMessage(message);
|
||||
source.PopupMessageOtherClients(message);
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Content.Server.Throwing
|
||||
/// <param name="strength">How much the direction vector should be multiplied for velocity.</param>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="pushbackRatio">The ratio of impulse applied to the thrower</param>
|
||||
internal static void TryThrow(this IEntity entity, Vector2 direction, float strength = 1.0f, IEntity? user = null, float pushbackRatio = 1.0f)
|
||||
internal static void TryThrow(this EntityUid entity, Vector2 direction, float strength = 1.0f, EntityUid? user = null, float pushbackRatio = 1.0f)
|
||||
{
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
strength <= 0f ||
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Content.Server.UserInterface
|
||||
{
|
||||
public static class UserInterfaceHelpers
|
||||
{
|
||||
public static BoundUserInterface? GetUIOrNull(this IEntity entity, object uiKey)
|
||||
public static BoundUserInterface? GetUIOrNull(this EntityUid entity, object uiKey)
|
||||
{
|
||||
return IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ServerUserInterfaceComponent>(entity)?.GetBoundUserInterfaceOrNull(uiKey);
|
||||
}
|
||||
|
||||
@@ -547,7 +547,7 @@ namespace Content.Shared.Body.Components
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out SharedBodyPartComponent? part))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Value, out SharedBodyPartComponent? part))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace Content.Shared.CombatMode
|
||||
|
||||
private void CombatModeActiveHandler(CombatModeSystemMessages.SetCombatModeActiveMessage ev, EntitySessionEventArgs eventArgs)
|
||||
{
|
||||
var entity = eventArgs.SenderSession?.AttachedEntity;
|
||||
var entity = eventArgs.SenderSession.AttachedEntityUid;
|
||||
|
||||
if (entity == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out SharedCombatModeComponent? combatModeComponent))
|
||||
if (entity == null || !EntityManager.TryGetComponent(entity.Value, out SharedCombatModeComponent? combatModeComponent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -195,9 +195,10 @@ namespace Content.Shared.Examine
|
||||
|
||||
public static bool InRangeUnOccluded(AfterInteractEventArgs args, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var originPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(args.User).MapPosition;
|
||||
EntityUid? tempQualifier = args.Target;
|
||||
var otherPos = (tempQualifier != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier) : null).MapPosition ?? args.ClickLocation.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var originPos = entityManager.GetComponent<TransformComponent>(args.User).MapPosition;
|
||||
var target = args.Target;
|
||||
var otherPos = (target != null ? entityManager.GetComponent<TransformComponent>(target.Value).MapPosition : args.ClickLocation.ToMap(entityManager));
|
||||
|
||||
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@ namespace Content.Shared.Hands
|
||||
SubscribeAllEvent<RequestSetHandEvent>(HandleSetHand);
|
||||
}
|
||||
|
||||
private static void HandleSetHand(RequestSetHandEvent msg, EntitySessionEventArgs eventArgs)
|
||||
private void HandleSetHand(RequestSetHandEvent msg, EntitySessionEventArgs eventArgs)
|
||||
{
|
||||
var entity = eventArgs.SenderSession.AttachedEntity;
|
||||
var entity = eventArgs.SenderSession.AttachedEntityUid;
|
||||
|
||||
if (entity == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out SharedHandsComponent? hands))
|
||||
if (entity == null || !EntityManager.TryGetComponent(entity.Value, out SharedHandsComponent? hands))
|
||||
return;
|
||||
|
||||
hands.ActiveHand = msg.HandName;
|
||||
|
||||
@@ -14,19 +14,6 @@ namespace Content.Shared.Interaction.Helpers
|
||||
private static SharedInteractionSystem SharedInteractionSystem => EntitySystem.Get<SharedInteractionSystem>();
|
||||
|
||||
#region Entities
|
||||
public static bool InRangeUnobstructed(
|
||||
this EntityUid origin,
|
||||
EntityUid other,
|
||||
float range = InteractionRange,
|
||||
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = false,
|
||||
bool popup = false)
|
||||
{
|
||||
return SharedInteractionSystem.InRangeUnobstructed(origin, other, range, collisionMask, predicate,
|
||||
ignoreInsideBlocker, popup);
|
||||
}
|
||||
|
||||
public static bool InRangeUnobstructed(
|
||||
this EntityUid origin,
|
||||
EntityUid other,
|
||||
|
||||
@@ -46,19 +46,19 @@ namespace Content.Shared.Movement.EntitySystems
|
||||
if (!TryGetAttachedComponent<IMoverComponent>(session, out var moverComp))
|
||||
return;
|
||||
|
||||
var owner = session?.AttachedEntity;
|
||||
var owner = session?.AttachedEntityUid;
|
||||
|
||||
if (owner != null && session != null)
|
||||
{
|
||||
EntityManager.EventBus.RaiseLocalEvent(owner, new RelayMoveInputEvent(session));
|
||||
EntityManager.EventBus.RaiseLocalEvent(owner.Value, new RelayMoveInputEvent(session));
|
||||
|
||||
// For stuff like "Moving out of locker" or the likes
|
||||
if (owner.IsInContainer() &&
|
||||
(!IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out MobStateComponent? mobState) ||
|
||||
if (owner.Value.IsInContainer() &&
|
||||
(!EntityManager.TryGetComponent(owner.Value, out MobStateComponent? mobState) ||
|
||||
mobState.IsAlive()))
|
||||
{
|
||||
var relayMoveEvent = new RelayMovementEntityEvent(owner);
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(owner).ParentUid, relayMoveEvent);
|
||||
var relayMoveEvent = new RelayMovementEntityEvent(owner.Value);
|
||||
EntityManager.EventBus.RaiseLocalEvent(EntityManager.GetComponent<TransformComponent>(owner.Value).ParentUid, relayMoveEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,12 +80,12 @@ namespace Content.Shared.Movement.EntitySystems
|
||||
{
|
||||
component = default;
|
||||
|
||||
var ent = session?.AttachedEntity;
|
||||
var ent = session?.AttachedEntityUid;
|
||||
|
||||
if (ent == null || !IoCManager.Resolve<IEntityManager>().EntityExists(ent))
|
||||
if (ent == null || !IoCManager.Resolve<IEntityManager>().EntityExists(ent.Value))
|
||||
return false;
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(ent, out T? comp))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(ent.Value, out T? comp))
|
||||
return false;
|
||||
|
||||
component = comp;
|
||||
|
||||
@@ -81,14 +81,14 @@ namespace Content.Shared.Pulling
|
||||
var pullableOldPullerE = pullable?.Puller;
|
||||
if (pullableOldPullerE != null)
|
||||
{
|
||||
ForceDisconnect(IoCManager.Resolve<IEntityManager>().GetComponent<SharedPullerComponent>(pullableOldPullerE), pullable!);
|
||||
ForceDisconnect(IoCManager.Resolve<IEntityManager>().GetComponent<SharedPullerComponent>(pullableOldPullerE.Value), pullable!);
|
||||
}
|
||||
|
||||
// Continue with the puller.
|
||||
var pullerOldPullableE = puller?.Pulling;
|
||||
if (pullerOldPullableE != null)
|
||||
{
|
||||
ForceDisconnect(puller!, IoCManager.Resolve<IEntityManager>().GetComponent<SharedPullableComponent>(pullerOldPullableE));
|
||||
ForceDisconnect(puller!, IoCManager.Resolve<IEntityManager>().GetComponent<SharedPullableComponent>(pullerOldPullableE.Value));
|
||||
}
|
||||
|
||||
// And now for the actual connection (if any).
|
||||
|
||||
@@ -38,8 +38,10 @@ namespace Content.Shared.Shuttles.Components
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetEntity(state.Console.Value, out var consoleEnt) ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(consoleEnt, out SharedShuttleConsoleComponent? shuttleConsoleComponent))
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!entityManager.TryGetEntity(state.Console.Value, out var consoleEnt) ||
|
||||
!entityManager.TryGetComponent(consoleEnt.Value, out SharedShuttleConsoleComponent? shuttleConsoleComponent))
|
||||
{
|
||||
Logger.Warning($"Unable to set Helmsman console to {state.Console.Value}");
|
||||
return;
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace Content.Shared.Slippery
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out PhysicsComponent? otherPhysics) ||
|
||||
if (!EntityManager.TryGetComponent(entity.Value, out PhysicsComponent? otherPhysics) ||
|
||||
!body.GetWorldAABB().Intersects(otherPhysics.GetWorldAABB()))
|
||||
{
|
||||
component.Colliding.Remove(uid);
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Shared.Spawning
|
||||
{
|
||||
public static class EntitySystemExtensions
|
||||
{
|
||||
public static IEntity? SpawnIfUnobstructed(
|
||||
public static EntityUid? SpawnIfUnobstructed(
|
||||
this IEntityManager entityManager,
|
||||
string? prototypeName,
|
||||
EntityCoordinates coordinates,
|
||||
@@ -24,7 +24,7 @@ namespace Content.Shared.Spawning
|
||||
return entityManager.SpawnIfUnobstructed(prototypeName, mapCoordinates, collisionLayer, box, physicsManager);
|
||||
}
|
||||
|
||||
public static IEntity? SpawnIfUnobstructed(
|
||||
public static EntityUid? SpawnIfUnobstructed(
|
||||
this IEntityManager entityManager,
|
||||
string? prototypeName,
|
||||
MapCoordinates coordinates,
|
||||
@@ -59,7 +59,7 @@ namespace Content.Shared.Spawning
|
||||
string? prototypeName,
|
||||
EntityCoordinates coordinates,
|
||||
CollisionGroup collisionLayer,
|
||||
[NotNullWhen(true)] out IEntity? entity,
|
||||
[NotNullWhen(true)] out EntityUid? entity,
|
||||
Box2? box = null,
|
||||
SharedPhysicsSystem? physicsManager = null)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ namespace Content.Shared.Spawning
|
||||
string? prototypeName,
|
||||
MapCoordinates coordinates,
|
||||
CollisionGroup collisionLayer,
|
||||
[NotNullWhen(true)] out IEntity? entity,
|
||||
[NotNullWhen(true)] out EntityUid? entity,
|
||||
in Box2? box = null,
|
||||
SharedPhysicsSystem? physicsManager = null)
|
||||
{
|
||||
|
||||
@@ -79,8 +79,8 @@ namespace Content.Shared.SubFloor
|
||||
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.
|
||||
IEntity tempQualifier = EntityManager.GetEntity(uid);
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(tempQualifier) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(tempQualifier).EntityLifeStage) >= EntityLifeStage.Terminating) return;
|
||||
if (EntityManager.GetComponent<MetaDataComponent>(uid).EntityLifeStage >= EntityLifeStage.Terminating)
|
||||
return;
|
||||
|
||||
// Regardless of whether we're on a subfloor or not, unhide.
|
||||
UpdateEntity(uid, true);
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.Shared.Tabletop
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<MapComponent>(parent) && !IoCManager.Resolve<IEntityManager>().HasComponent<IMapGridComponent>(parent))
|
||||
if (!EntityManager.HasComponent<MapComponent>(parent) && !EntityManager.HasComponent<IMapGridComponent>(parent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user