EdithBagel Posted March 23, 2022 Share Posted March 23, 2022 I'm trying to create a mod for changing treeguard/leif chance depending on amount of trees chopped and the best way seems like to edit one of the functions in "evergreens.lua". Don't go hard on me, it's my first time making a mod for don't starve and only experience i got was from modding Isaac, which is very different from this Link to comment https://forums.kleientertainment.com/forums/topic/138514-is-it-possible-to-edit-already-existing-prefab-from-the-mod/ Share on other sites More sharing options...
Rickzzs Posted March 24, 2022 Share Posted March 24, 2022 Yes, it is. There are many APIs in modutils.lua, such as AddPrefabPostInit(prefab,fn). If you are not satisfied, just copy evergreens.lua to your-mod/scripts/evergreens.lua and the game will load files in priority sequence, if no other mod touches evergreens.lua, your mod file goes first. The most safe way is always to utilize these APIs, where you can inject code, hook existing functions and create decorators/wrappers. 1 Link to comment https://forums.kleientertainment.com/forums/topic/138514-is-it-possible-to-edit-already-existing-prefab-from-the-mod/#findComment-1551563 Share on other sites More sharing options...
EdithBagel Posted March 24, 2022 Author Share Posted March 24, 2022 58 minutes ago, Mr.Rickzzs said: Yes, it is. There are many APIs in modutils.lua, such as AddPrefabPostInit(prefab,fn). If you are not satisfied, just copy evergreens.lua to your-mod/scripts/evergreens.lua and the game will load files in priority sequence, if no other mod touches evergreens.lua, your mod file goes first. The most safe way is always to utilize these APIs, where you can inject code, hook existing functions and create decorators/wrappers. Thanks! Link to comment https://forums.kleientertainment.com/forums/topic/138514-is-it-possible-to-edit-already-existing-prefab-from-the-mod/#findComment-1551575 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