mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-06 05:16:06 -06:00
initial updates to the LTN GUI for 2.0
This commit is contained in:
BIN
cybersyn/graphics/shortcut/shortcut_icon.png
Normal file
BIN
cybersyn/graphics/shortcut/shortcut_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 430 B |
BIN
cybersyn/graphics/shortcut/shortcut_icon_small.png
Normal file
BIN
cybersyn/graphics/shortcut/shortcut_icon_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 497 B |
@@ -389,10 +389,14 @@ if settings.startup["cybersyn-manager-enabled"].value then
|
||||
{
|
||||
type = "shortcut",
|
||||
name = "cybersyn-toggle-gui",
|
||||
icon = data_util.build_sprite(nil, { 0, 0 }, util.paths.shortcut_icons, 32, 2),
|
||||
disabled_icon = data_util.build_sprite(nil, { 48, 0 }, util.paths.shortcut_icons, 32, 2),
|
||||
small_icon = data_util.build_sprite(nil, { 0, 32 }, util.paths.shortcut_icons, 24, 2),
|
||||
disabled_small_icon = data_util.build_sprite(nil, { 36, 32 }, util.paths.shortcut_icons, 24, 2),
|
||||
icon = "__cybersyn__/graphics/shortcut/shortcut_icon.png",
|
||||
icon_size = 32,
|
||||
small_icon = "__cybersyn__/graphics/shortcut/shortcut_icon.png",
|
||||
small_icon_size = 24,
|
||||
--icon = data_util.build_sprite("nil", { 0, 0 }, util.paths.shortcut_icons, 32, 2),
|
||||
--disabled_icon = data_util.build_sprite(nil, { 48, 0 }, util.paths.shortcut_icons, 32, 2),
|
||||
--small_icon = data_util.build_sprite(nil, { 0, 32 }, util.paths.shortcut_icons, 24, 2),
|
||||
--disabled_small_icon = data_util.build_sprite(nil, { 36, 32 }, util.paths.shortcut_icons, 24, 2),
|
||||
toggleable = true,
|
||||
action = "lua",
|
||||
associated_control_input = "cybersyn-toggle-gui",
|
||||
|
||||
@@ -9,10 +9,10 @@ local actions = {}
|
||||
local function toggle_fab(elem, sprite, state)
|
||||
if state then
|
||||
elem.style = "flib_selected_frame_action_button"
|
||||
elem.sprite = sprite .. "_black"
|
||||
elem.sprite = sprite .. ""
|
||||
else
|
||||
elem.style = "frame_action_button"
|
||||
elem.sprite = sprite .. "_white"
|
||||
elem.sprite = sprite .. ""
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ function inventory_tab.build(map_data, player_data)
|
||||
for item, count in pairs(inventory_provided) do
|
||||
i = i + 1
|
||||
local sprite, img_path, item_string = util.generate_item_references(item)
|
||||
if game.is_valid_sprite_path(sprite) then
|
||||
if helpers.is_valid_sprite_path(sprite) then
|
||||
provided_children[#provided_children+1] = {
|
||||
type = "sprite-button",
|
||||
style = "flib_slot_button_green",
|
||||
@@ -195,7 +195,7 @@ function inventory_tab.build(map_data, player_data)
|
||||
for item, count in pairs(inventory_requested) do
|
||||
i = i + 1
|
||||
local sprite, img_path, item_string = util.generate_item_references(item)
|
||||
if game.is_valid_sprite_path(sprite) then
|
||||
if helpers.is_valid_sprite_path(sprite) then
|
||||
requested_children[#requested_children+1] = {
|
||||
type = "sprite-button",
|
||||
style = "flib_slot_button_red",
|
||||
@@ -219,7 +219,7 @@ function inventory_tab.build(map_data, player_data)
|
||||
for item, count in pairs(inventory_in_transit) do
|
||||
i = i + 1
|
||||
local sprite, img_path, item_string = util.generate_item_references(item)
|
||||
if game.is_valid_sprite_path(sprite) then
|
||||
if helpers.is_valid_sprite_path(sprite) then
|
||||
in_transit_children[#in_transit_children+1] = {
|
||||
type = "sprite-button",
|
||||
style = "flib_slot_button_blue",
|
||||
|
||||
@@ -135,7 +135,7 @@ local function init_items(manager)
|
||||
manager.item_order = item_order
|
||||
local i = 1
|
||||
|
||||
for _, protos in pairs{prototypes.item, game.fluid_prototypes} do
|
||||
for _, protos in pairs{prototypes.item, prototypes.fluid} do
|
||||
--- @type (LuaItemPrototype|LuaFluidPrototype)[]
|
||||
local all_items = {}
|
||||
for _, proto in pairs(protos) do
|
||||
|
||||
@@ -180,10 +180,10 @@ end
|
||||
local function toggle_fab(elem, sprite, state)
|
||||
if state then
|
||||
elem.style = "flib_selected_frame_action_button"
|
||||
elem.sprite = sprite .. "_black"
|
||||
elem.sprite = sprite .. ""
|
||||
else
|
||||
elem.style = "frame_action_button"
|
||||
elem.sprite = sprite .. "_white"
|
||||
elem.sprite = sprite .. ""
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ function templates.frame_action_button(name, sprite, tooltip, handler, tags)
|
||||
type = "sprite-button",
|
||||
name = name,
|
||||
style = "frame_action_button",
|
||||
sprite = sprite .. "_white",
|
||||
hovered_sprite = sprite .. "_black",
|
||||
clicked_sprite = sprite .. "_black",
|
||||
sprite = sprite .. "",
|
||||
hovered_sprite = sprite .. "",
|
||||
clicked_sprite = sprite .. "",
|
||||
mouse_button_filter = { "left" },
|
||||
tooltip = tooltip,
|
||||
handler = handler,
|
||||
|
||||
@@ -40,15 +40,15 @@ function util.generate_item_references(item)
|
||||
local sprite = nil
|
||||
local image_path = ""
|
||||
local item_name
|
||||
if game.is_valid_sprite_path("item/" .. item) then
|
||||
if helpers.is_valid_sprite_path("item/" .. item) then
|
||||
sprite = "item/" .. item
|
||||
image_path = "[img=item." .. item .. "]"
|
||||
item_name = {"?", { "item-name." .. item }, { "entity-name." .. item }, "LocalizedString failure: " .. item }
|
||||
elseif game.is_valid_sprite_path("fluid/" .. item) then
|
||||
elseif helpers.is_valid_sprite_path("fluid/" .. item) then
|
||||
sprite = "fluid/" .. item
|
||||
image_path = "[img=fluid." .. item .. "]"
|
||||
item_name = {"?", { "fluid-name." .. item }, "LocalizedString failure: " .. item }
|
||||
elseif game.is_valid_sprite_path("virtual-signal/" .. item) then
|
||||
elseif helpers.is_valid_sprite_path("virtual-signal/" .. item) then
|
||||
sprite = "virtual-signal/" .. item
|
||||
image_path = "[img=virtual-signal." .. item .. "]"
|
||||
item_name = {"?", { "virtual-signal." .. item }, "LocalizedString failure: " .. item }
|
||||
@@ -69,7 +69,7 @@ function util.slot_table_build_from_manifest(manifest, color)
|
||||
local name = item.name
|
||||
local count = item.count
|
||||
local sprite, img_path, item_string = util.generate_item_references(name)
|
||||
if game.is_valid_sprite_path(sprite) then
|
||||
if helpers.is_valid_sprite_path(sprite) then
|
||||
children[#children + 1] = {
|
||||
type = "sprite-button",
|
||||
enabled = false,
|
||||
@@ -112,7 +112,7 @@ function util.slot_table_build_from_station(station)
|
||||
else
|
||||
color = "red"
|
||||
end
|
||||
if game.is_valid_sprite_path(sprite) then
|
||||
if helpers.is_valid_sprite_path(sprite) then
|
||||
children[#children + 1] = {
|
||||
type = "sprite-button",
|
||||
enabled = false,
|
||||
@@ -149,7 +149,7 @@ function util.slot_table_build_from_deliveries(station)
|
||||
else
|
||||
color = "blue"
|
||||
end
|
||||
if game.is_valid_sprite_path(sprite) then
|
||||
if helpers.is_valid_sprite_path(sprite) then
|
||||
children[#children + 1] = {
|
||||
type = "sprite-button",
|
||||
enabled = false,
|
||||
@@ -188,7 +188,7 @@ function util.slot_table_build_from_control_signals(station, map_data)
|
||||
else
|
||||
sprite = "virtual-signal" .. "/" .. name
|
||||
end
|
||||
if game.is_valid_sprite_path(sprite) then
|
||||
if helpers.is_valid_sprite_path(sprite) then
|
||||
children[#children + 1] = {
|
||||
type = "sprite-button",
|
||||
enabled = false,
|
||||
@@ -230,7 +230,7 @@ function util.slot_table_build_from_control_signals(station, map_data)
|
||||
count = count * get_stack_size(map_data, name)
|
||||
end
|
||||
|
||||
if game.is_valid_sprite_path(sprite) then
|
||||
if helpers.is_valid_sprite_path(sprite) then
|
||||
children[#children + 1] = {
|
||||
type = "sprite-button",
|
||||
enabled = false,
|
||||
@@ -248,7 +248,7 @@ function util.slot_table_build_from_control_signals(station, map_data)
|
||||
|
||||
elseif item.type == "virtual" then
|
||||
sprite = "virtual-signal" .. "/" .. name
|
||||
if game.is_valid_sprite_path(sprite) then
|
||||
if helpers.is_valid_sprite_path(sprite) then
|
||||
children[#children + 1] = {
|
||||
type = "sprite-button",
|
||||
enabled = false,
|
||||
|
||||
Reference in New Issue
Block a user