aboutsummaryrefslogtreecommitdiff
path: root/advtrains_signals_ks/textures/advtrains_signals_ks_sign_4.png
blob: 21318b32e01942f8413c836e37ed137420f1d19c (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 20 00 00 00 20 01 03 00 00 00 49 b4 e8 .PNG........IHDR.............I..
0020 b7 00 00 00 06 50 4c 54 45 ff ff ff 00 00 00 55 c2 d3 7e 00 00 00 26 49 44 41 54 08 d7 63 60 20 .....PLTE......U..~...&IDAT..c`.
0040 00 3e c0 08 46 38 c1 6c 00 23 d8 e0 04 0f 9c 90 80 13 f6 7f 60 04 83 01 5e 02 0f 00 00 36 7c 09 .>..F8.l.#..........`...^....6|.
0060 33 7a 43 d6 6e 00 00 00 00 49 45 4e 44 ae 42 60 82 3zC.n....IEND.B`.
id='n41' href='#n41'>41 42 43 44 45 46 47
-- Advtrains line automation system

advtrains.lines = {
	-- [station code] = {name=..., owner=...}
	stations = {},
	
	--[[ [new pos hash] = {
		stn = <station code>,
		track = <platform identifier>,
		doors = <door side L,R,C>
		wait = <least wait time>
		reverse = <boolean>
		signal = <position of signal that is the "exit signal" for this platform>
	}]]
	stops = {},
}


local modpath = minetest.get_modpath(minetest.get_current_modname()) .. DIR_DELIM

dofile(modpath.."railwaytime.lua")
dofile(modpath.."scheduler.lua")
dofile(modpath.."stoprail.lua")


function advtrains.lines.load(data)
	if data then
		advtrains.lines.stations = data.stations or {}
		advtrains.lines.stops = data.stops or {}
		advtrains.lines.rwt.set_time(data.rwt_time)
		advtrains.lines.sched.load(data.scheduler_queue)
	end
end

function advtrains.lines.save()
	return {
		stations = advtrains.lines.stations,
		stops = advtrains.lines.stops,
		rwt_time = advtrains.lines.rwt.get_time(),
		scheduler_queue = advtrains.lines.sched.save()
	}
end

function advtrains.lines.step(dtime)
	advtrains.lines.rwt.step(dtime)
	advtrains.lines.sched.run()
end