Willow branches now properly regrow every 5 minutes

This commit is contained in:
Syndromeramo 2025-07-15 12:41:03 +00:00 committed by Ryan
parent bef103e259
commit 3634616475
2 changed files with 7 additions and 1 deletions

View file

@ -426,6 +426,10 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl
// restocking their fruit should take 40 minutes per fruit
minutes = 40
}
else if(plantable == Plantable.WILLOW_SAPLING && isGrown()) {
// Willow Branches grow back in only 5 minutes
minutes = 5
}
return minutes
}

View file

@ -57,7 +57,7 @@ class CropGrowth : PersistTimer (500, "farming:crops", isSoft = true) {
private fun runOfflineCatchupLogic() {
for ((_, patch) in patchMap) {
val type = patch.patch.type
val shouldPlayCatchup = !patch.isGrown() || (type == PatchType.BUSH_PATCH && patch.getFruitOrBerryCount() < 4) || (type == PatchType.FRUIT_TREE_PATCH && patch.getFruitOrBerryCount() < 6)
val shouldPlayCatchup = !patch.isGrown() || (type == PatchType.BUSH_PATCH && patch.getFruitOrBerryCount() < 4) || (type == PatchType.FRUIT_TREE_PATCH && patch.getFruitOrBerryCount() < 6) || (patch.plantable == Plantable.WILLOW_SAPLING && patch.harvestAmt < 6)
if (shouldPlayCatchup && !patch.isDead && !patch.isChoppedFruitTree()) {
var stagesToSimulate = if (!patch.isGrown()) {
if (patch.isWeedy() || patch.isEmptyAndWeeded()) patch.currentGrowthStage % 4
@ -69,6 +69,8 @@ class CropGrowth : PersistTimer (500, "farming:crops", isSoft = true) {
stagesToSimulate += Math.min(4, 4 - patch.getFruitOrBerryCount())
if (type == PatchType.FRUIT_TREE_PATCH)
stagesToSimulate += Math.min(6, 6 - patch.getFruitOrBerryCount())
if (patch.plantable == Plantable.WILLOW_SAPLING)
stagesToSimulate += Math.min(6, 6 - patch.harvestAmt)
}
val nowTime = System.currentTimeMillis()