Breaking graphics by using size instead of height/width

Bugs that are actually features.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1770
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Breaking graphics by using size instead of height/width

Post by Pi-C »

According to the wiki, the size parameter specifies
[t]he width and height of the sprite. If this is an array, the first member of the array is the width and the second is the height. Otherwise the size is both width and height.
While preparing Bio Industries for 1.1, I tried to optimize the code, and using "size" instead of both "width" and "height" for square graphics seemed like a good idea to get rid of a couple of lines. But there was an issue with BI's wooden pipes:
wooden_pipes.png
wooden_pipes.png (311.08 KiB) Viewed 690 times
This happens with Factorio 0.18 and 1.1. While making the screenshots, I used the same version of the mod, with only one file differing. I've attached the two versions of the file, a diff should show that these versions really are the same except for the different specifications of sprite sizes. To reproduce the bug, you can use BI 0.18.29, build some wooden pipes, then replace prototypes/Wood_Products/entity.lua with the attached entities_size.lua.
Attachments
entities_width_height.lua
(45.57 KiB) Downloaded 64 times
entities_size.lua
(44.86 KiB) Downloaded 72 times
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4160
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Breaking graphics by using size instead of height/width

Post by boskid »

Not a bug.

Please check `prototypes/Wood_Products/pipes.lua` function `change_graphics`. If size is specified it has priority over width/height
Pi-C
Smart Inserter
Smart Inserter
Posts: 1770
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Breaking graphics by using size instead of height/width

Post by Pi-C »

boskid wrote: Mon Dec 14, 2020 7:00 am Not a bug.

Please check `prototypes/Wood_Products/pipes.lua` function `change_graphics`. If size is specified it has priority over width/height
Thanks for finding my bug! I somehow overlooked that function and forgot that I explicitly made it to adjust only width/height when I changed it some months ago. Last night I only looked for what changed between the working and the buggy version. Should have gone one layer deeper before posting that bug report … :oops:
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Post Reply

Return to “Not a bug”