ECS botany except for plantholder (#6466)

This commit is contained in:
mirrorcult
2022-02-06 13:14:41 -07:00
committed by GitHub
parent f049305f0f
commit 19bbbefdf5
14 changed files with 566 additions and 566 deletions

View File

@@ -1,51 +1,15 @@
using Content.Shared.Examine;
using Content.Server.Botany.Systems;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Botany.Components
{
[RegisterComponent]
#pragma warning disable 618
public class SeedComponent : Component, IExamine
#pragma warning restore 618
[RegisterComponent, Friend(typeof(BotanySystem))]
public sealed class SeedComponent : Component
{
[DataField("seed")]
private string? _seedName;
[ViewVariables]
public Seed? Seed
{
get => _seedName != null ? IoCManager.Resolve<IPrototypeManager>().Index<Seed>(_seedName) : null;
set => _seedName = value?.ID;
}
public void Examine(FormattedMessage message, bool inDetailsRange)
{
if (!inDetailsRange)
return;
if (Seed == null)
{
message.AddMarkup(Loc.GetString("seed-component-no-seeds-message") + "\n");
return;
}
message.AddMarkup(Loc.GetString($"seed-component-description", ("seedName", Seed.DisplayName)) + "\n");
if (!Seed.RoundStart)
{
message.AddMarkup(Loc.GetString($"seed-component-has-variety-tag", ("seedUid", Seed.Uid)) + "\n");
}
else
{
message.AddMarkup(Loc.GetString($"seed-component-plant-yield-text", ("seedYield", Seed.Yield)) + "\n");
message.AddMarkup(Loc.GetString($"seed-component-plant-potency-text", ("seedPotency", Seed.Potency)) + "\n");
}
}
[DataField("seed", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<SeedPrototype>))]
public string SeedName = default!;
}
}