[1.1.94] Visual inconsistency when layering icons on equipment

Post your bugs and problems so we can fix them.
Post Reply
Soul-Burn
Inserter
Inserter
Posts: 28
Joined: Sun Jan 31, 2021 9:07 pm
Contact:

[1.1.94] Visual inconsistency when layering icons on equipment

Post by Soul-Burn »

In my mod, I add overlays to various icons, including personal equipment.
The icons look OK when viewed on the armor equipment grid, but are completely off when hovering over the armor, which also shows the equipment grid.
Untitled.png
Untitled.png (329.3 KiB) Viewed 326 times
This is the code I have used to layer the icon:

Code: Select all

    if string.find(new_p.type, "-equipment") and new_p.sprite then
        if not new_p.sprite.layers then
            new_p.sprite.layers = { table.deepcopy(new_p.sprite) }
        end
        local layer = new_p.sprite.layers[1]
        table.insert(
                new_p.sprite.layers,
                {
                    filename = quality.icon, height = 32, width = 32, scale = 0.5,
                    shift = { -(layer.size or layer.width) / 2, (layer.size or layer.height) / 2 }
                }
        )
    end
The "quality.icon" image is 32x32.

Post Reply

Return to “Bug Reports”