From: Someone Date: Wed, 23 Oct 2024 14:09:12 +0000 (+0200) Subject: RELEASE 2.0.1 - Global storage should work again + Language file update X-Git-Url: https://git.somenet.org/factorio/some-luaconsole.git/commitdiff_plain?ds=sidebyside RELEASE 2.0.1 - Global storage should work again + Language file update --- diff --git a/changelog.txt b/changelog.txt index a47fe43..e0aa2d1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,11 @@ +--------------------------------------------------------------------------------------------------- +Version: 2.0.1 +Date: 2024-10-23 + + Changed: + - Global storage should work again. + - Language file update. + --------------------------------------------------------------------------------------------------- Version: 2.0.0 Date: 2024-10-21 diff --git a/control.lua b/control.lua index f47ec25..c884a25 100644 --- a/control.lua +++ b/control.lua @@ -1,18 +1,16 @@ - -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 + local f, err, cmd if player.gui.screen.some_luaconsole then - cmd = player.gui.screen.some_luaconsole.input.text + storage.cmd = player.gui.screen.some_luaconsole.input.text end + cmd = storage.cmd or "" cmd = cmd:gsub('game%.player([^s])', 'game.players['..player.index..']%1') f, err = loadstring(cmd) @@ -31,7 +29,7 @@ end function toggleGui (player) if player.gui.screen.some_luaconsole then - cmd = player.gui.screen.some_luaconsole.input.text + storage.cmd = player.gui.screen.some_luaconsole.input.text player.gui.screen.some_luaconsole.destroy() else frame = player.gui.screen.add{type = 'frame', @@ -47,7 +45,7 @@ function toggleGui (player) } input.word_wrap = true input.style.maximal_height = (player.display_resolution.height/player.display_scale*0.6) - input.text = cmd + input.text = storage.cmd or "" horizontal_flow = frame.add{type='flow', direction='horizontal'} horizontal_flow.add{type = 'button', @@ -72,6 +70,7 @@ 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 bd93651..72bf03d 100644 --- a/info.json +++ b/info.json @@ -1,10 +1,12 @@ { "name": "some-luaconsole", - "version": "2.0.0", + "version": "2.0.1", "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.", "factorio_version": "2.0", - "dependencies": ["base>=2.0.0"] + "dependencies": [ + "base>=2.0.0" + ] }