Fixes mouse self-eating (#5622)
This commit is contained in:
@@ -15,6 +15,7 @@ using Content.Shared.Database;
|
|||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Interaction.Helpers;
|
using Content.Shared.Interaction.Helpers;
|
||||||
|
using Content.Shared.MobState.Components;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -115,6 +116,10 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
if (!Resolve(uid, ref component))
|
if (!Resolve(uid, ref component))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (uid == userUid || //Suppresses self-eating
|
||||||
|
EntityManager.TryGetComponent<MobStateComponent>(uid, out var mobState) && mobState.IsAlive()) // Suppresses eating alive mobs
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!_solutionContainerSystem.TryGetSolution(uid, component.SolutionName, out var solution))
|
if (!_solutionContainerSystem.TryGetSolution(uid, component.SolutionName, out var solution))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -201,16 +206,20 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
|
|
||||||
private void AddEatVerb(EntityUid uid, FoodComponent component, GetInteractionVerbsEvent ev)
|
private void AddEatVerb(EntityUid uid, FoodComponent component, GetInteractionVerbsEvent ev)
|
||||||
{
|
{
|
||||||
if (!ev.CanInteract ||
|
if (uid == ev.UserUid ||
|
||||||
|
!ev.CanInteract ||
|
||||||
!ev.CanAccess ||
|
!ev.CanAccess ||
|
||||||
!EntityManager.TryGetComponent(ev.User.Uid, out SharedBodyComponent? body) ||
|
!EntityManager.TryGetComponent(ev.UserUid, out SharedBodyComponent? body) ||
|
||||||
!_bodySystem.TryGetComponentsOnMechanisms<StomachComponent>(ev.User.Uid, out var stomachs, body))
|
!_bodySystem.TryGetComponentsOnMechanisms<StomachComponent>(ev.UserUid, out var stomachs, body))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (EntityManager.TryGetComponent<MobStateComponent>(uid, out var mobState) && mobState.IsAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Verb verb = new();
|
Verb verb = new();
|
||||||
verb.Act = () =>
|
verb.Act = () =>
|
||||||
{
|
{
|
||||||
TryUseFood(uid, ev.User.Uid, component);
|
TryUseFood(uid, ev.UserUid, component);
|
||||||
};
|
};
|
||||||
|
|
||||||
verb.Text = Loc.GetString("food-system-verb-eat");
|
verb.Text = Loc.GetString("food-system-verb-eat");
|
||||||
|
|||||||
@@ -375,8 +375,6 @@
|
|||||||
normal: mouse-0
|
normal: mouse-0
|
||||||
crit: dead-0
|
crit: dead-0
|
||||||
dead: splat-0
|
dead: splat-0
|
||||||
# Eek! You can eat them alive for now until someone makes something that detects when
|
|
||||||
# a mob is dead or something idk
|
|
||||||
- type: Food
|
- type: Food
|
||||||
- type: Extractable
|
- type: Extractable
|
||||||
grindableSolutionName: food
|
grindableSolutionName: food
|
||||||
|
|||||||
Reference in New Issue
Block a user