Page 1 of 1

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

Posted: Fri Jun 26, 2026 11:56 am
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.

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

Posted: Fri Jun 26, 2026 12:06 pm
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.