make mice not eat uranium bananium and pills (#17110)
Co-authored-by: deltanedas <@deltanedas:kde.org> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -121,6 +121,7 @@ public sealed class NPCUtilitySystem : EntitySystem
|
||||
|
||||
private float GetScore(NPCBlackboard blackboard, EntityUid targetUid, UtilityConsideration consideration)
|
||||
{
|
||||
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
||||
switch (consideration)
|
||||
{
|
||||
case FoodValueCon:
|
||||
@@ -128,11 +129,14 @@ public sealed class NPCUtilitySystem : EntitySystem
|
||||
if (!TryComp<FoodComponent>(targetUid, out var food))
|
||||
return 0f;
|
||||
|
||||
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
||||
|
||||
if (!_food.IsDigestibleBy(owner, targetUid, food))
|
||||
return 0f;
|
||||
|
||||
// no mouse don't eat the uranium-235
|
||||
var avoidBadFood = !HasComp<IgnoreBadFoodComponent>(owner);
|
||||
if (avoidBadFood && HasComp<BadFoodComponent>(targetUid))
|
||||
return 0f;
|
||||
|
||||
return 1f;
|
||||
}
|
||||
case TargetAccessibleCon:
|
||||
@@ -160,7 +164,6 @@ public sealed class NPCUtilitySystem : EntitySystem
|
||||
}
|
||||
case TargetDistanceCon:
|
||||
{
|
||||
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
||||
var radius = blackboard.GetValueOrDefault<float>(NPCBlackboard.VisionRadius, EntityManager);
|
||||
|
||||
if (!TryComp<TransformComponent>(targetUid, out var targetXform) ||
|
||||
@@ -183,14 +186,12 @@ public sealed class NPCUtilitySystem : EntitySystem
|
||||
}
|
||||
case TargetInLOSCon:
|
||||
{
|
||||
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
||||
var radius = blackboard.GetValueOrDefault<float>(NPCBlackboard.VisionRadius, EntityManager);
|
||||
|
||||
return ExamineSystemShared.InRangeUnOccluded(owner, targetUid, radius + 0.5f, null) ? 1f : 0f;
|
||||
}
|
||||
case TargetInLOSOrCurrentCon:
|
||||
{
|
||||
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
||||
var radius = blackboard.GetValueOrDefault<float>(NPCBlackboard.VisionRadius, EntityManager);
|
||||
const float bufferRange = 0.5f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user