]> git.somenet.org - factorio/some-zoom.git/commitdiff
RELEASE 2.0.0 - Initial compatibility with Factorio 2.0 master
authorSomeone <someone@somenet.org>
Tue, 22 Oct 2024 13:18:39 +0000 (15:18 +0200)
committerSomeone <someone@somenet.org>
Tue, 22 Oct 2024 13:18:39 +0000 (15:18 +0200)
changelog.txt
control.lua
info.json

index a0b1e75b4d7c87404b0d605b389e72e6fb9b5e94..1ee4d586e393812919844bbd556c38dff857e2a1 100644 (file)
@@ -1,3 +1,10 @@
+---------------------------------------------------------------------------------------------------
+Version: 2.0.0
+Date: 2024-10-21
+
+  Changed:
+    - Initial compatibility with Factorio 2.0
+
 ---------------------------------------------------------------------------------------------------
 Version: 1.1.2
 Date: 2024-01-02
index e0f4b9e9868346095acf0ecc13cd579da9fa39dc..bc933ff94b89d29ed12624fb0264ab2e067e8e39 100644 (file)
@@ -1,33 +1,22 @@
--- debug_status = 1
 debug_mod_name = "Zoom"
-debug_file = debug_mod_name .. "-debug.txt"
 require("utils")
 
 local zoom_factor = 1.5
 local zoom_wide_max = 0.01
 local zoom_wide_hotkey = 1 / (zoom_factor^7)
 local zoom_close_max = 16.00
-
---------------------------------------------------------------------------------------
-local function init_globals()
-    -- initialize or update general globals of the mod
-    debug_print( "init_globals " )
-
-    global.ticks = global.ticks or 0
-    global.force_mem = global.force_mem or {}
-    global.player_mem = global.player_mem or {}
-end
+local player_mem = {}
 
 --------------------------------------------------------------------------------------
 local function init_player(player)
-    if global.player_mem == nil then return end
+    if player_mem == nil then return end
 
     -- initialize or update per player globals of the mod, and reset the gui
     debug_print( "init_player ", player.name, " connected=", player.connected )
 
-    global.player_mem[player.index] = global.player_mem[player.index] or {}
+    player_mem[player.index] = player_mem[player.index] or {}
 
-    local player_mem = global.player_mem[player.index]
+    local player_mem = player_mem[player.index]
     player_mem.player = player_mem.player or player
     player_mem.zoom = player_mem.zoom or 1
 
@@ -47,7 +36,6 @@ end
 local function on_init()
     -- called once, the first time the mod is loaded on a game (new or existing game)
     debug_print( "on_init" )
-    init_globals()
     init_players()
 end
 
@@ -60,14 +48,7 @@ local function on_configuration_changed(data)
         local changes = data.mod_changes[debug_mod_name]
         if changes ~= nil then
             debug_print( "update mod: ", debug_mod_name, " ", tostring(changes.old_version), " to ", tostring(changes.new_version) )
-
-            init_globals()
             init_players()
-
-            if changes.old_version and older_version(changes.old_version, "1.0.4") then
-                message_all("Zoom: you can now use ALT-Z to directly zoom out wide !")
-            end
-
         end
     end
 end
@@ -106,14 +87,14 @@ local function on_gui_click(event)
     debug_print( "on_gui_click ", player.name, " ", event_name )
 
     if event_name == "but_zoom_zin" then
-        local player_mem = global.player_mem[player.index]
+        local player_mem = player_mem[player.index]
         if player_mem.zoom < zoom_close_max then
             player_mem.zoom = player_mem.zoom * zoom_factor
             player.zoom = player_mem.zoom
         end
 
     elseif event_name == "but_zoom_zout" then
-        local player_mem = global.player_mem[player.index]
+        local player_mem = player_mem[player.index]
         if player_mem.zoom > zoom_wide_max then
             player_mem.zoom = player_mem.zoom / zoom_factor
             player.zoom = player_mem.zoom
@@ -126,7 +107,7 @@ script.on_event(defines.events.on_gui_click, on_gui_click)
 --------------------------------------------------------------------------------------
 local function on_zoom_hotkey(event)
     local player = game.players[event.player_index]
-    local player_mem = global.player_mem[player.index]
+    local player_mem = player_mem[player.index]
     player_mem.zoom = zoom_wide_hotkey
     player.zoom = player_mem.zoom
 end
index eea2a8df1fb616a0e1050e94702fe677690af130..8acec3770c32c4bccc9c897f6948bc21df1267ea 100644 (file)
--- a/info.json
+++ b/info.json
@@ -1,10 +1,10 @@
 {
     "name": "some-zoom",
-    "version": "1.1.2",
+    "version": "2.0.0",
     "title": "Zoom (fixed+re-published abandoned mod)",
     "author": "Someone (originally BinbinHfr)",
     "homepage": "https://git.somenet.org/factorio/some-zoom.git",
     "description": "Just 2 buttons to zoom extra wide or close, further than actual gui limits! And a ALT-Y hotkey to direct zoom out.",
-    "dependencies": ["base>=1.1.0"],
-    "factorio_version":"1.1"
+    "factorio_version": "2.0",
+    "dependencies": ["base>=2.0.0"]
 }