Page 1 of 1

Where do storage tanks get their alt-info icon position from?

Posted: Sun Jun 13, 2021 11:59 am
by Deadlock989
Here we see a string of pipe entities with two kinds of 1x1 storage tank in the middle. The tanks have exactly the same selection box as the pipes. They have a different collision box but in both cases they're centred on the tile. But the alt-info icons for these small tanks are not drawn in the same place as pipes or at the same scale.

Untitled.jpg
Untitled.jpg (43.7 KiB) Viewed 1167 times

Neither tanks nor pipes have the entity_info_icon_shift property that crafting machines and turrets have, so it's not coming from that. It isn't coming from the position of the window_background or flow sprites because the vanilla 3x3 storage tank has a window in a completely different place (much lower down on the entity) and its alt-info icon isn't anywhere near it. I have tried messing with drawing_box and that has no effect either. Turning off scale_info_icons just renders the icon at 1:1 pixels, the location remains the same.

For vanilla storage tanks, the icon is drawn just slightly above the center of the entity - by about the same amount relative to size. It's just that because the icon is larger and within the entity's boundary, it doesn't look wrong in that case. Is it a hardcoded assumption that tanks are at least 3x3, then?

Re: Where do storage tanks get their alt-info icon position from?

Posted: Wed Jun 16, 2021 7:39 am
by Deadlock989
For anyone digging this up, you can work around this in a couple of ways:

Untitled2.jpg
Untitled2.jpg (76.87 KiB) Viewed 1114 times
  • For 1x1 storage tanks that are "tall", i.e. the sprite is taller than the selection box, then scale_info_icons = false produces a reasonable result.
  • For pipe-like 1x1 tanks that aren't taller than the selection box, you can turn the alt info icon off completely with the entity flag "hide-alt-info" and optionally add your own indicators with the rendering API.