What is the recommended path to logic changing prototype data according to what Wube mods are activated?
What is the function that recognises these mods are active on start up?
For example
if (active mod == space age)
then do this logic
ifelse if (active mod == space age && quality)
do this thing
else
yadda yadda an so on
Cheers
[SOLVED] Logic branching according to Spaceage or Quality mods
[SOLVED] Logic branching according to Spaceage or Quality mods
Last edited by Fishbus on Wed Dec 11, 2024 5:32 am, edited 1 time in total.
Re: Logic branching according to Spaceage or Quality mods
It's a table, called mods.
Quality is required for Space Age so if you detect space-age you can assume that quality is also there.
Code: Select all
if (mods["space-age"]) then
-- space age + quality stuff
elseif (mods["quality"]) then
-- quality without space age
else
-- neither one
end
Re: Logic branching according to Spaceage or Quality mods
That's exactly the ticket, thank you.s6x wrote: ↑Tue Dec 10, 2024 9:47 pm It's a table, called mods.
Quality is required for Space Age so if you detect space-age you can assume that quality is also there.Code: Select all
if (mods["space-age"]) then -- space age + quality stuff elseif (mods["quality"]) then -- quality without space age else -- neither one end
It works but it has an error because it doesn't load the mod before my mod makes changes, so it will come up with an error saying a field I want to change/access is 'nil'.
For posterity; just make sure the info.json had the mod as a dependency so it is loaded before:
Code: Select all
"dependencies": ["base >= 2.0","(?) quality" ],
Cheers!