Sprite button GUI: sprite layers as icon layers

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Sprite button GUI: sprite layers as icon layers

Post by darkfrei »

Hi all!

If I want to add sprite-button, then I write it so:

Code: Select all

items_table.add{
  type = "sprite-button", 
  style = "slot_button_style",  
  name = item_name, 
  sprite  = "item/" .. item_name
}
Is it possible to add layers, something like it was added by icons?

Code: Select all

icons = {
  {icon = "__mod-name__/graphics/icons/item-001.png", tint = {r = 0.8, g = 0.8, b = 1, a = 1}},
  {icon = "__mod-name__/graphics/icons/item-002.png", tint = {r = 1, g = 0.8, b = 1, a = 1}}
}
So, the code for sprite button with multiple layers looks like:

Code: Select all

items_table.add{
  type = "sprite-button", 
  style = "slot_button_style",  
  name = item_name, 
  sprites  = {
    {sprite = "item/" .. item_name},
    {sprite = "__mod-name__/graphics/icons/symbol-001.png"}
  }
}
Where symbol-001.png is a picture 32x32, something like
disabled.png
disabled.png (733 Bytes) Viewed 685 times
or

Code: Select all

  sprites  = {
    {sprite = "item/" .. item_name},
    {sprite = "item/" .. item_with_disabling_icon}
  }

Post Reply

Return to “Modding interface requests”