mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-10 10:51:14 +03:00
* Fixes Cryoxadone De-Age, properly adjusts lastHarvest. If age would be reduced below 0 reverts plant to seed with current genetics. * Botany Bugfixes. Cryoxadone De-Age fix. Cryox Regression to seed re-added. Seedless Produce no longer have seeds. Proper Temp tollerance ranges restored. Production no longer clamped to maturation. * Restore Content Server+Client run configuration * Fix formatting in Content Server+Client run configuration * Address botany review feedback * review * fix weed * fix * fix 2 * Update PlantSystem.cs * refactor: revert to EntityTerminatingEvent and leave warning for next generations --------- Co-authored-by: Pok245 <113675512+Pok27@users.noreply.github.com> Co-authored-by: Fildrance <fildrance@gmail.com>
50 lines
2 KiB
C#
50 lines
2 KiB
C#
using Content.Shared.Botany.Components;
|
|
using Content.Shared.Botany.Systems;
|
|
using Robust.Shared.Prototypes;
|
|
using Content.Shared.Random.Helpers;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Shared.EntityEffects.Effects.Botany.PlantAttributes;
|
|
|
|
/// <summary>
|
|
/// Entity effect that reverts aging of plant.
|
|
/// </summary>
|
|
/// <inheritdoc cref="EntityEffectSystem{T,TEffect}"/>
|
|
public sealed partial class PlantCryoxadoneEntityEffectSystem : EntityEffectSystem<PlantComponent, PlantCryoxadone>
|
|
{
|
|
[Dependency] private PlantSystem _plant = default!;
|
|
[Dependency] private PlantHolderSystem _plantHolder = default!;
|
|
[Dependency] private PlantHarvestSystem _plantHarvest = default!;
|
|
[Dependency] private IGameTiming _timing = default!;
|
|
[Dependency] private BotanySystem _botany = default!;
|
|
|
|
protected override void Effect(Entity<PlantComponent> entity, ref EntityEffectEvent<PlantCryoxadone> args)
|
|
{
|
|
if (_plantHolder.IsDead(entity.Owner))
|
|
return;
|
|
|
|
if (!TryComp<PlantHolderComponent>(entity, out var plantHolder))
|
|
return;
|
|
|
|
var random = SharedRandomExtensions.PredictedRandom(_timing, GetNetEntity(entity));
|
|
var deviation = plantHolder.Age > entity.Comp.Maturation
|
|
? (int)Math.Max(entity.Comp.Maturation - 1, plantHolder.Age - random.Next(7, 10))
|
|
: (int)(entity.Comp.Maturation / entity.Comp.GrowthStages);
|
|
if (plantHolder.Age - deviation < 0)
|
|
{
|
|
_botany.TryRevertPlantToSeed(entity.Owner);
|
|
return;
|
|
}
|
|
|
|
_plantHolder.AdjustsAge((entity.Owner, plantHolder), -deviation);
|
|
_plantHarvest.ResetHarvestProgress((entity.Owner, plantHolder));
|
|
_plant.ForceUpdate(entity.AsNullable());
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc cref="EntityEffect"/>
|
|
public sealed partial class PlantCryoxadone : EntityEffectBase<PlantCryoxadone>
|
|
{
|
|
public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) =>
|
|
Loc.GetString("entity-effect-guidebook-plant-cryoxadone", ("chance", Probability));
|
|
}
|