using Content.Shared.FixedPoint;
using Content.Shared.Nutrition.Prototypes;
+using Content.Shared.Tag;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
[DataField, AutoNetworkedField]
public List<ProtoId<EdiblePrototype>> SpillableTypes = new List<ProtoId<EdiblePrototype>> { "Drink" };
+ /// <summary>
+ /// Tag given to drinks that are immune to messy drinker.
+ /// For example, a spill-immune bottle.
+ /// </summary>
+ [DataField, AutoNetworkedField]
+ public ProtoId<TagPrototype> SpillImmuneTag = "MessyDrinkerImmune";
+
[DataField, AutoNetworkedField]
public LocId? SpillMessagePopup;
}
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;
[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()
{
private void OnIngested(Entity<MessyDrinkerComponent> 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);
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);