From 5ed5265b684e3f50e4727a63ead983ae825b75a9 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Fri, 18 Oct 2024 18:40:36 +1300 Subject: [PATCH] Fix PlantHolder interactions & InteractionSystem assert (#32874) --- Content.Server/Botany/Systems/PlantHolderSystem.cs | 12 ++++++++++-- .../Interaction/SharedInteractionSystem.cs | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Content.Server/Botany/Systems/PlantHolderSystem.cs b/Content.Server/Botany/Systems/PlantHolderSystem.cs index 1d5c894419225a..642f58a80b2bcd 100644 --- a/Content.Server/Botany/Systems/PlantHolderSystem.cs +++ b/Content.Server/Botany/Systems/PlantHolderSystem.cs @@ -1,6 +1,5 @@ using Content.Server.Atmos.EntitySystems; using Content.Server.Botany.Components; -using Content.Server.Fluids.Components; using Content.Server.Kitchen.Components; using Content.Server.Popups; using Content.Shared.Chemistry.EntitySystems; @@ -18,7 +17,6 @@ using Content.Shared.Random; using Content.Shared.Tag; using Robust.Server.GameObjects; -using Robust.Shared.Audio; using Robust.Shared.Audio.Systems; using Robust.Shared.Player; using Robust.Shared.Prototypes; @@ -158,6 +156,7 @@ private void OnInteractUsing(Entity entity, ref InteractUs if (!_botany.TryGetSeed(seeds, out var seed)) return; + args.Handled = true; var name = Loc.GetString(seed.Name); var noun = Loc.GetString(seed.Noun); _popup.PopupCursor(Loc.GetString("plant-holder-component-plant-success-message", @@ -185,6 +184,7 @@ private void OnInteractUsing(Entity entity, ref InteractUs return; } + args.Handled = true; _popup.PopupCursor(Loc.GetString("plant-holder-component-already-seeded-message", ("name", Comp(uid).EntityName)), args.User, PopupType.Medium); return; @@ -192,6 +192,7 @@ private void OnInteractUsing(Entity entity, ref InteractUs if (_tagSystem.HasTag(args.Used, "Hoe")) { + args.Handled = true; if (component.WeedLevel > 0) { _popup.PopupCursor(Loc.GetString("plant-holder-component-remove-weeds-message", @@ -211,6 +212,7 @@ private void OnInteractUsing(Entity entity, ref InteractUs if (HasComp(args.Used)) { + args.Handled = true; if (component.Seed != null) { _popup.PopupCursor(Loc.GetString("plant-holder-component-remove-plant-message", @@ -261,6 +263,7 @@ private void OnInteractUsing(Entity entity, ref InteractUs if (_tagSystem.HasTag(args.Used, "PlantSampleTaker")) { + args.Handled = true; if (component.Seed == null) { _popup.PopupCursor(Loc.GetString("plant-holder-component-nothing-to-sample-message"), args.User); @@ -316,10 +319,15 @@ private void OnInteractUsing(Entity entity, ref InteractUs } if (HasComp(args.Used)) + { + args.Handled = true; DoHarvest(uid, args.User, component); + return; + } if (TryComp(args.Used, out var produce)) { + args.Handled = true; _popup.PopupCursor(Loc.GetString("plant-holder-component-compost-message", ("owner", uid), ("usingItem", args.Used)), args.User, PopupType.Medium); diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index 8b51d726e8e4e8..03d36dd39d9fec 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -1439,7 +1439,8 @@ public void DoContactInteraction(EntityUid uidA, EntityUid? uidB, HandledEntityE if (uidB == null || args?.Handled == false) return; - DebugTools.AssertNotEqual(uidA, uidB.Value); + if (uidA == uidB.Value) + return; if (!TryComp(uidA, out MetaDataComponent? metaA) || metaA.EntityPaused) return;