evergreen893401 Posted September 14, 2024 Share Posted September 14, 2024 Hello, I'm a beginner mod creator. I would like some help with a mod I'm creating. I will admit it's an edit and reupload of a mod but it doesn't say in the original mod description that it's not permitted. So if I do finish the mod and get it working, I promise to credit the original mod creator. So what I'm trying to do is add code so that all farm plants like all seasons. I've already got a configuration option working for this feature but I can't get the code itself to work. I tried using AI programs to write me code for this feature but I couldn't get the code to do anything. If anyone can lend me code to have all crops like all seasons (including modded ones), I would appreciate it and I will credit you in the mod description for it. Link to comment https://forums.kleientertainment.com/forums/topic/159735-assistance-with-mod-creation/ Share on other sites More sharing options...
yanecc Posted September 16, 2024 Share Posted September 16, 2024 -- modmain local PLANT_DEFS = require("prefabs/farm_plant_defs").PLANT_DEFS for veggie, data in pairs(PLANT_DEFS) do veggie.good_seasons = {autumn = true, winter = true, spring = true, summer = true} end Link to comment https://forums.kleientertainment.com/forums/topic/159735-assistance-with-mod-creation/#findComment-1748560 Share on other sites More sharing options...
evergreen893401 Posted September 19, 2024 Author Share Posted September 19, 2024 Sorry for the late response but the code you gave me isn't all that functional. The server doesn't seem to load with the direct code and when I correct the code from the logs, (add end after the second to last line) the server refuses to start. According to the logs, the subject "veggie" seems to cause problems with the server starting up. Link to comment https://forums.kleientertainment.com/forums/topic/159735-assistance-with-mod-creation/#findComment-1749472 Share on other sites More sharing options...
yanecc Posted September 20, 2024 Share Posted September 20, 2024 (edited) Oh, sorry, there was indeed some error. The following code has been tested and works. local PLANT_DEFS = require("prefabs/farm_plant_defs").PLANT_DEFS for _, data in pairs(PLANT_DEFS) do data.good_seasons = { autumn = true, winter = true, spring = true, summer = true } end Edited September 20, 2024 by yanecc Link to comment https://forums.kleientertainment.com/forums/topic/159735-assistance-with-mod-creation/#findComment-1749568 Share on other sites More sharing options...
evergreen893401 Posted September 20, 2024 Author Share Posted September 20, 2024 It works! The season icons in the garden plant UI don't seem to show that they like all seasons, but crops grow like they would in their favored season! I need to run some more tests to make sure that the edited mod works 100% as intended before uploading it. But I promise when I do upload it, I will credit you. Thank you so much! Link to comment https://forums.kleientertainment.com/forums/topic/159735-assistance-with-mod-creation/#findComment-1749570 Share on other sites More sharing options...
evergreen893401 Posted September 20, 2024 Author Share Posted September 20, 2024 Looks like I've run into another problem. The code only seems to work with vanilla crops and not modded ones I tested this with the Heap of Foods mod and the off-season crops from it don't seem to be affected. Link to comment https://forums.kleientertainment.com/forums/topic/159735-assistance-with-mod-creation/#findComment-1749577 Share on other sites More sharing options...
yanecc Posted September 20, 2024 Share Posted September 20, 2024 (edited) If a mod adds its new crops to farm_plant_defs, I think you can use AddSimPostInit like this: local function SetAllSeasonsForPlants() local PLANT_DEFS = require("prefabs/farm_plant_defs").PLANT_DEFS for _, data in pairs(PLANT_DEFS) do data.good_seasons = { autumn = true, winter = true, spring = true, summer = true } end end AddSimPostInit(SetAllSeasonsForPlants) In other cases, you must specifically adapt for it. Edited September 20, 2024 by yanecc Link to comment https://forums.kleientertainment.com/forums/topic/159735-assistance-with-mod-creation/#findComment-1749579 Share on other sites More sharing options...
evergreen893401 Posted September 20, 2024 Author Share Posted September 20, 2024 That didn't seem to work, crops from the Heap of foods mod are still growing rather slow outside of their preferred seasons. Link to comment https://forums.kleientertainment.com/forums/topic/159735-assistance-with-mod-creation/#findComment-1749677 Share on other sites More sharing options...
evergreen893401 Posted September 20, 2024 Author Share Posted September 20, 2024 Whoops. My mistake. I didn't quite see the new like of code on the top there. I imputed it and everything works and intended now. I'm still gonna test things out some more before uploading it. Thank you! 1 Link to comment https://forums.kleientertainment.com/forums/topic/159735-assistance-with-mod-creation/#findComment-1749765 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now