Jump to content

How to change mod dynamically for Base and RoG worlds


Recommended Posts

Probably a nood question but, I am working on updating my mod MorePlantables which overwrites many prefabs, for example veggies.lua, but because that file is different for Base and RoG it will generally cause problems for the other.  Is there a way to have two different veggies.lua files for Base and RoG, without just making two versions of the mod that would need to be switched between?  Is there any information on things I should know for modding with Base and RoG in mind?  It has been a while since I last modded and I am a bit rusty and I may have missed something important since I've been gone.  Thanks for the help.

Link to comment
Share on other sites

Hmm. Try this: In modmain, set up two different lists of mod prefabs with a if-else switch. E.g.

 

if GLOBAL.IsDLCEnabled(GLOBAL.REIGN_OF_GIANTS) then

Prefabs = {

"veggie_dlc",

}

else

Prefabs = {

"veggie_vanilla",

}

end

 

Then set up two separate prefabs files, one with vanilla veggies ("veggies_vanilla.lua") and one with vanilla veggies + RoG veggies ("veggies_dlc.lua"). The game should read and register the veggie prefabs from within whichever file is specified.

 

I haven't tested this, so let us know how it goes. Someone might have a more elegant solution :p

Link to comment
Share on other sites

If you're overwriting the file, you'll have to put IsDLCEnabled(REIGN_OF_GIANTS) checks within the file itself.

For example:

-- from the vanilla fileVEGGIES = {		cave_banana = MakeVegStats(0,	TUNING.CALORIES_SMALL,	TUNING.HEALING_TINY,	TUNING.PERISH_MED, 0,											TUNING.CALORIES_SMALL,	TUNING.HEALING_SMALL,	TUNING.PERISH_FAST, 0),	carrot = MakeVegStats(COMMON,	TUNING.CALORIES_SMALL,	TUNING.HEALING_TINY,	TUNING.PERISH_MED, 0,											TUNING.CALORIES_SMALL,	TUNING.HEALING_SMALL,	TUNING.PERISH_FAST, 0),	corn = MakeVegStats(COMMON, TUNING.CALORIES_MED,	TUNING.HEALING_SMALL,	TUNING.PERISH_MED, 0,										TUNING.CALORIES_SMALL,	TUNING.HEALING_SMALL,	TUNING.PERISH_SLOW, 0),		pumpkin = MakeVegStats(UNCOMMON,	TUNING.CALORIES_LARGE,	TUNING.HEALING_SMALL,	TUNING.PERISH_MED, 0,												TUNING.CALORIES_LARGE,	TUNING.HEALING_MEDSMALL,	TUNING.PERISH_FAST, 0),		eggplant = MakeVegStats(UNCOMMON,	TUNING.CALORIES_MED,	TUNING.HEALING_MEDSMALL,	TUNING.PERISH_MED, 0,												TUNING.CALORIES_MED,	TUNING.HEALING_MED,		TUNING.PERISH_FAST, 0),		durian = MakeVegStats(RARE, TUNING.CALORIES_MED,	-TUNING.HEALING_SMALL,	TUNING.PERISH_MED, -TUNING.SANITY_TINY,								TUNING.CALORIES_MED,	0,						TUNING.PERISH_FAST, -TUNING.SANITY_TINY),		pomegranate = MakeVegStats(RARE,	TUNING.CALORIES_TINY,	TUNING.HEALING_SMALL,		TUNING.PERISH_FAST, 0,												TUNING.CALORIES_SMALL,	TUNING.HEALING_MED,	TUNING.PERISH_SUPERFAST, 0),		dragonfruit = MakeVegStats(RARE,	TUNING.CALORIES_TINY,	TUNING.HEALING_SMALL,		TUNING.PERISH_FAST, 0,												TUNING.CALORIES_SMALL,	TUNING.HEALING_MED,	TUNING.PERISH_SUPERFAST, 0),	berries = MakeVegStats(0,	TUNING.CALORIES_TINY,	0,	TUNING.PERISH_FAST, 0,								TUNING.CALORIES_SMALL,	TUNING.HEALING_TINY,	TUNING.PERISH_SUPERFAST, 0),}-- add in DLC specific veggiesif IsDLCEnabled(REIGN_OF_GIANTS) then    VEGGIES.cactus_meat = MakeVegStats(0, TUNING.CALORIES_SMALL, -TUNING.HEALING_SMALL, TUNING.PERISH_MED, -TUNING.SANITY_TINY,										  TUNING.CALORIES_SMALL, TUNING.HEALING_TINY, TUNING.PERISH_MED, TUNING.SANITY_MED)    VEGGIES.watermelon = MakeVegStats(UNCOMMON, TUNING.CALORIES_SMALL, TUNING.HEALING_SMALL, TUNING.PERISH_FAST, TUNING.SANITY_TINY,												TUNING.CALORIES_SMALL, TUNING.HEALING_TINY, TUNING.PERISH_SUPERFAST, TUNING.SANITY_TINY*1.5)end
Of course, avoiding having to overwrite game files is always the ideal.
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...