I'm using a mod which adds research ingredients, but labs only light up purple. Why don't the colours match?
Unfortunately there's no way for a mod to detect the colours of science ingredients (or any graphics) from other mods. DiscoScience supports the vanilla science packs out-of-the-box, but other mods need to register their colours with DiscoScience.
If you encounter unsupported (purple) ingredients, please check your game log for a line like this one:
8.689 Script @__DiscoScience__/core/researchColor.lua:61: Disco Science encountered the following ingredients with no registered color:
more-science-pack-1
more-science-pack-2
more-science-pack-3
more-science-pack-4
Point the mod authors to this FAQ page.
My mod adds or changes research ingredient colours. How do I make it work with Disco Science?
You need to do two things:
-
Add an optional dependency on DiscoScience to your mod. This will ensure that your mod doesn't attempt to add anything before DiscoScience has initialised.
-
Register your colours in
on_init
andon_configuration_changed
. Note that if your colours depend on settings or the presence of other mods, you'll have to include the decision logic in the callback too.local updateDiscoScience = function() if remote.interfaces["DiscoScience"] and remote.interfaces["DiscoScience"]["setIngredientColor"] then remote.call("DiscoScience", "setIngredientColor", "automation-science-pack", {r = 1.0, g = 0.1, b = 0.1}) end end script.on_configuration_changed( function () updateDiscoScience() end ) script.on_init( function () updateDiscoScience() end )
That's it! Thanks for making your mod compatible with DiscoScience! Please let me know on the Discussion board if you encounter any problems.
My mod adds labs that use the vanilla lab graphics. How do I make them work with Disco Science?
You need to do three things:
-
Add an optional dependency on DiscoScience to your mod. This will ensure that your mod doesn't attempt to add anything before DiscoScience has initialised.
-
Prepare your lab graphics in the data stage. This removes the built-in animation and light.
if DiscoScience and DiscoScience.prepareLab then DiscoScience.prepareLab(data.raw["lab"]["sct-lab-t2"]) end
-
Register your labs in
on_init
andon_configuration_changed
, passing their scale (usually 1).local updateDiscoScience = function() if remote.interfaces["DiscoScience"] and remote.interfaces["DiscoScience"]["setLabScale"] then remote.call("DiscoScience", "setLabScale", "sct-lab-t2", 1) end end script.on_configuration_changed( function () updateDiscoScience() end ) script.on_init( function () updateDiscoScience() end )
That's it! Thanks for making your mod compatible with DiscoScience! Please let me know on the Discussion board if you encounter any problems.