Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PlantHolder interactions & InteractionSystem assert #32874

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions Content.Server/Botany/Systems/PlantHolderSystem.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,15 +10,13 @@
using Content.Shared.Coordinates.Helpers;
using Content.Shared.Examine;
using Content.Shared.FixedPoint;
using Content.Shared.Fluids.Components;
using Content.Shared.Hands.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Popups;
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;
Expand Down Expand Up @@ -159,6 +156,7 @@ private void OnInteractUsing(Entity<PlantHolderComponent> 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",
Expand Down Expand Up @@ -186,13 +184,15 @@ private void OnInteractUsing(Entity<PlantHolderComponent> entity, ref InteractUs
return;
}

args.Handled = true;
_popup.PopupCursor(Loc.GetString("plant-holder-component-already-seeded-message",
("name", Comp<MetaDataComponent>(uid).EntityName)), args.User, PopupType.Medium);
return;
}

if (_tagSystem.HasTag(args.Used, "Hoe"))
{
args.Handled = true;
if (component.WeedLevel > 0)
{
_popup.PopupCursor(Loc.GetString("plant-holder-component-remove-weeds-message",
Expand All @@ -212,6 +212,7 @@ private void OnInteractUsing(Entity<PlantHolderComponent> entity, ref InteractUs

if (HasComp<ShovelComponent>(args.Used))
{
args.Handled = true;
if (component.Seed != null)
{
_popup.PopupCursor(Loc.GetString("plant-holder-component-remove-plant-message",
Expand All @@ -231,6 +232,7 @@ private void OnInteractUsing(Entity<PlantHolderComponent> 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);
Expand Down Expand Up @@ -286,10 +288,15 @@ private void OnInteractUsing(Entity<PlantHolderComponent> entity, ref InteractUs
}

if (HasComp<SharpComponent>(args.Used))
{
args.Handled = true;
DoHarvest(uid, args.User, component);
return;
}

if (TryComp<ProduceComponent>(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);
Expand Down
3 changes: 2 additions & 1 deletion Content.Shared/Interaction/SharedInteractionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,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;
Expand Down
Loading