Skip to content

Commit

Permalink
Release 2.0.0 / Support Facorio 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
veger committed Oct 21, 2024
1 parent 8761673 commit d755128
Show file tree
Hide file tree
Showing 38 changed files with 196 additions and 307 deletions.
3 changes: 2 additions & 1 deletion .luarc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
],
"hint.enable": false,
"diagnostics.globals": [
"os"
"os",
"storage"
]
}
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 2.0.0
Date: 21-10-204
Features:
- Support Factorio 2.0 (I did not check with Space Age playthrough, so there might be bugs!)
---------------------------------------------------------------------------------------------------
Version: 1.5.2
Date: 21-10-204
Minor Features:
Expand Down
10 changes: 5 additions & 5 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ local function init_new_player(index, player)
-- initialize player(s) when mod is loaded into existing game
player.print("init_new_player")
TLBE.Config.reload({ player_index = index })
TLBE.GUI.initialize(player, global.playerSettings[index])
TLBE.GUI.initialize(player, storage.playerSettings[index])

player.print({ "mod-loaded" }, { r = 1, g = 0.5, b = 0 })
player.print({ "mod-loaded2" })
end

local function on_init()
global.playerSettings = {}
storage.playerSettings = {}

for index, player in pairs(game.players) do
-- initialize player(s) when mod is loaded into existing game
Expand All @@ -37,7 +37,7 @@ local function on_init()
if baseBBox ~= nil then
-- Update base trackers of each player
for index, _ in pairs(game.players) do
local baseTracker = global.playerSettings[index].trackers[3]
local baseTracker = storage.playerSettings[index].trackers[3]
baseTracker.minPos = baseBBox.minPos
baseTracker.maxPos = baseBBox.maxPos
TLBE.Tracker.updateCenterAndSize(baseTracker)
Expand All @@ -57,7 +57,7 @@ local function on_configuration_changed(event)
-- Sometimes playerSettings does not seem to be present when upgrading
-- from older versions. We can just fix this issue here.
for index, player in pairs(game.players) do
if global.playerSettings[index] == nil then
if storage.playerSettings[index] == nil then
player.print({ "migration-fix-missing-player-data" })
init_new_player(index, player)
end
Expand All @@ -73,7 +73,7 @@ local function on_player_created(event)
local player = game.players[event.player_index]
player.print({ "mod-loaded2" }, { r = 1, g = 0.5, b = 0 })

TLBE.GUI.initialize(player, global.playerSettings[event.player_index])
TLBE.GUI.initialize(player, storage.playerSettings[event.player_index])
end


Expand Down
Binary file added graphics/logo-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/logo-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed graphics/logo.png
Binary file not shown.
Binary file added graphics/pause-camera-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/pause-camera-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed graphics/pause-camera.png
Binary file not shown.
Binary file removed graphics/play-white.png
Binary file not shown.
Binary file added graphics/take-screenshot-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/take-screenshot-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed graphics/take-screenshot.png
Binary file not shown.
6 changes: 3 additions & 3 deletions info.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "TLBE",
"version": "1.5.2",
"version": "2.0.0",
"title": "Time Lapse Base Edition",
"author": "veger",
"contact": "",
"homepage": "",
"license": "MIT https://opensource.org/licenses/MIT",
"factorio_version": "1.1",
"factorio_version": "2.0",
"dependencies": [
"base >= 1.0.0",
"base >= 2.0.0",
"? StatsGui >= 1.1.0"
],
"description": "Takes screenshots of your base at specified intervals."
Expand Down
6 changes: 3 additions & 3 deletions migrations/tlbe-0.2.1.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ local Tracker = require("scripts.tracker")

local ticks_per_second = 60

if global.playerSettings == nil then
if storage.playerSettings == nil then
goto SkipMigration
end

for player_index, player in pairs(game.players) do
local playerSettings = global.playerSettings[player_index]
local playerSettings = storage.playerSettings[player_index]
if playerSettings == nil or playerSettings.cameras == nil then
goto NextPlayer
end
Expand Down Expand Up @@ -68,7 +68,7 @@ for player_index, player in pairs(game.players) do
playerSettings.trackers = { table.unpack(mainCamera.trackers) }

