Skip to content

Commit

Permalink
refactor: minimal changes to make compatible with Factorio 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Serov committed Nov 23, 2024
1 parent 2a7183a commit 7c3b1bb
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 49 deletions.
48 changes: 6 additions & 42 deletions Todo-List/data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,9 @@ local toggle_ui_shortcut = {
order = 'a[alt-mode]-b[copy]',
action = 'lua',
localised_name = {'todo.shortcut_toggle_ui'},
icon = {
filename = '__Todo-List__/graphics/' .. 'toggle-ui.png',
width = 104,
height = 144,
scale = 1,
flags = {'icon'}
},
small_icon = {
filename = '__Todo-List__/graphics/' .. 'toggle-ui.png',
width = 104,
height = 144,
scale = 1,
flags = {'icon'}
},
disabled_small_icon = {
filename = '__Todo-List__/graphics/' .. 'toggle-ui-disabled.png',
width = 104,
height = 144,
scale = 1,
flags = {'icon'}
}
icon = '__Todo-List__/graphics/toggle-ui.png',
small_icon = '__Todo-List__/graphics/' .. 'toggle-ui.png',
disabled_small_icon = '__Todo-List__/graphics/' .. 'toggle-ui-disabled.png'
}

local add_task_shortcut = {
Expand All @@ -43,27 +25,9 @@ local add_task_shortcut = {
order = 'a[alt-mode]-b[copy]',
action = 'lua',
localised_name = {'todo.shortcut_add_task'},
icon = {
filename = '__Todo-List__/graphics/' .. 'add-task.png',
width = 104,
height = 144,
scale = 1,
flags = {'icon'}
},
small_icon = {
filename = '__Todo-List__/graphics/' .. 'add-task.png',
width = 104,
height = 144,
scale = 1,
flags = {'icon'}
},
disabled_small_icon = {
filename = '__Todo-List__/graphics/' .. 'add-task-disabled.png',
width = 104,
height = 144,
scale = 1,
flags = {'icon'}
}
icon = '__Todo-List__/graphics/' .. 'add-task.png',
small_icon = '__Todo-List__/graphics/' .. 'add-task.png',
disabled_small_icon = '__Todo-List__/graphics/' .. 'add-task-disabled.png',
}

data:extend({hotkey, toggle_ui_shortcut, add_task_shortcut})
6 changes: 3 additions & 3 deletions Todo-List/info.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "Todo-List",
"version": "19.3.0",
"version": "19.4.0",
"title": "✔ Todo List",
"author": "Jason Miles and many others from the community",
"contact": "[email protected]",
"homepage": "https://github.com/JonasJurczok/factorio-todo-list",
"factorio_version": "1.1",
"factorio_version": "2.0",
"dependencies": [
"base >= 1.1.0"
"base >= 2.0.0"
],
"description": "✔ This mod adds a todo list to the single- and multiplayer game to allow players to synchronize their work."
}
2 changes: 1 addition & 1 deletion Todo-List/todo/features/export_task.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function todo.encode_task_list_for_export(tasks)

table.insert(to_encode, export_task)
end
return todo.base64.encode(game.table_to_json(to_encode))
return todo.base64.encode(helpers.table_to_json(to_encode))
end

function todo.on_export_cancel_click(player)
Expand Down
4 changes: 4 additions & 0 deletions Todo-List/todo/todo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ todo.base64 = require("lib/base64")
function todo.mod_init()
todo.log("setting up mod data.")

if not global then
global = {}
end

if not global.todo then
global.todo = { ["open"] = {}, ["done"] = {}, ["settings"] = {} }
else
Expand Down
2 changes: 1 addition & 1 deletion Todo-List/todo/ui/helper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function todo.create_frame(player, name, caption, close_name)
title_bar.add({
type = "sprite-button",
style = "frame_action_button",
sprite = "utility/close_white",
sprite = "utility/close",
name = close_name
})
end
Expand Down
4 changes: 2 additions & 2 deletions Todo-List/todo/ui/main_frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ function todo.add_task_to_table(player, table, task, completed, is_first, is_las
type = "sprite-button",
style = "todo_sprite_button_default",
name = "todo_open_edit_dialog_button_" .. id,
sprite = "utility/rename_icon_normal",
sprite = "utility/rename_icon",
tooltip = { todo.translate(player, "title_edit") }
})

Expand Down Expand Up @@ -379,7 +379,7 @@ function todo.add_subtask_to_main_table(player, table, task_id, subtask, is_firs
type = "sprite-button",
style = "todo_sprite_button_default",
name = string.format("todo_main_subtask_edit_button_%i_%i", task_id, subtask_id),
sprite = "utility/rename_icon_normal",
sprite = "utility/rename_icon",
tooltip = { todo.translate(player, "edit_subtask") }
}
end
Expand Down
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 19.4.0
Date: 2024-11-23
Improvements:
- Minimal changes to make compatible with Factorio 2.0.
---------------------------------------------------------------------------------------------------
Version: 19.3.0
Date: 2023-01-30
Improvements:
Expand Down

0 comments on commit 7c3b1bb

Please sign in to comment.