Add plant metabolism effects to chemical guidebook (#28038)
* draft one of plant metabolism guidebook * loc fix? * add attributes loc * fix loc syntax * improved appearance * last commit was undercooked, my bad * last commit was still undercooked, my worse * last commit was even still undercooked, my worst * Addressed comments? * Fix newlines * Hopefully this works * Cleanup, I think * 2xs
This commit is contained in:
@@ -15,6 +15,18 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[DataField]
|
||||
public float Prob { get; protected set; } = 1; // = (80);
|
||||
|
||||
/// <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;
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the plant holder can metabolize the reagent or not. Checks if it has an alive plant by default.
|
||||
/// </summary>
|
||||
@@ -40,6 +52,18 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
return !(Prob <= 0f) && IoCManager.Resolve<IRobustRandom>().Prob(Prob);
|
||||
}
|
||||
|
||||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-missing", ("chance", Probability));
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
{
|
||||
public sealed partial class PlantAdjustHealth : PlantAdjustAttribute
|
||||
{
|
||||
public override string GuidebookAttributeName { get; set; } = "plant-attribute-health";
|
||||
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
|
||||
@@ -4,6 +4,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
{
|
||||
public sealed partial class PlantAdjustMutationLevel : PlantAdjustAttribute
|
||||
{
|
||||
public override string GuidebookAttributeName { get; set; } = "plant-attribute-mutation-level";
|
||||
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public sealed partial class PlantAdjustMutationMod : PlantAdjustAttribute
|
||||
{
|
||||
public override string GuidebookAttributeName { get; set; } = "plant-attribute-mutation-mod";
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public sealed partial class PlantAdjustNutrition : PlantAdjustAttribute
|
||||
{
|
||||
public override string GuidebookAttributeName { get; set; } = "plant-attribute-nutrition";
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager, mustHaveAlivePlant: false))
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public sealed partial class PlantAdjustPests : PlantAdjustAttribute
|
||||
{
|
||||
public override string GuidebookAttributeName { get; set; } = "plant-attribute-pests";
|
||||
public override bool GuidebookIsAttributePositive { get; protected set; } = false;
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public sealed partial class PlantAdjustToxins : PlantAdjustAttribute
|
||||
{
|
||||
public override string GuidebookAttributeName { get; set; } = "plant-attribute-toxins";
|
||||
public override bool GuidebookIsAttributePositive { get; protected set; } = false;
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public sealed partial class PlantAdjustWater : PlantAdjustAttribute
|
||||
{
|
||||
public override string GuidebookAttributeName { get; set; } = "plant-attribute-water";
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager, mustHaveAlivePlant: false))
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public sealed partial class PlantAdjustWeeds : PlantAdjustAttribute
|
||||
{
|
||||
public override string GuidebookAttributeName { get; set; } = "plant-attribute-weeds";
|
||||
public override bool GuidebookIsAttributePositive { get; protected set; } = false;
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
[UsedImplicitly]
|
||||
public sealed partial class PlantAffectGrowth : PlantAdjustAttribute
|
||||
{
|
||||
public override string GuidebookAttributeName { get; set; } = "plant-attribute-growth";
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager))
|
||||
|
||||
@@ -28,6 +28,6 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
plantHolderComp.ForceUpdate = true;
|
||||
}
|
||||
|
||||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-missing", ("chance", Probability));
|
||||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-plant-cryoxadone", ("chance", Probability));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,6 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
}
|
||||
}
|
||||
|
||||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-missing", ("chance", Probability));
|
||||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-plant-diethylamine", ("chance", Probability));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
plantHolderComp.Seed.Viable = true;
|
||||
}
|
||||
|
||||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-missing", ("chance", Probability));
|
||||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-plant-phalanximine", ("chance", Probability));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,6 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|
||||
}
|
||||
}
|
||||
|
||||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-missing", ("chance", Probability));
|
||||
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-plant-robust-harvest", ("seedlesstreshold", PotencySeedlessThreshold), ("limit", PotencyLimit), ("increase", PotencyIncrease), ("chance", Probability));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user