Jump to content

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.

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

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.

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
×
  • Create New...