-- Remove obsolete entries
global.rocketLaunching = nil
storage.rocketLaunching = nil
playerSettings.enabled = nil
playerSettings.noticesEnabled = nil
playerSettings.followPlayer = nil
Expand Down
6 changes: 3 additions & 3 deletions migrations/tlbe-1.0.0.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
if global.playerSettings == nil then
if storage.playerSettings == nil then
goto SkipMigration
end

for player_index, _ in pairs(game.players) do
local playerSettings = global.playerSettings[player_index]
local playerSettings = storage.playerSettings[player_index]
if playerSettings == nil then
goto NextPlayer
end

for _, tracker in pairs(playerSettings.trackers) do
if tracker.type == "player" then
tracker.size = {x = 1, y = 1}
tracker.size = { x = 1, y = 1 }
tracker.smooth = false
else
tracker.smooth = true
Expand Down
6 changes: 3 additions & 3 deletions migrations/tlbe.1.1.1.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
if global.playerSettings == nil then
if storage.playerSettings == nil then
goto SkipMigration
end

-- Set to old default value for smooth experience
for player_index, player in pairs(game.players) do
local guiSettings = settings.get_player_settings(player)
local playerSettings = global.playerSettings[player_index]
guiSettings["tlbe-sequential-names"] = {value = false}
local playerSettings = storage.playerSettings[player_index]
guiSettings["tlbe-sequential-names"] = { value = false }

if playerSettings ~= nil then
playerSettings.screenshotNumber = game.tick + 1
Expand Down
4 changes: 2 additions & 2 deletions migrations/tlbe.1.2.0.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
if global.playerSettings == nil then
if storage.playerSettings == nil then
goto SkipMigration
end

-- Set new camera setting to its previous (default) value
for player_index, _ in pairs(game.players) do
local playerSettings = global.playerSettings[player_index]
local playerSettings = storage.playerSettings[player_index]
if playerSettings == nil then
goto NextPlayer
end
Expand Down
4 changes: 2 additions & 2 deletions migrations/tlbe.1.3.1.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
if global.playerSettings == nil then
if storage.playerSettings == nil then
goto SkipMigration
end

-- Set camera and tracker surfaces to the default surface
for player_index, _ in pairs(game.players) do
local playerSettings = global.playerSettings[player_index]
local playerSettings = storage.playerSettings[player_index]
if playerSettings == nil then
goto NextPlayer
end
Expand Down
6 changes: 3 additions & 3 deletions migrations/tlbe.1.4.2.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if global.playerSettings == nil then
if storage.playerSettings == nil then
goto SkipMigration
end

Expand All @@ -7,13 +7,13 @@ local Tracker = require("scripts.tracker")

-- Update camera with current active tracker to prevent possible (zooming) issues
for player_index, _ in pairs(game.players) do
local playerSettings = global.playerSettings[player_index]
local playerSettings = storage.playerSettings[player_index]
if playerSettings == nil then
goto NextPlayer
end

for _, camera in pairs(playerSettings.cameras) do
local _, activeTracker = Tracker.findActiveTracker(camera.trackers, camera.surfaceName)
local _, activeTracker = Tracker.findActiveTracker(camera.trackers, camera.surfaceName)
Camera.SetActiveTracker(camera, activeTracker)
end

Expand Down
8 changes: 4 additions & 4 deletions migrations/tlbe.1.4.3.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if global.playerSettings == nil then
if storage.playerSettings == nil then
goto SkipMigration
end

Expand All @@ -7,14 +7,14 @@ local Camera = require("scripts.camera")
-- Update camera save folder and name
-- Move sequential screenshot number to camera(s)
for player_index, _ in pairs(game.players) do
local playerSettings = global.playerSettings[player_index]
local playerSettings = storage.playerSettings[player_index]
if playerSettings == nil then
goto NextPlayer
end

for _, camera in pairs(playerSettings.cameras) do
Camera.setName(camera, camera.name)
camera.screenshotNumber = playerSettings.screenshotNumber
Camera.setName(camera, camera.name)
camera.screenshotNumber = playerSettings.screenshotNumber
end

playerSettings.screenshotNumber = nil
Expand Down
4 changes: 2 additions & 2 deletions migrations/tlbe.1.4.4.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
if global.playerSettings == nil then
if storage.playerSettings == nil then
goto SkipMigration
end

