summaryrefslogtreecommitdiff
path: root/src/unittest/test_nodedef.cpp
Commit message (Expand)AuthorAge
* Modernize source code: last part (#6285)Loïc Blot2017-08-20
* Pass clang-format on various cpp/header files (#5559)Loïc Blot2017-04-23
* Tests: Modularize unit testingkwolekr2015-04-26
id='n22' href='#n22'>22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
-- 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.."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)
	end
end

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

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