diff options
Diffstat (limited to 'advtrains_luaautomation')
16 files changed, 0 insertions, 245 deletions
diff --git a/advtrains_luaautomation/README.md b/advtrains_luaautomation/README.md index 275653c..275653c 100644..100755 --- a/advtrains_luaautomation/README.md +++ b/advtrains_luaautomation/README.md diff --git a/advtrains_luaautomation/chatcmds.lua b/advtrains_luaautomation/chatcmds.lua deleted file mode 100644 index b6ffaee..0000000 --- a/advtrains_luaautomation/chatcmds.lua +++ /dev/null @@ -1,141 +0,0 @@ ---chatcmds.lua ---Registers commands to modify the init and step code for LuaAutomation - -local function get_init_form(env, pname) - local err = env.init_err or "" - local code = env.init_code or "" - - 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;"..atlatc.CODE_FORM_SIZE..";code;Environment initialization code;"..minetest.formspec_escape(code).."]" - .."label[0.0,9.7;"..err.."]" - return form -end - -core.register_chatcommand("env_setup", { - params = "<environment name>", - description = "Set up and modify AdvTrains LuaAutomation environment", - privs = {atlatc=true}, - func = function(name, param) - local env=atlatc.envs[param] - if not env then return false,"Invalid environment name!" end - minetest.show_formspec(name, "atlatc_envsetup_"..param, get_init_form(env, name)) - return true - end, -}) - -core.register_chatcommand("env_create", { - params = "<environment name>", - description = "Create an AdvTrains LuaAutomation environment", - privs = {atlatc=true}, - func = function(name, param) - if not param or param=="" then return false, "Name required!" end - if string.find(param, "[^a-zA-Z0-9-_]") then return false, "Invalid name (only common characters)" end - if atlatc.envs[param] then return false, "Environment already exists!" end - atlatc.envs[param] = atlatc.env_new(param) - atlatc.envs[param].subscribers = {name} - return true, "Created environment '"..param.."'. Use '/env_setup "..param.."' to define global initialization code, or start building LuaATC components!" - end, -}) -core.register_chatcommand("env_subscribe", { - params = "<environment name>", - description = "Subscribe to the log of an Advtrains LuaATC environment", - privs = {atlatc=true}, - func = function(name, param) - local env=atlatc.envs[param] - if not env then return false,"Invalid environment name!" end - for _,pname in ipairs(env.subscribers) do - if pname==name then - return false, "Already subscribed!" - end - end - table.insert(env.subscribers, name) - return true, "Subscribed to environment '"..param.."'." - end, -}) -core.register_chatcommand("env_unsubscribe", { - params = "<environment name>", - description = "Unubscribe to the log of an Advtrains LuaATC environment", - privs = {atlatc=true}, - func = function(name, param) - local env=atlatc.envs[param] - if not env then return false,"Invalid environment name!" end - for index,pname in ipairs(env.subscribers) do - if pname==name then - table.remove(env.subscribers, index) - return true, "Successfully unsubscribed!" - end - end - return false, "Not subscribed to environment '"..param.."'." - end, -}) -core.register_chatcommand("env_subscriptions", { - params = "[environment name]", - description = "List Advtrains LuaATC environments you are subscribed to (no parameters) or subscribers of an environment (giving an env name).", - privs = {atlatc=true}, - func = function(name, param) - if not param or param=="" then - local none=true - for envname, env in pairs(atlatc.envs) do - for _,pname in ipairs(env.subscribers) do - if pname==name then - none=false - minetest.chat_send_player(name, envname) - end - end - end - if none then - return false, "Not subscribed to any!" - end - return true - end - local env=atlatc.envs[param] - if not env then return false,"Invalid environment name!" end - local none=true - for index,pname in ipairs(env.subscribers) do - none=false - minetest.chat_send_player(name, pname) - end - if none then - return false, "No subscribers!" - end - return true - end, -}) - -minetest.register_on_player_receive_fields(function(player, formname, fields) - - local pname=player:get_player_name() - if not minetest.check_player_privs(pname, {atlatc=true}) then return end - - local envname=string.match(formname, "^atlatc_delconfirm_(.+)$") - if envname and fields.sure=="YES" then - atlatc.envs[envname]=nil - minetest.chat_send_player(pname, "Environment deleted!") - return - end - - envname=string.match(formname, "^atlatc_envsetup_(.+)$") - if not envname then return end - - local env=atlatc.envs[envname] - if not env then return end - - if fields.del then - minetest.show_formspec(pname, "atlatc_delconfirm_"..envname, "field[sure;"..minetest.formspec_escape("SURE TO DELETE ENVIRONMENT "..envname.."? Type YES (all uppercase) to continue or just quit form to cancel.")..";]") - return - end - - env.init_err=nil - if fields.code then - env.init_code=fields.code - end - if fields.run then - env:run_initcode() - minetest.show_formspec(pname, formname, get_init_form(env, pname)) - end -end) diff --git a/advtrains_luaautomation/environment.lua b/advtrains_luaautomation/environment.lua index a6ed2c7..a6ed2c7 100644..100755 --- a/advtrains_luaautomation/environment.lua +++ b/advtrains_luaautomation/environment.lua diff --git a/advtrains_luaautomation/interrupt.lua b/advtrains_luaautomation/interrupt.lua deleted file mode 100644 index 2e54ad8..0000000 --- a/advtrains_luaautomation/interrupt.lua +++ /dev/null @@ -1,73 +0,0 @@ --- interrupt.lua --- implements interrupt queue - ---to be saved: pos and evtdata -local iq={} -local queue={} -local timer=0 -local run=false - -function iq.load(data) - local d=data or {} - queue = d.queue or {} - timer = d.timer or 0 -end -function iq.save() - return {queue = queue, timer=timer} -end - -function iq.has_at_pos(pos) - for i=1,#queue do - local qe=queue[i] - if vector.equals(pos, qe.p) then - return true - end - end - return false -end - -function iq.clear_ints_at_pos(pos) - local i=1 - while i<=#queue do - local qe=queue[i] - if not qe then - table.remove(queue, i) - elseif vector.equals(pos, qe.p) and (qe.e.int or qe.e.ext_int) then - table.remove(queue, i) - else - i=i+1 - end - end -end - -function iq.add(t, pos, evtdata) - queue[#queue+1]={t=t+timer, p=pos, e=evtdata} - run=true -end - -function iq.mainloop(dtime) - timer=timer + math.min(dtime, 0.2) - local i=1 - while i<=#queue do - local qe=queue[i] - if not qe then - table.remove(queue, i) - elseif timer>qe.t then - table.remove(queue, i) - local pos, evtdata=qe.p, qe.e - local node=advtrains.ndb.get_node(pos) - local ndef=minetest.registered_nodes[node.name] - if ndef and ndef.luaautomation and ndef.luaautomation.fire_event then - ndef.luaautomation.fire_event(pos, evtdata) - else - atwarn("[atlatc][interrupt] Couldn't run event",evtdata.type,"on",pos,", something wrong with the node",node) - end - else - i=i+1 - end - end -end - - - -atlatc.interrupt=iq diff --git a/advtrains_luaautomation/mod.conf b/advtrains_luaautomation/mod.conf deleted file mode 100644 index a737603..0000000 --- a/advtrains_luaautomation/mod.conf +++ /dev/null @@ -1,7 +0,0 @@ -name=advtrains_luaautomation -title=Advanced Trains LuaATC -description=Lua control interface to Advanced Trains -author=orwell96 - -depends=advtrains -optional_depends=advtrains_interlocking,advtrains_line_automation,mesecons_switch diff --git a/advtrains_luaautomation/p_display.lua b/advtrains_luaautomation/p_display.lua deleted file mode 100644 index e69de29..0000000 --- a/advtrains_luaautomation/p_display.lua +++ /dev/null diff --git a/advtrains_luaautomation/passive_api.txt b/advtrains_luaautomation/passive_api.txt deleted file mode 100644 index 5ae1df4..0000000 --- a/advtrains_luaautomation/passive_api.txt +++ /dev/null @@ -1,24 +0,0 @@ -Lua Automation - Passive Component API - -Passive components are nodes that do not have code running in them. However, active components can query these and request actions from them. Examples: -Switches -Signals -Displays -Mesecon Transmitter -Those passive components can also be used inside interlocking systems. - -All passive components have a table called 'advtrains' in their node definition and have the group 'save_in_at_nodedb' set, so they work in unloaded chunks. -Example for a switch: -advtrains = { - getstate = function(pos, node) - return "st" - end, - -- OR - getstate = "st", - - setstate = function(pos, node, newstate) - if newstate=="cr" then - advtrains.ndb.swap_node(pos, <corresponding switch alt>) - end - end -}
\ No newline at end of file diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_LED_A.png b/advtrains_luaautomation/textures/atlatc_luacontroller_LED_A.png Binary files differdeleted file mode 100644 index c6182cc..0000000 --- a/advtrains_luaautomation/textures/atlatc_luacontroller_LED_A.png +++ /dev/null diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_LED_B.png b/advtrains_luaautomation/textures/atlatc_luacontroller_LED_B.png Binary files differdeleted file mode 100644 index 04c2da0..0000000 --- a/advtrains_luaautomation/textures/atlatc_luacontroller_LED_B.png +++ /dev/null diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_LED_C.png b/advtrains_luaautomation/textures/atlatc_luacontroller_LED_C.png Binary files differdeleted file mode 100644 index 01f6ae4..0000000 --- a/advtrains_luaautomation/textures/atlatc_luacontroller_LED_C.png +++ /dev/null diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_LED_D.png b/advtrains_luaautomation/textures/atlatc_luacontroller_LED_D.png Binary files differdeleted file mode 100644 index 6c8a26f..0000000 --- a/advtrains_luaautomation/textures/atlatc_luacontroller_LED_D.png +++ /dev/null diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_bottom.png b/advtrains_luaautomation/textures/atlatc_luacontroller_bottom.png Binary files differdeleted file mode 100644 index 7ae955c..0000000 --- a/advtrains_luaautomation/textures/atlatc_luacontroller_bottom.png +++ /dev/null diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_sides.png b/advtrains_luaautomation/textures/atlatc_luacontroller_sides.png Binary files differdeleted file mode 100644 index 40f4b60..0000000 --- a/advtrains_luaautomation/textures/atlatc_luacontroller_sides.png +++ /dev/null diff --git a/advtrains_luaautomation/textures/atlatc_luacontroller_top.png b/advtrains_luaautomation/textures/atlatc_luacontroller_top.png Binary files differdeleted file mode 100644 index a5059af..0000000 --- a/advtrains_luaautomation/textures/atlatc_luacontroller_top.png +++ /dev/null diff --git a/advtrains_luaautomation/textures/atlatc_oppanel.png b/advtrains_luaautomation/textures/atlatc_oppanel.png Binary files differdeleted file mode 100644 index 96eb30e..0000000 --- a/advtrains_luaautomation/textures/atlatc_oppanel.png +++ /dev/null diff --git a/advtrains_luaautomation/textures/atlatc_pcnaming.png b/advtrains_luaautomation/textures/atlatc_pcnaming.png Binary files differdeleted file mode 100644 index 3fccdfc..0000000 --- a/advtrains_luaautomation/textures/atlatc_pcnaming.png +++ /dev/null |