* lord save me * UI/ChatBox: Use the new `defStyle` param for `RenderMarkup` The previous iteration didn't work because `AddMessage` can't inherit its color from the PushColor (since we're not doing actual tag stacks anymore). * rebase touchup
55 lines
1.7 KiB
C#
55 lines
1.7 KiB
C#
using Content.Shared.Examine;
|
|
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.Utility.Markup;
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
namespace Content.Server.Botany.Components
|
|
{
|
|
[RegisterComponent]
|
|
#pragma warning disable 618
|
|
public class SeedComponent : Component, IExamine
|
|
#pragma warning restore 618
|
|
{
|
|
public override string Name => "Seed";
|
|
|
|
[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.Builder 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");
|
|
}
|
|
}
|
|
}
|
|
}
|