From ece026703d2ff0e4ff2d74ae4ac87df443906e74 Mon Sep 17 00:00:00 2001 From: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Date: Wed, 27 Mar 2024 00:03:44 +0000 Subject: [PATCH] Makes lua file upload work with bigger files and standardizes a few file|null (#82202) ## About The Pull Request My lua scripts were hitting the topic byte limit, so this makes file upload of lua scripts able to bypass the topic limit. ## Why It's Good For The Game Removes arbitrary restriction on how big a lua file can be in bytes. ## Changelog :cl: admin: Admins can now run lua files bigger than 36 KB by importing them directly. /:cl: Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com> --- code/modules/admin/verbs/lua/lua_editor.dm | 5 +++++ code/modules/wiremod/core/duplicator.dm | 2 +- tgui/packages/tgui/interfaces/LuaEditor/index.jsx | 9 +-------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/code/modules/admin/verbs/lua/lua_editor.dm b/code/modules/admin/verbs/lua/lua_editor.dm index 03f6e07cac0..9e1b851824b 100644 --- a/code/modules/admin/verbs/lua/lua_editor.dm +++ b/code/modules/admin/verbs/lua/lua_editor.dm @@ -105,6 +105,11 @@ return if(!check_rights_for(usr.client, R_DEBUG)) return + if(action == "runCodeFile") + params["code"] = file2text(input(usr, "Input File") as null|file) + if(isnull(params["code"])) + return + action = "runCode" switch(action) if("newState") var/state_name = params["name"] diff --git a/code/modules/wiremod/core/duplicator.dm b/code/modules/wiremod/core/duplicator.dm index 7b373db6e35..2f248d11a89 100644 --- a/code/modules/wiremod/core/duplicator.dm +++ b/code/modules/wiremod/core/duplicator.dm @@ -233,7 +233,7 @@ GLOBAL_LIST_INIT(circuit_dupe_whitelisted_types, list( var/txt switch(option) if("File") - txt = file2text(input(usr, "Input File") as file|null) + txt = file2text(input(usr, "Input File") as null|file) if("Direct Input") txt = input(usr, "Input JSON", "Input JSON") as text|null diff --git a/tgui/packages/tgui/interfaces/LuaEditor/index.jsx b/tgui/packages/tgui/interfaces/LuaEditor/index.jsx index 3348e9d2cfe..10c17ffbbb4 100644 --- a/tgui/packages/tgui/interfaces/LuaEditor/index.jsx +++ b/tgui/packages/tgui/interfaces/LuaEditor/index.jsx @@ -182,14 +182,7 @@ export class LuaEditor extends Component { title="Input" buttons={ <> - - this.setState({ scriptInput: file }) - } - accept=".lua,.luau" - > - Import - +