aboutsummaryrefslogtreecommitdiff
path: root/advtrains_luaautomation
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2021-03-22 11:23:42 +0100
committerorwell96 <orwell@bleipb.de>2021-03-22 11:23:42 +0100
commit5d372b1cf127733d9addd832f584f05d87437b29 (patch)
treeb9115bac77d8843c259182705fbf848bf852aeac /advtrains_luaautomation
parent4fcc5527707d233535a9ed106cbd90892d95895c (diff)
downloadadvtrains-5d372b1cf127733d9addd832f584f05d87437b29.tar.gz
advtrains-5d372b1cf127733d9addd832f584f05d87437b29.tar.bz2
advtrains-5d372b1cf127733d9addd832f584f05d87437b29.zip
Increase size of LuaATC code input forms to 15x12 units
The current size of the code form is rather limiting as it fills only a small part of the screen. Also adds global constant in init.lua so this can easily adapted in the future
Diffstat (limited to 'advtrains_luaautomation')
-rw-r--r--advtrains_luaautomation/active_common.lua4
-rw-r--r--advtrains_luaautomation/chatcmds.lua4
-rw-r--r--advtrains_luaautomation/init.lua3
3 files changed, 7 insertions, 4 deletions
diff --git a/advtrains_luaautomation/active_common.lua b/advtrains_luaautomation/active_common.lua
index 36cb8cd..9bf8377 100644
--- a/advtrains_luaautomation/active_common.lua
+++ b/advtrains_luaautomation/active_common.lua
@@ -41,13 +41,13 @@ function ac.getform(pos, meta_p)
sel=#envs_asvalues
end
end
- local form = "size[10,10]"
+ local form = "size["..atlatc.CODE_FORM_SIZE.."]"
.."style[code;font=mono]"
.."label[0,-0.1;Environment]"
.."dropdown[0,0.3;3;env;"..table.concat(envs_asvalues, ",")..";"..sel.."]"
.."button[5,0.2;2,1;save;Save]"
.."button[7,0.2;3,1;cle;Clear Local Env.]"
- .."textarea[0.3,1.5;10,9.5;code;Code;"..minetest.formspec_escape(code).."]"
+ .."textarea[0.3,1.5;"..atlatc.CODE_FORM_SIZE..";code;Code;"..minetest.formspec_escape(code).."]"
.."label[0,9.7;"..err.."]"
return form
end
diff --git a/advtrains_luaautomation/chatcmds.lua b/advtrains_luaautomation/chatcmds.lua
index a3e6eb5..b6ffaee 100644
--- a/advtrains_luaautomation/chatcmds.lua
+++ b/advtrains_luaautomation/chatcmds.lua
@@ -5,13 +5,13 @@ local function get_init_form(env, pname)
local err = env.init_err or ""
local code = env.init_code or ""
- local form = "size[10,10]"
+ local form = "size["..atlatc.CODE_FORM_SIZE.."]"
.."style[code;font=mono]"
.."button[0.0,0.2;2.5,1;run;Run Init Code]"
.."button[2.5,0.2;2.5,1;cls;Clear S]"
.."button[5.0,0.2;2.5,1;save;Save]"
.."button[7.5,0.2;2.5,1;del;Delete Env.]"
- .."textarea[0.3,1.5;10,9.5;code;Environment initialization code;"..minetest.formspec_escape(code).."]"
+ .."textarea[0.3,1.5;"..atlatc.CODE_FORM_SIZE..";code;Environment initialization code;"..minetest.formspec_escape(code).."]"
.."label[0.0,9.7;"..err.."]"
return form
end
diff --git a/advtrains_luaautomation/init.lua b/advtrains_luaautomation/init.lua
index a54fb25..b6fe464 100644
--- a/advtrains_luaautomation/init.lua
+++ b/advtrains_luaautomation/init.lua
@@ -16,6 +16,9 @@ atlatc = { envs = {}}
minetest.register_privilege("atlatc", { description = "Player can place and modify LUA ATC components. Grant with care! Allows to execute bad LUA code.", give_to_singleplayer = false, default= false })
+--Size of code input forms in X,Y notation. Must be at least 10x10
+atlatc.CODE_FORM_SIZE = "15,12"
+
--assertt helper. error if a variable is not of a type
function assertt(var, typ)
if type(var)~=typ then