Page 1 of 1
[SOLVED] Logic branching according to Spaceage or Quality mods
Posted: Tue Dec 10, 2024 7:41 pm
by Fishbus
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
Re: Logic branching according to Spaceage or Quality mods
Posted: Tue Dec 10, 2024 9:47 pm
by s6x
It's a table, called mods.
Code: Select all
if (mods["space-age"]) then
-- space age + quality stuff
elseif (mods["quality"]) then
-- quality without space age
else
-- neither one
end
Quality is required for Space Age so if you detect space-age you can assume that quality is also there.
Re: Logic branching according to Spaceage or Quality mods
Posted: Wed Dec 11, 2024 5:30 am
by Fishbus
s6x wrote: ↑Tue Dec 10, 2024 9:47 pm
It's a table, called mods.
Code: Select all
if (mods["space-age"]) then
-- space age + quality stuff
elseif (mods["quality"]) then
-- quality without space age
else
-- neither one
end
Quality is required for Space Age so if you detect space-age you can assume that quality is also there.
That's exactly the ticket, thank you.
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" ],
That makes it all work.
Cheers!