Page 1 of 1

[Twinsen] [0.17.75] Tooltips for items which place entities with a void energy source

Posted: Mon Nov 04, 2019 5:56 pm
by Deadlock989
Liking the new tooltips a lot.

One minor oddity: items which place an entity which is powered by a void energy source have a broken-looking "Consumes" line (see pic). I don't have an immediate suggestion about what it should say, but they don't consume anything really.

Related question: where is the icon for the new "Consumes" line defined? For burners, it's a flame, for electricity, a lightning bolt. For every other fuel category, it's the pictured "going through a door" icon. Can we define those ourselves?

Re: [0.17.75] Tooltips for items which places entities with a void energy source

Posted: Mon Nov 04, 2019 6:01 pm
by Bilka
Deadlock989 wrote: Mon Nov 04, 2019 5:56 pm Related question: where is the icon for the new "Consumes" line defined? For burners, it's a flame, for electricity, a lightning bolt. For every other fuel category, it's the pictured "going through a door" icon. Can we define those ourselves?
It uses a sprite of the name tooltip-category-<category-name>, so for example tooltip-category-electricity. You can find the sprites defined in prototypes\utility-sprites.lua in both the core and the base mod. As far as I can see, for your custom fuel categories, the fuel category name is used in the sprite name, so if the fuel category name is "carrot", the sprite should be named "tooltip-category-carrot".

Re: [0.17.75] Tooltips for items which places entities with a void energy source

Posted: Mon Nov 04, 2019 6:08 pm
by Deadlock989
Bilka wrote: Mon Nov 04, 2019 6:01 pm
Deadlock989 wrote: Mon Nov 04, 2019 5:56 pm Related question: where is the icon for the new "Consumes" line defined? For burners, it's a flame, for electricity, a lightning bolt. For every other fuel category, it's the pictured "going through a door" icon. Can we define those ourselves?
It uses a sprite of the name tooltip-category-<category-name>, so for example tooltip-category-electricity. You can find the sprites defined in prototypes\utility-sprites.lua in both the core and the base mod. As far as I can see, for your custom fuel categories, the fuel category name is used in the sprite name, so if the fuel category name is "carrot", the sprite should be named "tooltip-category-carrot".
Those sprites are mipmapped at 2 levels, right?

Re: [0.17.75] Tooltips for items which places entities with a void energy source

Posted: Mon Nov 04, 2019 6:17 pm
by Twinsen
Deadlock989 wrote: Mon Nov 04, 2019 6:08 pm Those sprites are mipmapped at 2 levels, right?
They are, but you don't have to define mipmaps, just don't set it in the lua definition of the sprite.

Re: [Twinsen] [0.17.75] Tooltips for items which places entities with a void energy source

Posted: Mon Nov 04, 2019 6:19 pm
by Twinsen
Does it make sense that the entire category and it's consumption are not shown for void energy sources?

Re: [Twinsen] [0.17.75] Tooltips for items which places entities with a void energy source

Posted: Mon Nov 04, 2019 6:25 pm
by Deadlock989
Twinsen wrote: Mon Nov 04, 2019 6:19 pm Does it make sense that the entire category and it's consumption are not shown for void energy sources?
For the category, I think it's always going to be a tough one because different modders use void energy to fake different things. So not showing anything might be the best solution, they/we can always show contextual info in the tooltip now that there's more predictable tooltip behaviours.

For the copper lamp above, I did rig it so that the equivalent of 9.6 kW is sort-of consumed, because it fakes a burner lamp. But I would rather it showed nothing than showed something wacky, it doesn't really matter in this use case. Other modders might feel differently *shrug*

Re: [0.17.75] Tooltips for items which places entities with a void energy source

Posted: Mon Nov 04, 2019 6:26 pm
by posila
Deadlock989 wrote: Mon Nov 04, 2019 6:08 pmThose sprites are mipmapped at 2 levels, right?
Icons and sprites that are defined with flag "icon" or "gui-icon", are all sorted into single atlas texture which has 4 mipmap levels. The game loads sprites into atlases, auto-generates mipmaps and then overwrites regions that have custom mipmap definitions. So regardless of how many mipmap levels you define, there will be always 4 and some may be autogenerated.

Because GUI scales from 75% to 200% it was deemed only 2 mipmap levels will be ever used (200%, and 100%), so we define just the 2.

For completeness ... difference between "icon" and "gui-icon" flags is that "icon" uses trilinear filtering; "gui-icon" bilinear filtering with using ceil to determine from which miplevel it should filter bilinearly (so GUI scale 125% uses 200% version of the icon).

Re: [Twinsen] [0.17.75] Tooltips for items which places entities with a void energy source

Posted: Mon Nov 04, 2019 6:29 pm
by Deadlock989
Bingo.

Re: [Twinsen] [0.17.75] Tooltips for items which places entities with a void energy source

Posted: Mon Nov 04, 2019 6:43 pm
by Klonan
Twinsen wrote: Mon Nov 04, 2019 6:19 pm Does it make sense that the entire category and it's consumption are not shown for void energy sources?
Not to me, void energy source is a 'It just works'

Re: [Twinsen] [0.17.75] Tooltips for items which place entities with a void energy source

Posted: Tue Nov 05, 2019 12:43 pm
by Twinsen
Fixed by not showing this information for void energy sources.

Changed in Version: 0.17.76.