Use existing probability field (#28422)

Remove the PlantAdjustAttribute "Prob" field and use the existing probability field from ReagentEffects instead.
This commit is contained in:
Flesh
2024-05-31 19:56:41 +02:00
committed by GitHub
parent faa3554d14
commit e145a666c9
3 changed files with 7 additions and 14 deletions

View File

@@ -12,9 +12,6 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
[DataField]
public float Amount { get; protected set; } = 1;
[DataField]
public float Prob { get; protected set; } = 1; // = (80);
/// <summary>
/// Localisation key for the name of the adjusted attribute. Used for guidebook descriptions.
/// </summary>
@@ -45,11 +42,7 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism
|| mustHaveAlivePlant && (plantHolderComponent.Seed == null || plantHolderComponent.Dead))
return false;
if (Prob >= 1f)
return true;
// Dependencies are never injected for reagents if you intend to do that for this.
return !(Prob <= 0f) && IoCManager.Resolve<IRobustRandom>().Prob(Prob);
return true;
}
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)

View File

@@ -31,7 +31,7 @@
- !type:PlantAdjustHealth
amount: -0.5
- !type:PlantAdjustMutationMod
prob: 0.3
probability: 0.3
amount: 0.4
metabolisms:
Medicine:
@@ -115,10 +115,10 @@
- !type:PlantAdjustNutrition
amount: 0.05
- !type:PlantAdjustWeeds
prob: 0.025
probability: 0.025
amount: 1
- !type:PlantAdjustPests
prob: 0.025
probability: 0.025
amount: 1
- !type:RobustHarvest {}
metabolisms:
@@ -273,12 +273,12 @@
- !type:PlantAdjustNutrition
amount: 0.1
- !type:PlantAdjustPests
prob: 0.1
probability: 0.1
amount: -1
- !type:PlantAdjustHealth
amount: 0.1
- !type:PlantAffectGrowth
prob: 0.2
probability: 0.2
amount: 1
- !type:PlantDiethylamine {}
metabolisms:

View File

@@ -334,7 +334,7 @@
- !type:PlantAdjustHealth
amount: -1.5
- !type:PlantAdjustMutationMod
prob: 0.2
probability: 0.2
amount: 0.1
metabolisms:
Poison: