Skip to content

Commit

Permalink
Require plants to be harvestable before sampling (space-wizards#24851)
Browse files Browse the repository at this point in the history
  • Loading branch information
Partmedia authored Feb 13, 2024
1 parent 78392e6 commit 52f74fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Content.Server/Botany/Systems/PlantHolderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,20 @@ private void OnInteractUsing(Entity<PlantHolderComponent> entity, ref InteractUs
return;
}

component.Health -= (_random.Next(3, 5) * 10);

if (!component.Harvest)
{
_popup.PopupCursor(Loc.GetString("plant-holder-component-early-sample"), args.User);
return;
}

component.Seed.Unique = false;
var seed = _botany.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates, args.User);
_randomHelper.RandomOffset(seed, 0.25f);
var displayName = Loc.GetString(component.Seed.DisplayName);
_popup.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message",
("seedName", displayName)), args.User);
component.Health -= (_random.Next(3, 5) * 10);

if (component.Seed != null && component.Seed.CanScream)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ plant-holder-component-light-improper-warning = The [color=yellow]improper light
plant-holder-component-heat-improper-warning = The [color=orange]improper temperature level alert[/color] is blinking.
plant-holder-component-pressure-improper-warning = The [color=lightblue]improper environment pressure alert[/color] is blinking.
plant-holder-component-gas-missing-warning = The [color=cyan]improper gas environment alert[/color] is blinking.
plant-holder-component-early-sample = It is not ready to sample, but you cut a bit of the plant anyway.

0 comments on commit 52f74fa

Please sign in to comment.