-- Set camera alwaysDay to true for backwards compatibility
-- Make tracker untilBuild available for all trackers
for player_index, _ in pairs(game.players) do
local playerSettings = global.playerSettings[player_index]
local playerSettings = storage.playerSettings[player_index]
if playerSettings == nil then
goto NextPlayer
end
Expand Down
4 changes: 2 additions & 2 deletions migrations/tlbe.1.4.5.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if global.playerSettings == nil then
if storage.playerSettings == nil then
goto SkipMigration
end

Expand All @@ -8,7 +8,7 @@ local GUI = require("scripts.gui")
-- Convert to new Camera transitionData
for player_index, player in pairs(game.players) do
---@type playerSettings
local playerSettings = global.playerSettings[player_index]
local playerSettings = storage.playerSettings[player_index]
if playerSettings == nil then
goto NextPlayer
end
Expand Down
102 changes: 12 additions & 90 deletions prototypes/shortcuts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,10 @@ data:extend(
action = "lua",
localised_name = { "shortcut.tlbe" },
associated_control_input = "tlbe-main-window-toggle",
icon = {
-- tlbe-logo
filename = "__TLBE__/graphics/logo.png",
priority = "extra-high-no-scale",
width = 64,
height = 50,
position = { 0, 0 },
scale = 1,
flags = { "icon" }
},
small_icon = {
-- tlbe-logo
filename = "__TLBE__/graphics/logo.png",
priority = "extra-high-no-scale",
width = 64,
height = 50,
position = { 0, 0 },
scale = 1,
flags = { "icon" }
},
disabled_small_icon = {
-- tlbe-logo-white
filename = "__TLBE__/graphics/logo.png",
priority = "extra-high-no-scale",
width = 64,
height = 50,
position = { 65, 0 },
scale = 1,
flags = { "icon" }
}
icon = "__TLBE__/graphics/logo-32.png",
icon_size = 32,
small_icon = "__TLBE__/graphics/logo-24.png",
small_icon_size = 24
},
{
type = "shortcut",
Expand All @@ -65,36 +39,10 @@ data:extend(
action = "lua",
localised_name = { "shortcut.tlbe-pause" },
associated_control_input = "tlbe-pause-cameras",
icon = {
-- tlbe-pause-camera
filename = "__TLBE__/graphics/pause-camera.png",
priority = "extra-high-no-scale",
width = 64,
height = 64,
position = { 0, 0 },
scale = 1,
flags = { "icon" }
},
small_icon = {
-- tlbe-pause-camera
filename = "__TLBE__/graphics/pause-camera.png",
priority = "extra-high-no-scale",
width = 64,
height = 64,
position = { 0, 0 },
scale = 1,
flags = { "icon" }
},
disabled_small_icon = {
-- tlbe-pause-camera-white
filename = "__TLBE__/graphics/pause-camera.png",
priority = "extra-high-no-scale",
width = 64,
height = 50,
position = { 65, 0 },
scale = 1,
flags = { "icon" }
}
icon = "__TLBE__/graphics/pause-camera-32.png",
icon_size = 32,
small_icon = "__TLBE__/graphics/pause-camera-24.png",
small_icon_size = 24
},
{
type = "shortcut",
Expand All @@ -104,36 +52,10 @@ data:extend(
action = "lua",
localised_name = { "shortcut.tlbe-screenshot" },
associated_control_input = "tlbe-take-screenshot",
icon = {
-- tlbe-take-screenshot
filename = "__TLBE__/graphics/take-screenshot.png",
priority = "extra-high-no-scale",
width = 64,
height = 64,
position = { 0, 0 },
scale = 1,
flags = { "icon" }
},
small_icon = {
-- tlbe-take-screenshot
filename = "__TLBE__/graphics/take-screenshot.png",
priority = "extra-high-no-scale",
width = 64,
height = 64,
position = { 0, 0 },
scale = 1,
flags = { "icon" }
},
disabled_small_icon = {
-- tlbe-take-screenshot-white
filename = "__TLBE__/graphics/take-screenshot.png",
priority = "extra-high-no-scale",
width = 64,
height = 50,
position = { 65, 0 },
scale = 1,
flags = { "icon" }
}
icon = "__TLBE__/graphics/take-screenshot-32.png",
icon_size = 32,
small_icon = "__TLBE__/graphics/take-screenshot-24.png",
small_icon_size = 24,
}
}
)
Loading

0 comments on commit d755128

Please sign in to comment.