Fix 3000 errors

This commit is contained in:
DrSmugleaf
2021-12-05 18:09:01 +01:00
parent 2bfec7ec62
commit 2a3b7d809d
569 changed files with 2979 additions and 3280 deletions

View File

@@ -10,13 +10,9 @@ namespace Content.Server.AI.Utility.Considerations.Combat.Melee
{
protected override float GetScore(Blackboard context)
{
IEntity tempQualifier = context.GetState<SelfState>().GetValue();
if (tempQualifier != null)
{
IoCManager.Resolve<IEntityManager>().HasComponent<UnarmedCombatComponent>(tempQualifier);
}
return RETURNED_VALUE ?? false ? 1.0f : 0.0f;
var entityManager = IoCManager.Resolve<IEntityManager>();
var entity = context.GetState<SelfState>().GetValue();
return entityManager.HasComponent<UnarmedCombatComponent>(entity) ? 1.0f : 0.0f;
}
}
}

View File

@@ -10,14 +10,17 @@ namespace Content.Server.AI.Utility.Considerations.Movement
protected override float GetScore(Blackboard context)
{
var self = context.GetState<SelfState>().GetValue();
var target = context.GetState<TargetEntityState>().GetValue();
if (target == null || (!IoCManager.Resolve<IEntityManager>().EntityExists(target) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(target).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).GridID != (self != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(self) : null).GridID)
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 ||
entities.GetComponent<TransformComponent>(target).GridID != entities.GetComponent<TransformComponent>(self).GridID)
{
return 0.0f;
}
// Anything further than 100 tiles gets clamped
return (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates.Position - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(self).Coordinates.Position).Length / 100;
return (entities.GetComponent<TransformComponent>(target).Coordinates.Position - entities.GetComponent<TransformComponent>(self).Coordinates.Position).Length / 100;
}
}
}

View File

@@ -27,7 +27,7 @@ namespace Content.Server.AI.Utility.Considerations.State
return 0;
}
context.GetStoredState(stateData, out StoredStateData<IEntity> state);
context.GetStoredState(stateData, out StoredStateData<EntityUid> state);
return state.GetValue() == null ? 1.0f : 0.0f;
}
}