Clipping a harvestable plant yields undamaged seeds (#25541)
Clipping a plant in any condition currently causes it and its clippings to be damaged. Make clipping harvestable (already eligible for seed extractor) plants yield seeds at full health.
This commit is contained in:
@@ -159,7 +159,6 @@ public sealed class PlantHolderSystem : EntitySystem
|
|||||||
if (!_botany.TryGetSeed(seeds, out var seed))
|
if (!_botany.TryGetSeed(seeds, out var seed))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float? seedHealth = seeds.HealthOverride;
|
|
||||||
var name = Loc.GetString(seed.Name);
|
var name = Loc.GetString(seed.Name);
|
||||||
var noun = Loc.GetString(seed.Noun);
|
var noun = Loc.GetString(seed.Noun);
|
||||||
_popup.PopupCursor(Loc.GetString("plant-holder-component-plant-success-message",
|
_popup.PopupCursor(Loc.GetString("plant-holder-component-plant-success-message",
|
||||||
@@ -169,9 +168,9 @@ public sealed class PlantHolderSystem : EntitySystem
|
|||||||
component.Seed = seed;
|
component.Seed = seed;
|
||||||
component.Dead = false;
|
component.Dead = false;
|
||||||
component.Age = 1;
|
component.Age = 1;
|
||||||
if (seedHealth is float realSeedHealth)
|
if (seeds.HealthOverride != null)
|
||||||
{
|
{
|
||||||
component.Health = realSeedHealth;
|
component.Health = seeds.HealthOverride.Value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -288,8 +287,18 @@ public sealed class PlantHolderSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
component.Health -= (_random.Next(3, 5) * 10);
|
component.Health -= (_random.Next(3, 5) * 10);
|
||||||
|
|
||||||
|
float? healthOverride;
|
||||||
|
if (component.Harvest)
|
||||||
|
{
|
||||||
|
healthOverride = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
healthOverride = component.Health;
|
||||||
|
}
|
||||||
component.Seed.Unique = false;
|
component.Seed.Unique = false;
|
||||||
var seed = _botany.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates, args.User, component.Health);
|
var seed = _botany.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates, args.User, healthOverride);
|
||||||
_randomHelper.RandomOffset(seed, 0.25f);
|
_randomHelper.RandomOffset(seed, 0.25f);
|
||||||
var displayName = Loc.GetString(component.Seed.DisplayName);
|
var displayName = Loc.GetString(component.Seed.DisplayName);
|
||||||
_popup.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message",
|
_popup.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message",
|
||||||
|
|||||||
Reference in New Issue
Block a user