LuaATC: Fix position of error label, use consistent name "LuaATC" instead of "LuaAutomation"

master
orwell96 2021-11-02 23:22:30 +01:00
parent ae152bf5bb
commit 5e27bbdcfe
4 changed files with 12 additions and 10 deletions

View File

@ -14,7 +14,7 @@ end
function ac.after_place_node(pos, player) function ac.after_place_node(pos, player)
local meta=minetest.get_meta(pos) local meta=minetest.get_meta(pos)
meta:set_string("formspec", ac.getform(pos, meta)) meta:set_string("formspec", ac.getform(pos, meta))
meta:set_string("infotext", "LuaAutomation component, unconfigured.") meta:set_string("infotext", "LuaATC component, unconfigured.")
local ph=minetest.pos_to_string(pos) local ph=minetest.pos_to_string(pos)
--just get first available key! --just get first available key!
for en,_ in pairs(atlatc.envs) do for en,_ in pairs(atlatc.envs) do
@ -48,7 +48,7 @@ function ac.getform(pos, meta_p)
.."button[5,0.2;2,1;save;Save]" .."button[5,0.2;2,1;save;Save]"
.."button[7,0.2;3,1;cle;Clear Local Env.]" .."button[7,0.2;3,1;cle;Clear Local Env.]"
.."textarea[0.3,1.5;"..atlatc.CODE_FORM_SIZE..";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.."]" .."label["..atlatc.CODE_FORM_ERRLABELPOS..";"..err.."]"
return form return form
end end
@ -91,9 +91,9 @@ function ac.on_receive_fields(pos, formname, fields, player)
meta:set_string("formspec", ac.getform(pos, meta)) meta:set_string("formspec", ac.getform(pos, meta))
if nodetbl.env then if nodetbl.env then
meta:set_string("infotext", "LuaAutomation component, assigned to environment '"..nodetbl.env.."'") meta:set_string("infotext", "LuaATC component, assigned to environment '"..nodetbl.env.."'")
else else
meta:set_string("infotext", "LuaAutomation component, invalid enviroment set!") meta:set_string("infotext", "LuaATC component, invalid enviroment set!")
end end
end end
@ -101,7 +101,7 @@ function ac.run_in_env(pos, evtdata, customfct_p, ignore_no_code)
local ph=minetest.pos_to_string(pos) local ph=minetest.pos_to_string(pos)
local nodetbl = ac.nodes[ph] local nodetbl = ac.nodes[ph]
if not nodetbl then if not nodetbl then
atwarn("LuaAutomation component at",ph,": Data not in memory! Please visit component and click 'Save'!") atwarn("LuaATC component at",ph,": Data not in memory! Please visit component and click 'Save'!")
return return
end end
@ -111,13 +111,13 @@ function ac.run_in_env(pos, evtdata, customfct_p, ignore_no_code)
end end
if not nodetbl.env or not atlatc.envs[nodetbl.env] then if not nodetbl.env or not atlatc.envs[nodetbl.env] then
atwarn("LuaAutomation component at",ph,": Not an existing environment: "..(nodetbl.env or "<nil>")) atwarn("LuaATC component at",ph,": Not an existing environment: "..(nodetbl.env or "<nil>"))
return false return false
end end
local env = atlatc.envs[nodetbl.env] local env = atlatc.envs[nodetbl.env]
if not nodetbl.code or nodetbl.code=="" then if not nodetbl.code or nodetbl.code=="" then
if not ignore_no_code then if not ignore_no_code then
env:log("warning", "LuaAutomation component at",ph,": No code to run! (insert -- to suppress warning)") env:log("warning", "LuaATC component at",ph,": No code to run! (insert -- to suppress warning)")
end end
return false return false
end end

View File

@ -14,7 +14,7 @@ function r.fire_event(pos, evtdata, appr_internal)
local railtbl = atlatc.active.nodes[ph] local railtbl = atlatc.active.nodes[ph]
if not railtbl then if not railtbl then
atwarn("LuaAutomation ATC interface rail at",ph,": Data not in memory! Please visit position and click 'Save'!") atwarn("LuaATC interface rail at",ph,": Data not in memory! Please visit position and click 'Save'!")
return return
end end
@ -188,7 +188,7 @@ advtrains.register_tracks("default", {
models_prefix="advtrains_dtrack", models_prefix="advtrains_dtrack",
models_suffix=".b3d", models_suffix=".b3d",
shared_texture="advtrains_dtrack_shared_atc.png", shared_texture="advtrains_dtrack_shared_atc.png",
description=atltrans("LuaAutomation ATC Rail"), description=atltrans("LuaATC Rail"),
formats={}, formats={},
get_additional_definiton = function(def, preset, suffix, rotation) get_additional_definiton = function(def, preset, suffix, rotation)
return { return {

View File

@ -14,6 +14,8 @@ minetest.register_privilege("atlatc", { description = "Player can place and modi
--Size of code input forms in X,Y notation. Must be at least 10x10 --Size of code input forms in X,Y notation. Must be at least 10x10
atlatc.CODE_FORM_SIZE = "15,12" atlatc.CODE_FORM_SIZE = "15,12"
--Position of Error Label in Code Form
atlatc.CODE_FORM_ERRLABELPOS = "0,12"
--assertt helper. error if a variable is not of a type --assertt helper. error if a variable is not of a type
function assertt(var, typ) function assertt(var, typ)

View File

@ -7,7 +7,7 @@ end
minetest.register_node("advtrains_luaautomation:oppanel", { minetest.register_node("advtrains_luaautomation:oppanel", {
drawtype = "normal", drawtype = "normal",
tiles={"atlatc_oppanel.png"}, tiles={"atlatc_oppanel.png"},
description = "LuaAutomation operation panel", description = "LuaATC operation panel",
groups = { groups = {
cracky = 1, cracky = 1,
save_in_at_nodedb=1, save_in_at_nodedb=1,