Starbound

Starbound

Not enough ratings
Madtulip status script fix
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
1.392 KB
24 Oct, 2020 @ 4:59pm
1 Change Note ( view )

Subscribe to download
Madtulip status script fix

Description
This prevents the mad-tulip mod from re-loading the primary status script, irreversably cancelling any hooks created before the mod's own files are loaded in.

This is solved by removing the require "/stats/player_primary.lua" in the /lua/madtulip_run_on_player.lua file.
6 Comments
Twisted_Code 29 Dec, 2020 @ 6:57am 
it's nice to see such proactively helpful mod developers in the community:winter2019happydog:.
Marshmallownya 25 Oct, 2020 @ 2:56pm 
Thank you alot for your help, C0bra5!!
C0bra5  [author] 24 Oct, 2020 @ 11:54pm 
@MegaMato, I made this mod because it caused death loops when using the pony modpack. I don't know how many mods are affected by the error, but this should fix them. Death loops and invincible characters are a symptom of broken status scripts, which is exactly what this mod fixes.

A common solution is for mod authors to ask the game to load madtulip's mod before their own. Sadly Madtulip's mod already asks the game to do this with the modpack. Applying this fix to the modpack would essentially cause the game to crash on launch as it would encounter an infinite loop.

The original mod hasn't been updated since 2017 so i doubt i'll ever be able to get the original devs to do anything about it.
C0bra5  [author] 24 Oct, 2020 @ 11:54pm 
Bk's explanation is a bit confusing in my opinion so here is something hopefully more understandable:
First a list of events:
1. The original vanilla script is loaded by the game as they always load first.
2. A mod's script is loaded and it creates hooks on some of the original functions.
3. Madtulip's script is loaded. The scripts asks the game to load the vanilla script.

In LUA we create hooks in 2 steps: First we create a backup of a function the game uses to run itself. Then we create a function with the same name that will execute our own code and that of the function we previously backed up.

As modders, it's customary to expect that some other mod may have had already created hooks. Overwriting assets and functions if frowned upon as it pretty much always leads to compatibility problems.

By re-loading the game's original file, madtulip effectively erases all the hooks created by the mods that have been loaded before itself.
bk3000 24 Oct, 2020 @ 8:59pm 
@MegaMato
The answer would be preventing a lot of compatibility problems, but that's hard to explain if you don't understand LUA.
"A" is the original
Copy "A" unto "C",
Replace "A" with "B"
"B" calls "C" (the old "A") within itself
That would be function "hooking". The original is retained, and then still used.
Now any number of mods could be doing this, forming a chain that always goes back to the original.
Mad Tulip is calling the original in a way that erases all the other links of the chain that may have been added (unless they load after it does).
MegaMato 24 Oct, 2020 @ 6:44pm 
How will I know if it is working? I don't quite get what this fixes.