diff --git a/.gitignore b/.gitignore index cce70a7..14fb932 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ build build/* -factorio_mods \ No newline at end of file +factorio_mods +/.buildpath +/.project diff --git a/control.lua b/control.lua index 4b0e1b6..aad83c2 100644 --- a/control.lua +++ b/control.lua @@ -1,5 +1,5 @@ if not defines then - require "defines" + require "defines" end require "util" @@ -412,6 +412,16 @@ script.on_event(defines.events.on_gui_click, function(event) else gui_open_frame(player) end + elseif element.name == "spritetest" then + + local stack = player.cursor_stack + if not stack.valid_for_read then + element.sprite = false + else + element.sprite = "item/".. stack.name + end + + elseif element.name == "auto-trash-apply" or element.name == "auto-trash-logistics-apply" then gui_save_changes(player) elseif element.name == "auto-trash-clear-all" or element.name == "auto-trash-logistics-clear-all" then diff --git a/data.lua b/data.lua index b401821..966b137 100644 --- a/data.lua +++ b/data.lua @@ -1,229 +1,287 @@ -require "lib" - -data:extend({ - { - type = "font", - name = "auto-trash-small-font", - from = "default", - size = 14 - } -}) - -data.raw["gui-style"].default["auto-trash-small-button"] = { - type = "button_style", - parent = "default", - font = "auto-trash-small-font" -} - -data.raw["gui-style"].default["auto-trash-textfield-small"] = - { - type = "textfield_style", - left_padding = 3, - right_padding = 2, - minimal_width = 30, - font = "auto-trash-small-font" - } - -data.raw["gui-style"].default["auto-trash-table"] = - { - type = "table_style", - parent = "table_style", - } - -data.raw["gui-style"].default["auto-trash-button"] = - { - type = "button_style", - parent = "button_style", - width = 33, - height = 33, - top_padding = 6, - right_padding = 0, - bottom_padding = 0, - left_padding = 0, - font = "auto-trash-small-font", - default_graphical_set = - { - type = "monolith", - monolith_image = - { - filename = "__AutoTrash__/graphics/gui.png", - priority = "extra-high-no-scale", - width = 32, - height = 32, - x = 64 - } - }, - hovered_graphical_set = - { - type = "monolith", - monolith_image = - { - filename = "__AutoTrash__/graphics/gui.png", - priority = "extra-high-no-scale", - width = 32, - height = 32, - x = 96 - } - }, - clicked_graphical_set = - { - type = "monolith", - monolith_image = - { - filename = "__AutoTrash__/graphics/gui.png", - width = 32, - height = 32, - x = 96 - } - } - } - -data.raw["gui-style"].default["auto-trash-button-paused"] = - { - type = "button_style", - parent = "button_style", - width = 33, - height = 33, - top_padding = 6, - right_padding = 0, - bottom_padding = 0, - left_padding = 0, - font = "auto-trash-small-font", - default_graphical_set = - { - type = "monolith", - monolith_image = - { - filename = "__AutoTrash__/graphics/gui.png", - priority = "extra-high-no-scale", - width = 32, - height = 32, - x = 128 - } - }, - hovered_graphical_set = - { - type = "monolith", - monolith_image = - { - filename = "__AutoTrash__/graphics/gui.png", - priority = "extra-high-no-scale", - width = 32, - height = 32, - x = 160 - } - }, - clicked_graphical_set = - { - type = "monolith", - monolith_image = - { - filename = "__AutoTrash__/graphics/gui.png", - width = 32, - height = 32, - x = 160 - } - } - } - -data.raw["gui-style"].default["auto-trash-logistics-button"] = - { - type = "button_style", - parent = "button_style", - width = 33, - height = 33, - top_padding = 6, - right_padding = 0, - bottom_padding = 0, - left_padding = 0, - font = "auto-trash-small-font", - default_graphical_set = - { - type = "monolith", - monolith_image = - { - filename = "__AutoTrash__/graphics/gui.png", - priority = "extra-high-no-scale", - width = 32, - height = 32, - x = 64, - y = 32 - } - }, - hovered_graphical_set = - { - type = "monolith", - monolith_image = - { - filename = "__AutoTrash__/graphics/gui.png", - priority = "extra-high-no-scale", - width = 32, - height = 32, - x = 96, - y = 32 - } - }, - clicked_graphical_set = - { - type = "monolith", - monolith_image = - { - filename = "__AutoTrash__/graphics/gui.png", - width = 32, - height = 32, - x = 96, - y = 32 - } - } - } - -data.raw["gui-style"].default["auto-trash-logistics-button-paused"] = - { - type = "button_style", - parent = "button_style", - width = 33, - height = 33, - top_padding = 6, - right_padding = 0, - bottom_padding = 0, - left_padding = 0, - font = "auto-trash-small-font", - default_graphical_set = - { - type = "monolith", - monolith_image = - { - filename = "__AutoTrash__/graphics/gui.png", - priority = "extra-high-no-scale", - width = 32, - height = 32, - x = 128, - y = 32 - } - }, - hovered_graphical_set = - { - type = "monolith", - monolith_image = - { - filename = "__AutoTrash__/graphics/gui.png", - priority = "extra-high-no-scale", - width = 32, - height = 32, - x = 160, - y = 32 - } - }, - clicked_graphical_set = - { - type = "monolith", - monolith_image = - { - filename = "__AutoTrash__/graphics/gui.png", - width = 32, - height = 32, - x = 160, - y = 32 - } - } - } +require "lib" + +data:extend({ + { + type = "font", + name = "auto-trash-small-font", + from = "default", + size = 14 + } +}) + +data.raw["gui-style"].default["auto-trash-small-button"] = { + type = "button_style", + parent = "button_style", + font = "auto-trash-small-font" +} + +data.raw["gui-style"].default["auto-trash-textfield-small"] = + { + type = "textfield_style", + left_padding = 3, + right_padding = 2, + minimal_width = 30, + font = "auto-trash-small-font" + } + +data.raw["gui-style"].default["auto-trash-table"] = + { + type = "table_style", + parent = "table_style", + } + +data.raw["gui-style"].default["auto-trash-button"] = + { + type = "button_style", + parent = "button_style", + width = 33, + height = 33, + top_padding = 6, + right_padding = 0, + bottom_padding = 0, + left_padding = 0, + font = "auto-trash-small-font", + default_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__AutoTrash__/graphics/gui.png", + priority = "extra-high-no-scale", + width = 32, + height = 32, + x = 64 + } + }, + hovered_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__AutoTrash__/graphics/gui.png", + priority = "extra-high-no-scale", + width = 32, + height = 32, + x = 96 + } + }, + clicked_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__AutoTrash__/graphics/gui.png", + width = 32, + height = 32, + x = 96 + } + } + } + +data.raw["gui-style"].default["auto-trash-sprite-button"] = + { + type = "button_style", + parent = "button_style", + width = 33, + height = 33, + top_padding = 6, + right_padding = 0, + bottom_padding = 0, + left_padding = 0, + font = "auto-trash-small-font", + sprite = { + filename = "__core__/graphics/gui.png", + priority = "extra-high-no-scale", + width = 32, + height = 32, + x = 111, + }, + + default_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__core__/graphics/gui.png", + priority = "extra-high-no-scale", + width = 32, + height = 32, + x = 111, + } + }, + hovered_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__core__/graphics/gui.png", + priority = "extra-high-no-scale", + width = 32, + height = 32, + x = 111, + } + }, + clicked_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__core__/graphics/gui.png", + priority = "extra-high-no-scale", + width = 32, + height = 32, + x = 111, + } + } + } + + +data.raw["gui-style"].default["auto-trash-button-paused"] = + { + type = "button_style", + parent = "button_style", + width = 33, + height = 33, + top_padding = 6, + right_padding = 0, + bottom_padding = 0, + left_padding = 0, + font = "auto-trash-small-font", + default_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__AutoTrash__/graphics/gui.png", + priority = "extra-high-no-scale", + width = 32, + height = 32, + x = 128 + } + }, + hovered_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__AutoTrash__/graphics/gui.png", + priority = "extra-high-no-scale", + width = 32, + height = 32, + x = 160 + } + }, + clicked_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__AutoTrash__/graphics/gui.png", + width = 32, + height = 32, + x = 160 + } + } + } + +data.raw["gui-style"].default["auto-trash-logistics-button"] = + { + type = "button_style", + parent = "button_style", + width = 33, + height = 33, + top_padding = 6, + right_padding = 0, + bottom_padding = 0, + left_padding = 0, + font = "auto-trash-small-font", + default_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__AutoTrash__/graphics/gui.png", + priority = "extra-high-no-scale", + width = 32, + height = 32, + x = 64, + y = 32 + } + }, + hovered_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__AutoTrash__/graphics/gui.png", + priority = "extra-high-no-scale", + width = 32, + height = 32, + x = 96, + y = 32 + } + }, + clicked_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__AutoTrash__/graphics/gui.png", + width = 32, + height = 32, + x = 96, + y = 32 + } + } + } + +data.raw["gui-style"].default["auto-trash-logistics-button-paused"] = + { + type = "button_style", + parent = "button_style", + width = 33, + height = 33, + top_padding = 6, + right_padding = 0, + bottom_padding = 0, + left_padding = 0, + font = "auto-trash-small-font", + default_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__AutoTrash__/graphics/gui.png", + priority = "extra-high-no-scale", + width = 32, + height = 32, + x = 128, + y = 32 + } + }, + hovered_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__AutoTrash__/graphics/gui.png", + priority = "extra-high-no-scale", + width = 32, + height = 32, + x = 160, + y = 32 + } + }, + clicked_graphical_set = + { + type = "monolith", + monolith_image = + { + filename = "__AutoTrash__/graphics/gui.png", + width = 32, + height = 32, + x = 160, + y = 32 + } + } + } diff --git a/gui.lua b/gui.lua index c2a1859..4d0e2de 100644 --- a/gui.lua +++ b/gui.lua @@ -118,6 +118,17 @@ function gui_open_frame(player) name = "auto-trash-config-frame", direction = "vertical" } + + --local sprite_button = +-- frame.add{ +-- type = "sprite-button", +-- --sprite = "item/iron-ore", +-- style = "auto-trash-sprite-button", +-- name = "spritetest" +-- } + + + local error_label = frame.add{ type = "label", caption = "---", diff --git a/info.json b/info.json index dbc7098..658238a 100644 --- a/info.json +++ b/info.json @@ -1,9 +1,10 @@ { "name": "AutoTrash", "version": "{{VERSION}}", + "factorio_version": "0.13", "title": "Auto Trash", "author": "Choumiko", "homepage": "", - "dependencies": ["base >= 0.12.24"], + "dependencies": ["base >= 0.13.0"], "description": "Keeps your inventory clean of certain items" }