diff --git a/FarmlandDropsSoil.csproj b/FarmlandDropsSoil.csproj
index 5c906b3..abd3685 100644
--- a/FarmlandDropsSoil.csproj
+++ b/FarmlandDropsSoil.csproj
@@ -4,9 +4,9 @@
Farmland Drops Soil
Vintage Story mod that makes farmland have a chance to drop soil depending on nutrient levels
copygirl
- 1.2.0
+ 1.4.0
- net452
+ net461
latest
diff --git a/resources/modinfo.json b/resources/modinfo.json
index ccc54d7..3a8bdef 100644
--- a/resources/modinfo.json
+++ b/resources/modinfo.json
@@ -1,13 +1,13 @@
{
"type": "code",
"name": "Farmland Drops Soil",
- "version": "1.3.0",
+ "version": "1.4.0",
"description": "Farmland has a change to drop soil depending on nutrient levels",
"website": "https://www.vintagestory.at/forums/topic/1209-farmland-drops-soil-v120/",
"authors": [ "copygirl" ],
"dependencies": {
- "game": "*"
+ "game": "1.15.0-pre.3"
}
}
diff --git a/src/FarmlandDropsSoilBehavior.cs b/src/FarmlandDropsSoilBehavior.cs
index f095894..30aea49 100644
--- a/src/FarmlandDropsSoilBehavior.cs
+++ b/src/FarmlandDropsSoilBehavior.cs
@@ -21,9 +21,10 @@ public override ItemStack[] GetDrops(
// Prevent other behaviors from running after this one.
handling = EnumHandling.PreventSubsequent;
- // Get the lowest nutrient value (out of N, P and K) relative
- // to the farmland's default nutrient levels (its fertility).
- var nutrients = farmland.Nutrients.Min() / farmland.OriginalFertility;
+ // Divide each type of nutrient (N, P and K) by its original, "full"
+ // fertility to get a value from 0 to 1. Then pick the lowest one.
+ var nutrients = farmland.Nutrients.Zip(farmland.OriginalFertility,
+ (current, original) => current / original).Min();
// If this nutrient is below 95%, there is a chance the soil won't drop.
if ((nutrients < 0.95) && (world.Rand.NextDouble() > nutrients))