CatStation/Content.Server/Botany/Systems/PlantAtmosphericSystem.cs
SlothBasket b1323acc43
Botany Refactor Bugfixes and Value adjustments (#45752)
* 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>
2026-09-03 14:57:34 +00:00

42 lines
1.5 KiB
C#

using Content.Server.Atmos.EntitySystems;
using Content.Shared.Atmos;
using Content.Shared.Botany.Components;
using Content.Shared.Botany.Events;
using Content.Shared.Botany.Systems;
namespace Content.Server.Botany.Systems;
public sealed partial class PlantAtmosphericSystem : SharedPlantAtmosphericSystem
{
[Dependency] private AtmosphereSystem _atmosphere = default!;
[Dependency] private PlantHolderSystem _plantHolder = default!;
[Dependency] private EntityQuery<PlantHolderComponent> _holderQuery;
[SubscribeLocalEvent]
private void OnPlantGrow(Entity<PlantAtmosphericComponent> ent, ref PlantGrowEvent args)
{
if (!_holderQuery.TryComp(ent.Owner, out var holder))
return;
var environment = _atmosphere.GetContainingMixture(ent.Owner, true, true) ?? GasMixture.SpaceGas;
if (environment.Temperature < ent.Comp.LowHeatTolerance || environment.Temperature > ent.Comp.HighHeatTolerance)
{
_plantHolder.AdjustsHealth((ent.Owner, holder), -ent.Comp.HeatToleranceDamage);
holder.ImproperHeat = true;
}
else
holder.ImproperHeat = false;
var pressure = environment.Pressure;
if (pressure < ent.Comp.LowPressureTolerance || pressure > ent.Comp.HighPressureTolerance)
{
_plantHolder.AdjustsHealth((ent.Owner, holder), -ent.Comp.PressureToleranceDamage);
holder.ImproperPressure = true;
}
else
holder.ImproperPressure = false;
Dirty(ent);
}
}