[0.17.66] Storage tanks ignore x component of window_bounding_box corners

This subforum contains all the issues which we already resolved.
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

[0.17.66] Storage tanks ignore x component of window_bounding_box corners

Post by Deadlock989 »

More modded tank shenanigans ... The window_bounding_box property of storage tank entities isn't documented but it's clearly the bounds of the little flow window drawn on tanks. For the same modded tank entity reported here, I was trying to fit a little flow window on. But whatever I tried, the bounding box seems to stick like glue to about -0.5 to 0.5 on the x axis. It correctly adjusts for the y part of the corners but ignores the x:

mod tank.png
mod tank.png (103.38 KiB) Viewed 1038 times
The window bounding box here is supposed to be {{-0.125,-1},{0.125,-0.65}} but it's more like {{-0.5,-1},{0.5,-0.65}}.

To check this, I replaced the vanilla storage's main picture with a blank sprite sheet:

vanilla tank.png
vanilla tank.png (299.2 KiB) Viewed 1038 times
The vanilla prototype defines the window_bounding_box as {{-0.125,0.6875},{0.1875,1.1875}} but that's not what you get. Again, the y part of the corners is taken into account, but the x value in the corners is ignored.

This doesn't matter for the vanilla tanks because they are 3x3 tiles and large enough to hide a multitude of sins, but this behaviour makes creating smaller tanks almost impossible, or larger tanks with a window that isn't dead centre on the x axis. I didn't even care about having a flow window but those fields are mandatory for some reason so I thought I'd try and make it work.
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: [0.17.66] Storage tanks ignore x component of window_bounding_box corners

Post by Deadlock989 »

Finally figured out what was going on here. I reckon it's straddling that maybe a bug / maybe a documentation issue line.

The x component of the bounding box corners are ignored - for the purposes of scaling and shifting the fluid background. But you can get the result you want (as long as the window is horizontally centred) by using a different width of fluid background sprite - and since it's just a white rectangle that's not hard.

Perhaps the wiki could be updated to point out that this isn't literally a bounding box for the flow sprites but more of a y-axis shift/scale, and that the width of the fluid background comes from the fluid background sprite, and that apparently the window background sprite is just centred on the y values of the bounding box and drawn as-is.

However if it did function like you'd expect a bounding box to work, it would be really nice ... I'd like to make a couple more tanks but they'll have central pipe connections and it would be nice to have the flow window offset horizontally.

tank.gif
tank.gif (102.58 KiB) Viewed 1012 times
Twinsen
Factorio Staff
Factorio Staff
Posts: 1424
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: [0.17.66] Storage tanks ignore x component of window_bounding_box corners

Post by Twinsen »

Yeah, it's just strange. I updated the documentation.
The location of the window showing the contents. Note that for window_background the width and height are determined by the sprite and window_bounding_box only determines the drawing location. For fluid_background the width is determined by the sprite and the height and drawing location are determined by window_bounding_box.
The way flow_sprite is drawn gave me stage 2 cancer. That logic should be rewritten when someone really needs it.
It seems to be explained in flow_length_in_ticks
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: [0.17.66] Storage tanks ignore x component of window_bounding_box corners

Post by Deadlock989 »

Twinsen wrote: Mon Aug 26, 2019 2:47 pmThe way flow_sprite is drawn gave me stage 2 cancer. That logic should be rewritten when someone really needs it.
It seems to be explained in flow_length_in_ticks
Yeah, I'm not touching that with gloves on. The vanilla sprites work with default parameters for a good range of window sizes so it's not a problem.

Thanks for the doc update.
Post Reply

Return to “Resolved Problems and Bugs”