Page 1 of 1

Allow fuel_glow_color for non-fuels

Posted: Mon Feb 03, 2020 2:05 pm
by danielbrauer
I made DiscoScience, which makes labs light up with the colour of the items they are consuming. The main source of requests for the mod are to support ingredients from other mods. At the moment, this involves putting new ingredient colours in a giant compatibility table.

I would like other mod authors to be able to provide colours for DiscoScience. I saw that Prototype/Item has a fuel_glow_color, which is actually conceptually identical to what I want. The only problem is that it is not valid if the item is not a fuel, which means you can't attach this data to arbitrary items.

Would allowing fuel_glow_color without an item being a fuel be too much of a hack? Is there any more appropriate and generic way of decorating existing data types?

Re: Allow fuel_glow_color for non-fuels

Posted: Mon Feb 03, 2020 2:12 pm
by Deadlock989
https://wiki.factorio.com/Prototype/Rec ... chine_tint , which is better than fuel_glow_color because it can specify four separate tints, but it doesn't work for labs or miners because those don't have recipes, working with items directly instead. I would rather that was extended to labs instead (I can't think of any use for it in miners unless you wanted to animate internal moving belts of ore or something, which I don't) but it would mean being able to specify crafting_machine_tint on items (or "tools" as science packs are internally) as well as recipes and that would create difficulties.

Re: Allow fuel_glow_color for non-fuels

Posted: Mon Feb 03, 2020 2:34 pm
by danielbrauer
That looks nice but the way Disco Science works is it composes a list of colours matching each ingredient. This can go to all seven science pack colours just in vanilla. Plus I think it would generally be a much bigger ask to have people annotate every recipe.

Re: Allow fuel_glow_color for non-fuels

Posted: Mon Feb 03, 2020 2:39 pm
by Deadlock989
Then just provide a hook to other modders. Any prototype, including items, can be given any arbitrary property - it's just that anything the base game doesn't use is discarded at the end of the data stage, so you can't access anything like that in the control stage. IR uses this for example, tagging certain item, recipe and technology prototypes so that other mods can recognise them as either originating them from IR or changing the way IR handles them. You could look in data-final-fixes for any science pack that has a property "Disco_Science_Colour" and take action based on that. The only caveat is that the other mods have to have set it up before you look for it.

If it's control stage you want, you could provide a remote interface for other mods to tell DS about their itamz.

Re: Allow fuel_glow_color for non-fuels

Posted: Wed Feb 05, 2020 11:07 am
by danielbrauer
Thanks yes a remote interface sounds like the way to do it.