Project Zomboid

Project Zomboid

219 ratings
Farming Never Rot
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
138.967 KB
18 Jun, 2018 @ 7:20am
22 Dec, 2021 @ 4:44pm
4 Change Notes ( view )

Subscribe to download
Farming Never Rot

Description
Farming Never Rot

About:
After plants fully mature they will not rot. Resets the max growth cycle if the plant is fully mature when checked. Feeling stuck at a your safe house waiting for pixels to grow, no more! Got a lazy friend in multiplayer that won't check crops, you can still be friends with this mod!

This is a quality of life written with the intent for multiplayer. If you are offline and the time is running your crops will not rot. This mod simply circumvents the plants going rotten on the growth cycle after plants reach maturity.

Disease will continue to affect the plants. Plants can still die or recede due to infestation or lack of water.

Nitty Gritty
A simple if statement that limits the growth state to 6, which should be the seed bearing stage.

Previously we just added an if statement into an existing function
Replaces the SFarmingSystem:growPlant basicFarming.growPlant from
/media/lua/server/Farming/SFarmingSystem.lua /media/lua/server/Farming/basicFarming.lua
to add one if statement
if (luaObject.nbOfGrow >6) then
luaObject.nbOfGrow = 6
end

Thanks to star in the comments section to show us a cool way to Monkey patch the function. While it's a hacky way of doing things it fits for this type of mod, which is such a minor change to force a loop, and should allow better compatibility with other mods, if any that modify the core function.

Every plant cycle nbOfGrow is increased by 1, every cycle it will call one of the following methods from the following methods
/media/lua/server/Farming/farming_vegetableconf.lua

farming_vegetableconf.growCarrots
farming_vegetableconf.growBroccoli
farming_vegetableconf.growStrewberries
farming_vegetableconf.growRedRadish
farming_vegetableconf.growTomato
farming_vegetableconf.growPotato
farming_vegetableconf.growCabbage

All of these methods run a unique routine if the nbOfGrow is 6 or less. Otherwise it triggers the planting.state to rotten. So if nbOfGrow is 7 or greater it will turn rotten.

Repackaging Distribution, Adding it to your server mods
Want to merge this into another mod, package it for your server, blah blah blah. Go for it! link backs, credit or a mention is totally appreciated but in absolutely no way necessary. Treat it like GPL software make the world a better place one line of code at a time! Feedback and/or a "hey it's awesome" comment are nifty too.

Compatibility and Testing
Tested with versions from 40.30 to 41.65, multiplayer tests seems to be working ok with Build 41. It's doubtful this will fail until there is a major farming update.

Thanks to the folks at Good Old Dayz[www.thegoodolddayz.com] for setting this up on their server; reports are that it works dandy in a 24/7 multiplayer (build 40), thanks for the invaluable testing!


Workshop ID: 1415491388
Mod ID: FarmingNeverRot
Popular Discussions View All (1)
0
7 Dec, 2018 @ 7:34am
Exception errors on client side. 40.36
Starman
38 Comments
Luth 6 Jul, 2023 @ 12:37pm 
The mod description says it limits the growth state to 6 but according to the wiki, the seed-bearing stage is 7.
king_kong 20 Jan, 2023 @ 8:50am 
This mod isn't working right anymore, I just ran it in my game with accelerated growth time and I could never get seeds out of it. I found these mods work correctly Farming Without the Rotting and Crops Never Rot .

I like Farming Without the Rotting more because the other mod has a sandbox option that no one understands
Arcturus 16 Jan, 2023 @ 11:08pm 
Does this mod still work?
Doctor Sex 12 Nov, 2022 @ 11:20am 
i think its deleting seeding phase to plants too
Torkkar 15 Aug, 2022 @ 7:23pm 
ok so after reading the description I gotta ask is this compatible with mod: Mo' Crops
Thee'e Vang 22 Jul, 2022 @ 12:59am 
41.71?
puerto 8 Mar, 2022 @ 11:22am 
any news?
Humsas 23 Jan, 2022 @ 7:46am 
Does not seem to work on hosted server.
Rainoa 16 Jan, 2022 @ 10:01am 
is it just me or is carrots seed bearing and ready to harvest models flipped?
https://steamproxy.net/sharedfiles/filedetails/?id=2721813524
https://steamproxy.net/sharedfiles/filedetails/?id=2721813368
i wonder if this is base game issue or a mod im using somehow did this?
any idea's if it somehow could be this 1?
Colonel Wolfe 16 Jan, 2022 @ 9:49am 
This mod does not work, confirmed