[2.1.8] ContainerPrototype.picture needs all directions even ContainerPrototype.direction_count is 2

Bugs that are actually features.
Atria
Long Handed Inserter
Long Handed Inserter
Posts: 68
Joined: Sat Jul 09, 2016 10:25 am
Contact:

[2.1.8] ContainerPrototype.picture needs all directions even ContainerPrototype.direction_count is 2

Post by Atria »

I'm creating a container which has direction_count set to 2, so I'd expect picture to also only require 2 directions. But game doesn't load until I provide pictures for all 4 cardinal directions.

I would expect this to work:

Code: Select all

data:extend({
    {
        type = 'container',
        name = 'container',
        picture = {
            north = {
                filename = '__base__/graphics/entity/steel-chest/steel-chest.png',
                width = 64,
                height = 80,
            },
            east = {
                filename = '__base__/graphics/entity/steel-chest/steel-chest.png',
                width = 64,
                height = 80,
            },
        },
        direction_count = 2,
        inventory_size = 1,
        collision_box = {{-1, -1}, {1, 1}},
        selection_box = {{-1, -1}, {1, 1}},
    }
})
But game fail to load with "Key "south" not found in property tree at ROOT.container.container.picture"

Not a massive problem, just something which could be polished.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4635
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.1.8] ContainerPrototype.picture needs all directions even ContainerPrototype.direction_count is 2

Post by boskid »

Thanks for the report however i am going to say that this is working as intended. Sprites loading is handled by Sprite4Way and i do not want to have this class do anything special for containers because this logic would also have to be handled for other entities and we assume that when Sprite4Way has any sprite loaded, it has all sprites loaded.

I think there was some way of providing sprites to Sprite4Way, possibly through Sprite4Way::sheet where you can just provide 2 frames and they will get automatically repeated for unused directions fulfilling the conditions that either none or all sprites are loaded.
Post Reply

Return to “Not a bug”