mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +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>
69 lines
2.4 KiB
C#
69 lines
2.4 KiB
C#
using Content.Shared.Atmos;
|
|
using Content.Shared.Botany.Components;
|
|
using Content.Shared.Botany.Events;
|
|
using Content.Shared.Random.Helpers;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.Random;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Shared.Botany.Systems;
|
|
|
|
/// <summary>
|
|
/// Consumes and emits configured gases around plants each growth tick, then merges
|
|
/// the adjusted gas mixture back into the environment.
|
|
/// </summary>
|
|
public abstract partial class SharedPlantConsumeExudeGasSystem : EntitySystem
|
|
{
|
|
[Dependency] private BotanySystem _botany = default!;
|
|
[Dependency] private IGameTiming _timing = default!;
|
|
[Dependency] private PlantMutationSystem _mutation = default!;
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnCrossPollinate(Entity<PlantConsumeExudeGasComponent> ent, ref PlantCrossPollinateEvent args)
|
|
{
|
|
if (!_botany.TryGetPlantComponent<PlantConsumeExudeGasComponent>(args.PollenData, args.PollenProtoId, out var pollenData))
|
|
return;
|
|
|
|
_mutation.CrossGasses(ent, ref ent.Comp.ConsumeGasses, pollenData.ConsumeGasses);
|
|
_mutation.CrossGasses(ent, ref ent.Comp.ExudeGasses, pollenData.ExudeGasses);
|
|
Dirty(ent);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Adds a random amount of a random gas to the exude gasses.
|
|
/// </summary>
|
|
[PublicAPI]
|
|
public void MutateRandomExudeGasses(Entity<PlantConsumeExudeGasComponent?> ent, float amount)
|
|
{
|
|
if (!Resolve(ent, ref ent.Comp, false))
|
|
return;
|
|
|
|
var random = SharedRandomExtensions.PredictedRandom(_timing, GetNetEntity(ent));
|
|
var gas = random.Pick(Enum.GetValues<Gas>());
|
|
|
|
var gasses = ent.Comp.ExudeGasses;
|
|
if (!gasses.TryAdd(gas, amount))
|
|
gasses[gas] += amount;
|
|
|
|
DirtyField(ent, nameof(ent.Comp.ExudeGasses));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Adds a random amount of a random gas to the consume gasses.
|
|
/// </summary>
|
|
[PublicAPI]
|
|
public void MutateRandomConsumeGasses(Entity<PlantConsumeExudeGasComponent?> ent, float amount)
|
|
{
|
|
if (!Resolve(ent, ref ent.Comp, false))
|
|
return;
|
|
|
|
var random = SharedRandomExtensions.PredictedRandom(_timing, GetNetEntity(ent));
|
|
var gasses = ent.Comp.ConsumeGasses;
|
|
var gas = random.Pick(Enum.GetValues<Gas>());
|
|
|
|
if (!gasses.TryAdd(gas, amount))
|
|
gasses[gas] += amount;
|
|
|
|
DirtyField(ent, nameof(ent.Comp.ConsumeGasses));
|
|
}
|
|
}
|