Skip to content

Commit

Permalink
Fix PlantHolder interactions & InteractionSystem assert (space-wizard…
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroJr authored and Kirus59 committed Oct 27, 2024
1 parent ce15b7b commit 5ed5265
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 10 additions & 2 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 @@ -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;
Expand Down Expand Up @@ -158,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 @@ -185,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 @@ -211,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 Down Expand Up @@ -261,6 +263,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 @@ -316,10 +319,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 @@ -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;
Expand Down

0 comments on commit 5ed5265

Please sign in to comment.