Plant metabolism dependency fix (#6110)

This commit is contained in:
metalgearsloth
2022-01-11 07:43:36 +11:00
committed by GitHub
parent 76c6ee08e7
commit c19c4bbb29

View File

@@ -13,8 +13,6 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
[ImplicitDataDefinitionForInheritors]
public abstract class PlantAdjustAttribute : ReagentEffect
{
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[DataField("amount")] public float Amount { get; protected set; } = 1;
[DataField("prob")] public float Prob { get; protected set; } = 1; // = (80);
@@ -39,7 +37,8 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
if (Prob >= 1f)
return true;
return !(Prob <= 0f) && _robustRandom.Prob(Prob);
// Dependencies are never injected for reagents if you intend to do that for this.
return !(Prob <= 0f) && IoCManager.Resolve<IRobustRandom>().Prob(Prob);
}
}
}