diff --git a/Content.Server/NPC/Systems/NPCUtilitySystem.cs b/Content.Server/NPC/Systems/NPCUtilitySystem.cs index a9e93062e8..8f681b5d8a 100644 --- a/Content.Server/NPC/Systems/NPCUtilitySystem.cs +++ b/Content.Server/NPC/Systems/NPCUtilitySystem.cs @@ -121,6 +121,7 @@ public sealed class NPCUtilitySystem : EntitySystem private float GetScore(NPCBlackboard blackboard, EntityUid targetUid, UtilityConsideration consideration) { + var owner = blackboard.GetValue(NPCBlackboard.Owner); switch (consideration) { case FoodValueCon: @@ -128,11 +129,14 @@ public sealed class NPCUtilitySystem : EntitySystem if (!TryComp(targetUid, out var food)) return 0f; - var owner = blackboard.GetValue(NPCBlackboard.Owner); - if (!_food.IsDigestibleBy(owner, targetUid, food)) return 0f; + // no mouse don't eat the uranium-235 + var avoidBadFood = !HasComp(owner); + if (avoidBadFood && HasComp(targetUid)) + return 0f; + return 1f; } case TargetAccessibleCon: @@ -160,7 +164,6 @@ public sealed class NPCUtilitySystem : EntitySystem } case TargetDistanceCon: { - var owner = blackboard.GetValue(NPCBlackboard.Owner); var radius = blackboard.GetValueOrDefault(NPCBlackboard.VisionRadius, EntityManager); if (!TryComp(targetUid, out var targetXform) || @@ -183,14 +186,12 @@ public sealed class NPCUtilitySystem : EntitySystem } case TargetInLOSCon: { - var owner = blackboard.GetValue(NPCBlackboard.Owner); var radius = blackboard.GetValueOrDefault(NPCBlackboard.VisionRadius, EntityManager); return ExamineSystemShared.InRangeUnOccluded(owner, targetUid, radius + 0.5f, null) ? 1f : 0f; } case TargetInLOSOrCurrentCon: { - var owner = blackboard.GetValue(NPCBlackboard.Owner); var radius = blackboard.GetValueOrDefault(NPCBlackboard.VisionRadius, EntityManager); const float bufferRange = 0.5f; diff --git a/Content.Server/Nutrition/Components/BadFoodComponent.cs b/Content.Server/Nutrition/Components/BadFoodComponent.cs new file mode 100644 index 0000000000..901575e01c --- /dev/null +++ b/Content.Server/Nutrition/Components/BadFoodComponent.cs @@ -0,0 +1,12 @@ +using Content.Server.Nutrition.EntitySystems; + +namespace Content.Server.Nutrition.Components; + +/// +/// This component prevents NPC mobs like mice from wanting to eat something that is edible but is not exactly food. +/// Including but not limited to: uranium, death pills, insulation +/// +[RegisterComponent, Access(typeof(FoodSystem))] +public sealed class BadFoodComponent : Component +{ +} diff --git a/Content.Server/Nutrition/Components/IgnoreBadFoodComponent.cs b/Content.Server/Nutrition/Components/IgnoreBadFoodComponent.cs new file mode 100644 index 0000000000..734af7000f --- /dev/null +++ b/Content.Server/Nutrition/Components/IgnoreBadFoodComponent.cs @@ -0,0 +1,12 @@ +using Content.Server.Nutrition.EntitySystems; + +namespace Content.Server.Nutrition.Components; + +/// +/// This component allows NPC mobs to eat food with BadFoodComponent. +/// See MobMouseAdmeme for usage. +/// +[RegisterComponent, Access(typeof(FoodSystem))] +public sealed class IgnoreBadFoodComponent : Component +{ +} diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index f8d12e98a4..5991705bf2 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -945,6 +945,17 @@ - type: Puller needsHands: true +- type: entity + parent: MobMouse + id: MobMouseAdmeme + suffix: Admeme + components: + # allow admeme mouse to eat pills + - type: IgnoreBadFood + # intended for swarms that eat pills so only temporary + - type: TimedDespawn + lifetime: 60 + - type: entity parent: MobMouse id: MobMouse1 diff --git a/Resources/Prototypes/Entities/Objects/Materials/Sheets/other.yml b/Resources/Prototypes/Entities/Objects/Materials/Sheets/other.yml index b2168a7d45..a1985928e0 100644 --- a/Resources/Prototypes/Entities/Objects/Materials/Sheets/other.yml +++ b/Resources/Prototypes/Entities/Objects/Materials/Sheets/other.yml @@ -156,6 +156,7 @@ - type: Material - type: Food transferAmount: 10 + - type: BadFood - type: PhysicalComposition materialComposition: Uranium: 100 diff --git a/Resources/Prototypes/Entities/Objects/Materials/materials.yml b/Resources/Prototypes/Entities/Objects/Materials/materials.yml index 52934a0e8e..84ef08037a 100644 --- a/Resources/Prototypes/Entities/Objects/Materials/materials.yml +++ b/Resources/Prototypes/Entities/Objects/Materials/materials.yml @@ -323,6 +323,7 @@ - banana - type: Food trash: TrashBananiumPeel + - type: BadFood - type: SolutionContainerManager solutions: food: diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml index 6c444fc459..cea368e988 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml @@ -320,6 +320,7 @@ transferAmount: null eatMessage: food-swallow useSound: /Audio/Items/pill.ogg + - type: BadFood - type: FlavorProfile ignoreReagents: [] - type: SolutionContainerManager