Files
tbd-station-14/Content.Server/EntityEffects/Effects/PlantMetabolism/PlantDiethylamine.cs
SlamBamActionman b9fa941ca6 Turn ReagentEffects into generic EntityEffects (#28168)
* Oh the possibilities

* Merge fixes

* Forgot to remote LavaSystem oops

* Changed EntityEffectArgs to EntityEffectBaseArgs and EntityEffectReagentArgs

* Throw exception for unimplemented effectargs

* Remove Json and overrideable datafields

* Fix test issues

* Actually fix the compiling issue

* Fix comments and remove EntityEffectArgs (no longer used, replaced with EntityEffectBaseArgs)
2024-06-30 13:43:43 +10:00

42 lines
1.4 KiB
C#

using Content.Server.Botany.Components;
using Content.Server.Botany.Systems;
using Content.Shared.EntityEffects;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Server.EntityEffects.Effects.PlantMetabolism;
[UsedImplicitly]
[DataDefinition]
public sealed partial class PlantDiethylamine : 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 random = IoCManager.Resolve<IRobustRandom>();
if (random.Prob(0.1f))
{
plantHolder.EnsureUniqueSeed(args.TargetEntity, plantHolderComp);
plantHolderComp.Seed.Lifespan++;
}
if (random.Prob(0.1f))
{
plantHolder.EnsureUniqueSeed(args.TargetEntity, plantHolderComp);
plantHolderComp.Seed.Endurance++;
}
}
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-plant-diethylamine", ("chance", Probability));
}