Files
tbd-station-14/Content.Shared/EntityEffects/Effects/PlantMetabolism/PlantAdjustAttribute.cs
pathetic meowmeow bf41de18aa Move entity effects definitions to shared (#35614)
* Move entity effects to shared

* relocate spawning to server

* Generic version of EntityEffect for just raising event.

* genericise everything

* oops forgot to push you

* some condensation

* finish rebas

* unwhite the space

* oops forgot nuke

* bad rebase fix

* useless annotations begone

---------

Co-authored-by: EmoGarbage404 <retron404@gmail.com>
2025-05-23 12:32:22 -04:00

40 lines
1.4 KiB
C#

using Content.Shared.EntityEffects;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using System.Diagnostics.CodeAnalysis;
namespace Content.Shared.EntityEffects.Effects.PlantMetabolism;
[ImplicitDataDefinitionForInheritors]
public abstract partial class PlantAdjustAttribute<T> : EventEntityEffect<T> where T : PlantAdjustAttribute<T>
{
[DataField]
public float Amount { get; protected set; } = 1;
/// <summary>
/// Localisation key for the name of the adjusted attribute. Used for guidebook descriptions.
/// </summary>
[DataField]
public abstract string GuidebookAttributeName { get; set; }
/// <summary>
/// Whether the attribute in question is a good thing. Used for guidebook descriptions to determine the color of the number.
/// </summary>
[DataField]
public virtual bool GuidebookIsAttributePositive { get; protected set; } = true;
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
{
string color;
if (GuidebookIsAttributePositive ^ Amount < 0.0)
{
color = "green";
}
else
{
color = "red";
}
return Loc.GetString("reagent-effect-guidebook-plant-attribute", ("attribute", Loc.GetString(GuidebookAttributeName)), ("amount", Amount.ToString("0.00")), ("colorName", color), ("chance", Probability));
}
}