2021-07-17 02:37:09 +02:00
|
|
|
|
using Content.Server.Botany.Components;
|
2021-06-09 22:19:39 +02:00
|
|
|
|
using Content.Shared.Botany;
|
2021-11-08 15:33:45 -07:00
|
|
|
|
using Content.Shared.Chemistry.Components;
|
|
|
|
|
|
using Content.Shared.Chemistry.Reagent;
|
2020-10-26 23:19:46 +01:00
|
|
|
|
using JetBrains.Annotations;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-10-26 23:19:46 +01:00
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
using Robust.Shared.Maths;
|
|
|
|
|
|
using Robust.Shared.Random;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
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]
|
2021-11-08 15:33:45 -07:00
|
|
|
|
public class PlantDiethylamine : ReagentEffect
|
2020-10-26 23:19:46 +01:00
|
|
|
|
{
|
2021-11-10 03:11:28 -07:00
|
|
|
|
public override void Metabolize(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 ||
|
|
|
|
|
|
plantHolderComp.Seed.Immutable)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
var random = IoCManager.Resolve<IRobustRandom>();
|
|
|
|
|
|
|
2021-11-08 15:33:45 -07:00
|
|
|
|
var chance = MathHelper.Lerp(15f, 125f, plantHolderComp.Seed.Lifespan) * 2f;
|
2020-10-26 23:19:46 +01:00
|
|
|
|
if (random.Prob(chance))
|
|
|
|
|
|
{
|
|
|
|
|
|
plantHolderComp.CheckForDivergence(true);
|
|
|
|
|
|
plantHolderComp.Seed.Lifespan++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-11-08 15:33:45 -07:00
|
|
|
|
chance = MathHelper.Lerp(15f, 125f, plantHolderComp.Seed.Endurance) * 2f;
|
2020-10-26 23:19:46 +01:00
|
|
|
|
if (random.Prob(chance))
|
|
|
|
|
|
{
|
|
|
|
|
|
plantHolderComp.CheckForDivergence(true);
|
|
|
|
|
|
plantHolderComp.Seed.Endurance++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|