Files
tbd-station-14/Content.Server/EntityEffects/Effects/PlantMetabolism/PlantRestoreSeeds.cs
Eris e5d2738a26 Sedin (#27110)
* Sedin

* almost forgot this.

* what

* Did a few fixes, tried to readd popup

* Fix popup, ready for merge

* minor change

* Generalize seed removal/destruction system, add popups in general.

* fix

* fix (again)

* deadcode is no more

* Sedin buff (nerfing the recipe soon)

* godont

* webedit moment

ok listen I had to nuke my setup because my computer was being Dumb As Shit so let me do this ONE webedit

* CRIKEY

* Revert "CRIKEY"

This reverts commit 1c6959ffd9ba8bb1e97ccf2eb0b37b3ff4ec82ee.

I was not supposed to commit that >:/

* Alright, it should be good now but I havent tested it

* ready for merge/review

* prob -> probability

* Requested changes nodoc

* Review nodoc

* documento

* thumb up emoji
2024-08-15 10:38:21 +10:00

39 lines
1.4 KiB
C#

using Content.Server.Botany.Components;
using Content.Server.Botany.Systems;
using Content.Shared.EntityEffects;
using Content.Shared.Popups;
using Robust.Shared.Prototypes;
namespace Content.Server.EntityEffects.Effects.PlantMetabolism;
/// <summary>
/// Handles restoral of seeds on a plant.
/// </summary>
public sealed partial class PlantRestoreSeeds : EntityEffect
{
public override void Effect(EntityEffectBaseArgs args)
{
if (
!args.EntityManager.TryGetComponent(args.TargetEntity, out PlantHolderComponent? plantHolderComp)
|| plantHolderComp.Seed == null
|| plantHolderComp.Dead
|| plantHolderComp.Seed.Immutable
)
return;
var plantHolder = args.EntityManager.System<PlantHolderSystem>();
var popupSystem = args.EntityManager.System<SharedPopupSystem>();
if (plantHolderComp.Seed.Seedless)
{
plantHolder.EnsureUniqueSeed(args.TargetEntity, plantHolderComp);
popupSystem.PopupEntity(Loc.GetString("botany-plant-seedsrestored"), args.TargetEntity);
plantHolderComp.Seed.Seedless = false;
}
}
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) =>
Loc.GetString("reagent-effect-guidebook-plant-seeds-add", ("chance", Probability));
}