Jump to content

Mod question: How to make a mod actually compatible with the dlc


Recommended Posts

I know that we can set the compatibility in modinfo.lua but I am just curious how to actually make a mod compatible with the dlc regarding the logic.

For example, I would like to change the tuning value TUNING.WOODLEGSBOAT_SPEED. This tuning value does not exist in the don't starve vanilla tuning file which is located at data/scripts/tuning.lua. Instead, it exists in the tuning file of the shipwrecked dlc which is located at  data/DLC00002/scripts/tuning.lua.

In my modinfo.lua, I set shipwrecked compatibility to true and in my modmain.lua. should I just have the line 

TUNING.WOODLEGSBOAT_SPEED = some number

or 

if (shipwrecked_compatible = true, some condition to check for shipwrecked world idk) then
  TUNING.WOODLEGSBOAT_SPEED = some number
end

Thanks

Link to comment
Share on other sites

In this case, you can just leave the variable for all versions.

I grabbed this from the game code. I believe it is the best way to check for each kind of DLC. I think there's some difference between how to check for RoG compared to SW and Hamlet, and I don't know why.

if SaveGameIndex:IsModePorkland() then
	-- Do Hamlet code
elseif SaveGameIndex:IsModeShipwrecked() then
	-- Do SW code
elseif IsDLCInstalled(REIGN_OF_GIANTS) then
	-- Do RoG code
else
	-- Do original DS code
end

You can translate those if-statements to bool-variables if you prefer.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...