Make more uids nullable (#5794)
This commit is contained in:
@@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.ActionBlocker
|
||||
{
|
||||
var self = context.GetState<SelfState>().GetValue();
|
||||
|
||||
if (self == null || !EntitySystem.Get<ActionBlockerSystem>().CanMove(self))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanMove(self))
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.AI.Utility.Considerations.Containers
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
if (target.TryGetContainer(out var container))
|
||||
if (target!.Value.TryGetContainer(out var container))
|
||||
{
|
||||
if (entMan.TryGetComponent(container.Owner, out EntityStorageComponent? storageComponent))
|
||||
{
|
||||
@@ -43,12 +43,7 @@ namespace Content.Server.AI.Utility.Considerations.Containers
|
||||
|
||||
var owner = context.GetState<SelfState>().GetValue();
|
||||
|
||||
if (owner == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return EntitySystem.Get<AiReachableSystem>().CanAccess(owner, target, SharedInteractionSystem.InteractionRange) ? 1.0f : 0.0f;
|
||||
return EntitySystem.Get<AiReachableSystem>().CanAccess(owner, target.Value, SharedInteractionSystem.InteractionRange) ? 1.0f : 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Server.AI.Utility.Considerations.Nutrition.Drink
|
||||
|
||||
if (target == null
|
||||
|| IoCManager.Resolve<IEntityManager>().Deleted(target)
|
||||
|| !EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(target, DrinkComponent.DefaultSolutionName, out var drink))
|
||||
|| !EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(target.Value, DrinkComponent.DefaultSolutionName, out var drink))
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Considerations.Nutrition.Drink
|
||||
{
|
||||
var owner = context.GetState<SelfState>().GetValue();
|
||||
|
||||
if (owner == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out ThirstComponent? thirst))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out ThirstComponent? thirst))
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace Content.Server.AI.Utility.Considerations.Nutrition.Food
|
||||
{
|
||||
var target = context.GetState<TargetEntityState>().GetValue();
|
||||
|
||||
if (target == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent<FoodComponent?>(target, out var foodComp)
|
||||
|| !EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(target, foodComp.SolutionName, out var food))
|
||||
if (target == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent<FoodComponent?>(target.Value, out var foodComp)
|
||||
|| !EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(target.Value, foodComp.SolutionName, out var food))
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Content.Server.AI.Utility.Considerations.Nutrition.Food
|
||||
{
|
||||
var owner = context.GetState<SelfState>().GetValue();
|
||||
|
||||
if (owner == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out HungerComponent? hunger))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(owner, out HungerComponent? hunger))
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user