Modding concerns and current scope

Components can be monkey patched. The following code is untested, but should give you a rough idea.

This has some caveats, however. In particular, if two mods do it, only one will succeed. The magic is in building a function that can be extended by many mods at the same time. In this case, because of random magic, it’s not that easy.

Edit: As to how I would do it in this case…

Append to the initialize function a table that is either already set (by another mod) or gets set by us. After the table certainly exists, we inject our critter into it.

The spawning function then simply selects one critter of that list - which can now be done by multiple mods (using this approach). Feel free to use it, but put a link to this post next to it please.

3 Likes