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:
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:
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.
[0.17.66] Storage tanks ignore x component of window_bounding_box corners
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
- Deadlock989
- 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
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.
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.
Re: [0.17.66] Storage tanks ignore x component of window_bounding_box corners
Yeah, it's just strange. I updated the documentation.
It seems to be explained in flow_length_in_ticks
The way flow_sprite is drawn gave me stage 2 cancer. That logic should be rewritten when someone really needs it.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.
It seems to be explained in flow_length_in_ticks
- Deadlock989
- 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
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.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
Thanks for the doc update.