Jump to content

Recommended Posts

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

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 1
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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...