2022-05-13 00:59:03 -07:00
|
|
|
|
using Content.Server.Botany.Components;
|
2021-11-08 15:33:45 -07:00
|
|
|
|
using Content.Shared.Chemistry.Reagent;
|
2020-10-26 23:19:46 +01:00
|
|
|
|
using JetBrains.Annotations;
|
2023-06-04 16:45:02 -04:00
|
|
|
|
using Robust.Shared.Prototypes;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Shared.Random;
|
2020-10-26 23:19:46 +01:00
|
|
|
|
|
2021-11-08 15:33:45 -07:00
|
|
|
|
namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
2020-10-26 23:19:46 +01:00
|
|
|
|
{
|
|
|
|
|
|
[UsedImplicitly]
|
2021-03-05 01:08:38 +01:00
|
|
|
|
[DataDefinition]
|
2023-08-22 18:14:33 -07:00
|
|
|
|
public sealed partial class PlantCryoxadone : ReagentEffect
|
2020-10-26 23:19:46 +01:00
|
|
|
|
{
|
2021-11-21 00:35:02 -07:00
|
|
|
|
public override void Effect(ReagentEffectArgs args)
|
2020-10-26 23:19:46 +01:00
|
|
|
|
{
|
2021-11-10 03:11:28 -07:00
|
|
|
|
if (!args.EntityManager.TryGetComponent(args.SolutionEntity, out PlantHolderComponent? plantHolderComp)
|
2020-10-26 23:19:46 +01:00
|
|
|
|
|| plantHolderComp.Seed == null || plantHolderComp.Dead)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
var deviation = 0;
|
|
|
|
|
|
var seed = plantHolderComp.Seed;
|
|
|
|
|
|
var random = IoCManager.Resolve<IRobustRandom>();
|
|
|
|
|
|
if (plantHolderComp.Age > seed.Maturation)
|
|
|
|
|
|
deviation = (int) Math.Max(seed.Maturation - 1, plantHolderComp.Age - random.Next(7, 10));
|
|
|
|
|
|
else
|
|
|
|
|
|
deviation = (int) (seed.Maturation / seed.GrowthStages);
|
|
|
|
|
|
plantHolderComp.Age -= deviation;
|
|
|
|
|
|
plantHolderComp.SkipAging++;
|
|
|
|
|
|
plantHolderComp.ForceUpdate = true;
|
|
|
|
|
|
}
|
2023-06-04 16:45:02 -04:00
|
|
|
|
|
|
|
|
|
|
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-missing", ("chance", Probability));
|
2020-10-26 23:19:46 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|