From d34c52fbd440a87cf037768ca04126553e143d34 Mon Sep 17 00:00:00 2001 From: SimpleStation14 <130339894+SimpleStation14@users.noreply.github.com> Date: Mon, 6 May 2024 12:07:44 -0700 Subject: [PATCH] Mirror: Drink from closed container fix (#195) ## Mirror of PR #26103: [Drink from closed container fix](https://github.com/space-wizards/space-station-14/pull/26103) from space-wizards [space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14) ###### `2f2cd4aab70703717541e5db3f46ae4831b4129d` PR opened by maylokana at 2024-03-14 03:59:47 UTC --- PR changed 1 files with 3 additions and 0 deletions. The PR had the following labels: ---

Original Body

> > > > ## About the PR > > All drink containers now check if the container is closed once the do-after is done, and will stop you from trying to drink from it if it is closed > > ## Why / Balance > > Bug fix. I think > > ## Technical details > > In `DrinkSystem.cs`, added an `_openable.IsClosed()` method to `OnDoAfter()`, which returns if true > > ## Media > > > https://github.com/space-wizards/space-station-14/assets/88361930/cf983879-5073-407a-98fc-2004692a8d08 > > > - [X] I have added screenshots/videos to this PR showcasing its changes ingame, **or** this PR does not require an ingame showcase > > ## Breaking changes > > N/A > > **Changelog** > > > :cl: > - fix: Entities can no longer drink from closed containers
Co-authored-by: SimpleStation14 --- Content.Server/Nutrition/EntitySystems/DrinkSystem.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs index 925e50b949d..6327cf6ae2c 100644 --- a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs @@ -311,6 +311,9 @@ private void OnDoAfter(Entity entity, ref ConsumeDoAfterEvent ar if (args.Used is null || !_solutionContainer.TryGetSolution(args.Used.Value, args.Solution, out var soln, out var solution)) return; + if (_openable.IsClosed(args.Used.Value, args.Target.Value)) + return; + // TODO this should really be checked every tick. if (_food.IsMouthBlocked(args.Target.Value)) return;