Jump to content

What happens when two mods overwrite the same prefab?


Recommended Posts

What happens when two mods do different things for overwriting the same lua file or anything else really? Does the game give you an error that they're incompatible or does one simply override the other? So like if I have a bird.lua that does one thing in my mod but I'm running another mod that does something else in their bird.lua what happens? Or if I have an AddPrefabPostInit that changes a function but another mod has a change for that same function.

Edited by headofmarimo
Link to comment
Share on other sites

1 hour ago, CarlZalph said:

One overrides the other depending on the mod load order.

You shouldn't be flat out replacing prefabs, use prefab post inits and modify what you need to modify with function hooks.

Okay, thanks! Does the same apply to brains too? I'm having trouble overriding some functions in a brain using  AddBrainPostInit so I just edited the existing brain file as a new copy with the same name and put it in my mod's brains folder and it worked.
Also why is it bad to replace these files? I normally use post inits but for something like this I couldn't figure out how so I just replaced the file. What are the consequences?

Edited by headofmarimo
Link to comment
Share on other sites

19 hours ago, headofmarimo said:

Okay, thanks! Does the same apply to brains too? I'm having trouble overriding some functions in a brain using  AddBrainPostInit so I just edited the existing brain file as a new copy with the same name and put it in my mod's brains folder and it worked.
Also why is it bad to replace these files? I normally use post inits but for something like this I couldn't figure out how so I just replaced the file. What are the consequences?

It's bad form because then you have to worry about mod priorities when they're normally just plug and play "it just works" things.

To edit brains in this way you'll need to do some iteration and checks on the parts you want to modify/remove/add.

It's a bit of a hassle to do, but it help futureproofs your mod from Klei updates and other mods also wanting to touch the same thing.

This is why when I see mods use base game assets heavily they'll create their own prefab with a custom name despite copy-pasting the majority of Klei's code for it with some edits.  It preserves the prefab as it was without touching a base Klei prefab in a damaging way.

  • Sanity 1
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...