Files
space-station-14/Content.Server/EntityEffects/Effects/Botany/PlantAttributes/PlantRestoreSeedsEntityEffectSystem.cs
2025-12-13 20:14:48 +02:00

29 lines
1.1 KiB
C#

using Content.Server.Botany.Components;
using Content.Server.Botany.Systems;
using Content.Server.Popups;
using Content.Shared.EntityEffects;
using Content.Shared.EntityEffects.Effects.Botany.PlantAttributes;
namespace Content.Server.EntityEffects.Effects.Botany.PlantAttributes;
/// <summary>
/// Entity effect that restores ability to get seeds from plant seed maker.
/// </summary>
public sealed partial class PlantRestoreSeedsEntityEffectSystem : EntityEffectSystem<PlantHolderComponent, PlantRestoreSeeds>
{
[Dependency] private readonly PlantHolderSystem _plantHolder = default!;
[Dependency] private readonly PopupSystem _popup = default!;
protected override void Effect(Entity<PlantHolderComponent> entity, ref EntityEffectEvent<PlantRestoreSeeds> args)
{
if (entity.Comp.Seed == null || entity.Comp.Dead || entity.Comp.Seed.Immutable)
return;
if (!TryComp<PlantTraitsComponent>(entity, out var traits) || !traits.Seedless)
return;
_popup.PopupEntity(Loc.GetString("botany-plant-seedsrestored"), entity);
traits.Seedless = false;
}
}