summaryrefslogtreecommitdiff
path: root/src/tool.h
diff options
context:
space:
mode:
authorJames Stevenson <everamzah@gmail.com>2016-07-14 10:07:40 -0400
committerparamat <mat.gregory@virginmedia.com>2016-07-21 05:00:40 +0100
commit97c763158c3efd733bca1b4b46fb82c135df09f7 (patch)
tree45cebdc371bc626e5b2c496b2188876c00852125 /src/tool.h
parent6621daee504bbc6755e0240a5515e16f56199197 (diff)
downloadminetest-97c763158c3efd733bca1b4b46fb82c135df09f7.tar.gz
minetest-97c763158c3efd733bca1b4b46fb82c135df09f7.tar.bz2
minetest-97c763158c3efd733bca1b4b46fb82c135df09f7.zip
lua_api.txt: Remove tooltip checkbox[] element
Diffstat (limited to 'src/tool.h')
0 files changed, 0 insertions, 0 deletions
n95' href='#n95'>95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
-- advtrains_luaautomation/init.lua
-- Lua automation features for advtrains
-- Uses global table 'atlatc' (AdvTrains_LuaATC)

-- Boilerplate to support localized strings if intllib mod is installed.
if minetest.get_modpath("intllib") then
    atltrans = intllib.Getter()
else
    atltrans = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end

--Privilege
--Only trusted players should be enabled to build stuff which can break the server.

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 })

--assertt helper. error if a variable is not of a type
function assertt(var, typ)
	if type(var)~=typ then
		error("Assertion failed, variable has to be of type "..typ)
	end
end

local mp=minetest.get_modpath("advtrains_luaautomation")
if not mp then
	error("Mod name error: Mod folder is not named 'advtrains_luaautomation'!")
end
dofile(mp.."/environment.lua")
dofile(mp.."/interrupt.lua")
dofile(mp.."/active_common.lua")
dofile(mp.."/atc_rail.lua")
dofile(mp.."/operation_panel.lua")
dofile(mp.."/pcnaming.lua")
if mesecon then
	dofile(mp.."/p_mesecon_iface.lua")
end
dofile(mp.."/chatcmds.lua")


local filename=minetest.get_worldpath().."/advtrains_luaautomation"

function atlatc.load()
	local file, err = io.open(filename, "r")
	if not file then
		minetest.log("error", " Failed to read advtrains_luaautomation save data from file "..filename..": "..(err or "Unknown Error"))
	else
		atprint("luaautomation reading file:",filename)
		local tbl = minetest.deserialize(file:read("*a"))
		if type(tbl) == "table" then
			if tbl.version==1 then
				for envname, data in pairs(tbl.envs) do
					atlatc.envs[envname]=atlatc.env_load(envname, data)
				end
				atlatc.active.load(tbl.active)
				atlatc.interrupt.load(tbl.interrupt)
				atlatc.pcnaming.load(tbl.pcnaming)
			end
		else
			minetest.log("error", " Failed to read advtrains_luaautomation save data from file "..filename..": Not a table!")
		end
		file:close()
	end
	-- run init code of all environments
	atlatc.run_initcode()
end


atlatc.save = function()
	--versions:
	-- 1 - Initial save format.
	
	local envdata={}