diff --git a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs index d2319d0b28..6f8141edc6 100644 --- a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs @@ -17,8 +17,10 @@ using Content.Shared.FixedPoint; using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Helpers; +using Content.Shared.MobState.Components; using Content.Shared.Nutrition.Components; using Content.Shared.Throwing; +using Content.Shared.Verbs; using JetBrains.Annotations; using Robust.Shared.Audio; using Robust.Shared.GameObjects; @@ -53,6 +55,7 @@ namespace Content.Server.Nutrition.EntitySystems SubscribeLocalEvent(HandleLand); SubscribeLocalEvent(OnUse); SubscribeLocalEvent(AfterInteract); + SubscribeLocalEvent>(AddDrinkVerb); SubscribeLocalEvent(OnExamined); SubscribeLocalEvent(OnTransferAttempt); SubscribeLocalEvent(OnDrink); @@ -328,5 +331,34 @@ namespace Content.Server.Nutrition.EntitySystems { args.Drink.CancelToken = null; } + + private void AddDrinkVerb(EntityUid uid, DrinkComponent component, GetVerbsEvent ev) + { + if (component.CancelToken != null) + return; + + if (uid == ev.User || + !ev.CanInteract || + !ev.CanAccess || + !EntityManager.TryGetComponent(ev.User, out SharedBodyComponent? body) || + !_bodySystem.TryGetComponentsOnMechanisms(ev.User, out var stomachs, body)) + return; + + if (EntityManager.TryGetComponent(uid, out var mobState) && mobState.IsAlive()) + return; + + AlternativeVerb verb = new() + { + Act = () => + { + TryDrink(ev.User, ev.User, component); + }, + IconTexture = "/Textures/Interface/VerbIcons/drink.svg.192dpi.png", + Text = Loc.GetString("drink-system-verb-drink"), + Priority = -1 + }; + + ev.Verbs.Add(verb); + } } } diff --git a/Resources/Locale/en-US/nutrition/components/drink-component.ftl b/Resources/Locale/en-US/nutrition/components/drink-component.ftl index 6205122286..5cc8f4e5e5 100644 --- a/Resources/Locale/en-US/nutrition/components/drink-component.ftl +++ b/Resources/Locale/en-US/nutrition/components/drink-component.ftl @@ -11,4 +11,7 @@ drink-component-try-use-drink-had-enough-other = They can't drink more! drink-component-try-use-drink-success-slurp = Slurp drink-component-force-feed = {$user} is trying to make you drink something! drink-component-force-feed-success = {$user} forced you to drink something! -drink-component-force-feed-success-user = You successfully feed {$target} \ No newline at end of file +drink-component-force-feed-success-user = You successfully feed {$target} + + +drink-system-verb-drink = Drink \ No newline at end of file diff --git a/Resources/Textures/Interface/VerbIcons/drink.svg b/Resources/Textures/Interface/VerbIcons/drink.svg new file mode 100644 index 0000000000..68c0b410e6 --- /dev/null +++ b/Resources/Textures/Interface/VerbIcons/drink.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + diff --git a/Resources/Textures/Interface/VerbIcons/drink.svg.192dpi.png b/Resources/Textures/Interface/VerbIcons/drink.svg.192dpi.png new file mode 100644 index 0000000000..f231eb070a Binary files /dev/null and b/Resources/Textures/Interface/VerbIcons/drink.svg.192dpi.png differ diff --git a/Resources/Textures/Interface/VerbIcons/drink.svg.192dpi.png.yml b/Resources/Textures/Interface/VerbIcons/drink.svg.192dpi.png.yml new file mode 100644 index 0000000000..5c43e23305 --- /dev/null +++ b/Resources/Textures/Interface/VerbIcons/drink.svg.192dpi.png.yml @@ -0,0 +1,2 @@ +sample: + filter: true