From e28a9c8b228b207fbd0d567e156fe74214780ab9 Mon Sep 17 00:00:00 2001 From: Someone Date: Mon, 21 Oct 2024 15:58:41 +0200 Subject: [PATCH] RELEASE 2.0.0 - Initial compatibility with Factorio 2.0 --- changelog.txt | 7 +++++++ control.lua | 13 +++++++------ info.json | 6 +++--- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/changelog.txt b/changelog.txt index 8d757ab..a47fe43 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ +--------------------------------------------------------------------------------------------------- +Version: 2.0.0 +Date: 2024-10-21 + + Changed: + - Initial compatibility with Factorio 2.0 + --------------------------------------------------------------------------------------------------- Version: 1.1.5 Date: 2024-02-02 diff --git a/control.lua b/control.lua index 5c51e8b..f47ec25 100644 --- a/control.lua +++ b/control.lua @@ -1,16 +1,18 @@ + +local cmd = "" + function exec_command(player) if not player.admin then player.print('You are not an admin. You may not use this mod. :(') return end - local f, err, cmd + local f, err if player.gui.screen.some_luaconsole then - global.cmd = player.gui.screen.some_luaconsole.input.text + cmd = player.gui.screen.some_luaconsole.input.text end - cmd = global.cmd or "" cmd = cmd:gsub('game%.player([^s])', 'game.players['..player.index..']%1') f, err = loadstring(cmd) @@ -29,7 +31,7 @@ end function toggleGui (player) if player.gui.screen.some_luaconsole then - global.cmd = player.gui.screen.some_luaconsole.input.text + cmd = player.gui.screen.some_luaconsole.input.text player.gui.screen.some_luaconsole.destroy() else frame = player.gui.screen.add{type = 'frame', @@ -45,7 +47,7 @@ function toggleGui (player) } input.word_wrap = true input.style.maximal_height = (player.display_resolution.height/player.display_scale*0.6) - input.text = global.cmd or "" + input.text = cmd horizontal_flow = frame.add{type='flow', direction='horizontal'} horizontal_flow.add{type = 'button', @@ -70,7 +72,6 @@ function toggleGui (player) end - script.on_event(defines.events.on_gui_click, function(event) if event.element.name == 'some_luaconsole_exec' then exec_command(game.players[event.player_index]) diff --git a/info.json b/info.json index d538ef2..bd93651 100644 --- a/info.json +++ b/info.json @@ -1,10 +1,10 @@ { "name": "some-luaconsole", - "version": "1.1.5", + "version": "2.0.0", "title": "Someone's LUA-Console", "author": "someone1337", "homepage": "https://git.somenet.org/factorio/some-luaconsole.git", "description": "Run lua commands without losing achievements. Now remembers input-script. 'game.player' works. By default opens with CONTROL + RIGHTBRACKET. Execute last input-script with CONTROL + ENTER.", - "dependencies": ["base>=1.1.0"], - "factorio_version": "1.1" + "factorio_version": "2.0", + "dependencies": ["base>=2.0.0"] } -- 2.43.0