Fix weird lifestage autorefactors.
This commit is contained in:
@@ -32,7 +32,7 @@ namespace Content.Server.AI.Operators.Nutrition
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
// TODO: Also have this check storage a la backpack etc.
|
||||
if ((!entities.EntityExists(_target) ? EntityLifeStage.Deleted : entities.GetComponent<MetaDataComponent>(_target).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
if (entities.Deleted(_target) ||
|
||||
!entities.TryGetComponent(_owner, out HandsComponent? handsComponent) ||
|
||||
!entities.TryGetComponent(_target, out ItemComponent? itemComponent))
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Content.Server.AI.Operators.Nutrition
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
// TODO: Also have this check storage a la backpack etc.
|
||||
if ((!entities.EntityExists(_target) ? EntityLifeStage.Deleted : entities.GetComponent<MetaDataComponent>(_target).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
if (entities.Deleted(_target) ||
|
||||
!entities.TryGetComponent(_owner, out HandsComponent? handsComponent) ||
|
||||
!entities.TryGetComponent(_target, out ItemComponent? itemComponent))
|
||||
{
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace Content.Server.AI.Pathfinding
|
||||
/// <param name="entity"></param>
|
||||
private void HandleEntityAdd(EntityUid entity)
|
||||
{
|
||||
if ((!EntityManager.EntityExists(entity) ? EntityLifeStage.Deleted : EntityManager.GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
if (Deleted(entity) ||
|
||||
_lastKnownPositions.ContainsKey(entity) ||
|
||||
!EntityManager.TryGetComponent(entity, out IPhysBody? physics) ||
|
||||
!PathfindingNode.IsRelevant(entity, physics))
|
||||
|
||||
@@ -246,7 +246,7 @@ namespace Content.Server.AI.Steering
|
||||
private SteeringStatus Steer(EntityUid entity, IAiSteeringRequest steeringRequest, float frameTime)
|
||||
{
|
||||
// Main optimisation to be done below is the redundant calls and adding more variables
|
||||
if ((!EntityManager.EntityExists(entity) ? EntityLifeStage.Deleted : EntityManager.GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
if (Deleted(entity) ||
|
||||
!EntityManager.TryGetComponent(entity, out AiControllerComponent? controller) ||
|
||||
!EntitySystem.Get<ActionBlockerSystem>().CanMove(entity) ||
|
||||
!EntityManager.GetComponent<TransformComponent>(entity).GridID.IsValid())
|
||||
@@ -658,7 +658,7 @@ namespace Content.Server.AI.Steering
|
||||
// err for now we'll just assume the first entity is the center and just add a vector for it
|
||||
|
||||
//Pathfinding updates are deferred so this may not be done yet.
|
||||
if ((!EntityManager.EntityExists(physicsEntity) ? EntityLifeStage.Deleted : EntityManager.GetComponent<MetaDataComponent>(physicsEntity).EntityLifeStage) >= EntityLifeStage.Deleted) continue;
|
||||
if (Deleted(physicsEntity)) continue;
|
||||
|
||||
// if we're moving in the same direction then ignore
|
||||
// So if 2 entities are moving towards each other and both detect a collision they'll both move in the same direction
|
||||
|
||||
@@ -12,8 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Movement
|
||||
var self = context.GetState<SelfState>().GetValue();
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (context.GetState<TargetEntityState>().GetValue() is not {Valid: true} target ||
|
||||
(!entities.EntityExists(target) ? EntityLifeStage.Deleted : entities.GetComponent<MetaDataComponent>(target).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
if (context.GetState<TargetEntityState>().GetValue() is not {Valid: true} target || entities.Deleted(target) ||
|
||||
entities.GetComponent<TransformComponent>(target).GridID != entities.GetComponent<TransformComponent>(self).GridID)
|
||||
{
|
||||
return 0.0f;
|
||||
|
||||
Reference in New Issue
Block a user