Апстрим некоторого из ботаники (#415)
* Rainbow Weed (#25759) * rainbow weed * Lipolicide * psicodine + mannitol * happiness * ground + dried + smokables * damn you notepad++ * fix WHY NOT TELL ME ALL THE PROBLEMS AT THE SAME TIME!!! * work * work i beg you * recipe good * possibly fix merge conflict * remove reagents * Psicodine, Mannitol, Lipolicide and Happiness (#27134) * reagents * Update Resources/Locale/en-US/reagents/meta/narcotics.ftl --------- Co-authored-by: Kara <lunarautomaton6@gmail.com> * fix cannabis * Killer tomatoes (#26053) * make tomatoes * many friends! many mommies * finish * renaming system * fix * Update miscellaneous.yml * Update Content.Server/NPC/Systems/NPCImpritingBehaviourSystem.cs Co-authored-by: faint <46868845+ficcialfaint@users.noreply.github.com> * N * deleete exception? * merge conflict fix * fix? * fuck you * sloth fixes * fixess? * fix --------- Co-authored-by: faint <46868845+ficcialfaint@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com> * Small tomato killer tweak (#27265) * Update miscellaneous.yml * Update mobspawn.yml * Update miscellaneous.yml * Update miscellaneous.yml * Spaceman's Trumpet and Lily (#25090) * trumpet + lily +polypy * trumbet * Change plant clipping mechanics (#25326) Make seeds from clipped plants inherit the decreased health from parents. Also require one growth stage before clipping. * fixes * Resprite & hand position correction of Nettle & Death Nettle (#25421) Resprite of Nettle & Death Nettle. Corrected R & L hand locations for all orientations of both plants. * Remake hairflowers (#25475) * Add more lily usage (orange hairflower and flowercrown) * comit 2 * ee * more fixes * w * im stupid * bring poppy in authodrobe * weh --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Revert "Remake hairflowers (#25475)" This reverts commit 6b2a9b96b18a6c854c3aea149611d7dd496518c0. * Make Holy Water more like Water (#27068) holy water can now be used to satiate thirst, water plants, and extinguish fires. * New plant mutation: Pyrotton (#27200) * WIP * sprites n stuff * flavour * maybe fix * add stack * fix parent * Rewords plant/effect descriptions for clarity (#28156) (#28169) * Rewords plant/effect descriptions for clarity (#28156) * Forgot Robust Harvest. * Update Resources/Locale/en-US/guidebook/chemistry/effects.ftl --------- Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> --------- Co-authored-by: potato1234_x <79580518+potato1234x@users.noreply.github.com> Co-authored-by: Kara <lunarautomaton6@gmail.com> Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com> Co-authored-by: faint <46868845+ficcialfaint@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com> Co-authored-by: Flesh <62557990+PolterTzi@users.noreply.github.com> Co-authored-by: MjrLandWhale <brandonemitch@gmail.com> Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Ghagliiarghii <68826635+Ghagliiarghii@users.noreply.github.com> Co-authored-by: Ubaser <134914314+UbaserB@users.noreply.github.com> Co-authored-by: alex-georgeff <54858069+taurie@users.noreply.github.com> Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
This commit is contained in:
@@ -15,6 +15,12 @@ namespace Content.Server.Botany.Components
|
||||
[DataField("seed")]
|
||||
public SeedData? Seed;
|
||||
|
||||
/// <summary>
|
||||
/// If not null, overrides the plant's initial health. Otherwise, the plant's initial health is set to the Endurance value.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float? HealthOverride = null;
|
||||
|
||||
/// <summary>
|
||||
/// Name of a base seed prototype that is used if <see cref="Seed"/> is null.
|
||||
/// </summary>
|
||||
|
||||
@@ -104,11 +104,12 @@ public sealed partial class BotanySystem : EntitySystem
|
||||
/// <summary>
|
||||
/// Spawns a new seed packet on the floor at a position, then tries to put it in the user's hands if possible.
|
||||
/// </summary>
|
||||
public EntityUid SpawnSeedPacket(SeedData proto, EntityCoordinates coords, EntityUid user)
|
||||
public EntityUid SpawnSeedPacket(SeedData proto, EntityCoordinates coords, EntityUid user, float? healthOverride = null)
|
||||
{
|
||||
var seed = Spawn(proto.PacketPrototype, coords);
|
||||
var seedComp = EnsureComp<SeedComponent>(seed);
|
||||
seedComp.Seed = proto;
|
||||
seedComp.HealthOverride = healthOverride;
|
||||
|
||||
var name = Loc.GetString(proto.Name);
|
||||
var noun = Loc.GetString(proto.Noun);
|
||||
|
||||
@@ -71,6 +71,17 @@ public sealed class PlantHolderSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private int GetCurrentGrowthStage(Entity<PlantHolderComponent> entity)
|
||||
{
|
||||
var (uid, component) = entity;
|
||||
|
||||
if (component.Seed == null)
|
||||
return 0;
|
||||
|
||||
var result = Math.Max(1, (int) (component.Age * component.Seed.GrowthStages / component.Seed.Maturation));
|
||||
return result;
|
||||
}
|
||||
|
||||
private void OnExamine(Entity<PlantHolderComponent> entity, ref ExaminedEvent args)
|
||||
{
|
||||
if (!args.IsInDetailsRange)
|
||||
@@ -148,6 +159,7 @@ public sealed class PlantHolderSystem : EntitySystem
|
||||
if (!_botany.TryGetSeed(seeds, out var seed))
|
||||
return;
|
||||
|
||||
float? seedHealth = seeds.HealthOverride;
|
||||
var name = Loc.GetString(seed.Name);
|
||||
var noun = Loc.GetString(seed.Noun);
|
||||
_popup.PopupCursor(Loc.GetString("plant-holder-component-plant-success-message",
|
||||
@@ -157,7 +169,14 @@ public sealed class PlantHolderSystem : EntitySystem
|
||||
component.Seed = seed;
|
||||
component.Dead = false;
|
||||
component.Age = 1;
|
||||
component.Health = component.Seed.Endurance;
|
||||
if (seedHealth is float realSeedHealth)
|
||||
{
|
||||
component.Health = realSeedHealth;
|
||||
}
|
||||
else
|
||||
{
|
||||
component.Health = component.Seed.Endurance;
|
||||
}
|
||||
component.LastCycle = _gameTiming.CurTime;
|
||||
|
||||
QueueDel(args.Used);
|
||||
@@ -265,9 +284,15 @@ public sealed class PlantHolderSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetCurrentGrowthStage(entity) <= 1)
|
||||
{
|
||||
_popup.PopupCursor(Loc.GetString("plant-holder-component-early-sample-message"), args.User);
|
||||
return;
|
||||
}
|
||||
|
||||
component.Health -= (_random.Next(3, 5) * 10);
|
||||
component.Seed.Unique = false;
|
||||
var seed = _botany.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates, args.User);
|
||||
var seed = _botany.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates, args.User, component.Health);
|
||||
_randomHelper.RandomOffset(seed, 0.25f);
|
||||
var displayName = Loc.GetString(component.Seed.DisplayName);
|
||||
_popup.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message",
|
||||
@@ -901,7 +926,7 @@ public sealed class PlantHolderSystem : EntitySystem
|
||||
}
|
||||
else if (component.Age < component.Seed.Maturation)
|
||||
{
|
||||
var growthStage = Math.Max(1, (int) (component.Age * component.Seed.GrowthStages / component.Seed.Maturation));
|
||||
var growthStage = GetCurrentGrowthStage((uid, component));
|
||||
|
||||
_appearance.SetData(uid, PlantHolderVisuals.PlantRsi, component.Seed.PlantRsi.ToString(), app);
|
||||
_appearance.SetData(uid, PlantHolderVisuals.PlantState, $"stage-{growthStage}", app);
|
||||
|
||||
Reference in New Issue
Block a user