From: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> Date: Sat, 30 Aug 2025 15:38:28 +0000 (+0200) Subject: Messy drinker immunity and cleanup (#39989) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=5a40913bebdef4994425fe7245ae99924d42d4a4;p=space-station-14.git Messy drinker immunity and cleanup (#39989) init --- diff --git a/Content.Shared/Nutrition/Components/MessyDrinkerComponent.cs b/Content.Shared/Nutrition/Components/MessyDrinkerComponent.cs index c077db8231..ea145019c2 100644 --- a/Content.Shared/Nutrition/Components/MessyDrinkerComponent.cs +++ b/Content.Shared/Nutrition/Components/MessyDrinkerComponent.cs @@ -1,5 +1,6 @@ using Content.Shared.FixedPoint; using Content.Shared.Nutrition.Prototypes; +using Content.Shared.Tag; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; @@ -26,6 +27,13 @@ public sealed partial class MessyDrinkerComponent : Component [DataField, AutoNetworkedField] public List> SpillableTypes = new List> { "Drink" }; + /// + /// Tag given to drinks that are immune to messy drinker. + /// For example, a spill-immune bottle. + /// + [DataField, AutoNetworkedField] + public ProtoId SpillImmuneTag = "MessyDrinkerImmune"; + [DataField, AutoNetworkedField] public LocId? SpillMessagePopup; } diff --git a/Content.Shared/Nutrition/EntitySystems/MessyDrinkerSystem.cs b/Content.Shared/Nutrition/EntitySystems/MessyDrinkerSystem.cs index bf084e6054..d75e7bf018 100644 --- a/Content.Shared/Nutrition/EntitySystems/MessyDrinkerSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/MessyDrinkerSystem.cs @@ -2,6 +2,7 @@ using Content.Shared.Fluids; using Content.Shared.Nutrition.Components; using Content.Shared.Popups; using Content.Shared.Random.Helpers; +using Content.Shared.Tag; using Robust.Shared.Random; using Robust.Shared.Timing; @@ -13,6 +14,7 @@ public sealed class MessyDrinkerSystem : EntitySystem [Dependency] private readonly SharedPuddleSystem _puddle = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly IGameTiming _timing = default!; + [Dependency] private readonly TagSystem _tag = default!; public override void Initialize() { @@ -23,7 +25,11 @@ public sealed class MessyDrinkerSystem : EntitySystem private void OnIngested(Entity ent, ref IngestingEvent ev) { - if (ev.Split.Volume <= ent.Comp.SpillAmount) + if (_tag.HasTag(ev.Food, ent.Comp.SpillImmuneTag)) + return; + + // Cannot spill if you're being forced to drink. + if (ev.ForceFed) return; var proto = _ingestion.GetEdibleType(ev.Food); @@ -31,10 +37,6 @@ public sealed class MessyDrinkerSystem : EntitySystem if (proto == null || !ent.Comp.SpillableTypes.Contains(proto.Value)) return; - // Cannot spill if you're being forced to drink. - if (ev.ForceFed) - return; - // TODO: Replace with RandomPredicted once the engine PR is merged var seed = SharedRandomExtensions.HashCodeCombine(new() { (int)_timing.CurTick.Value, GetNetEntity(ent).Id }); var rand = new System.Random(seed); diff --git a/Resources/Prototypes/tags.yml b/Resources/Prototypes/tags.yml index a9b927cdcf..4193ca52d1 100644 --- a/Resources/Prototypes/tags.yml +++ b/Resources/Prototypes/tags.yml @@ -931,6 +931,9 @@ - type: Tag id: Medkit +- type: Tag + id: MessyDrinkerImmune + - type: Tag id: Metal