aboutsummaryrefslogtreecommitdiff
path: root/advtrains/log.lua
blob: d7053a2d6ec8680ae1289d881f02509c3b2bffe8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-- Log accesses to driver stands and changes to switches

advtrains.log = function() end

if minetest.settings:get_bool("advtrains_enable_logging") then
	advtrains.logfile = advtrains.fpath .. "_log"

	local log = io.open(advtrains.logfile, "a+")
	
	function advtrains.log (event, player, pos, data)
	   log:write(os.date()..": "..event.." by "..player.." at "..minetest.pos_to_string(pos).." -- "..(data or "").."\n")
	end
	
	minetest.register_on_shutdown(function()
		log:close()
	end)
end
opt">, e=evtdata} run=true end function iq.mainloop(dtime) timer=timer + math.min(dtime, 0.2) for i=1,#queue do local qe=queue[i] if not qe then table.remove(queue, i) i=i-1 elseif timer>qe.t then local pos, evtdata=queue[i].p, queue[i].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