aboutsummaryrefslogtreecommitdiff
path: root/advtrains/path.lua
Commit message (Collapse)AuthorAge
* Fix H#69orwell962018-10-17
| | | | Cause was a cascaded crash, original cause was something different
* Add signal safety control override, restructure control systemorwell962018-10-10
|
* Add off-track train flag, fixes wagon object property reset on reversingorwell962018-07-04
|
* Fix bugs found while testingorwell962018-06-14
|
* Fix final bugs and to-do's (u.a.save/load system)orwell962018-06-14
|
* Mainly make collisions and coupling workorwell962018-06-14
| | | | Missing: ATC stuff, yaw problems
* Implement a reverse path lookup for trains instead of an occupations window ↵orwell962018-06-14
| | | | system
* Fix path_dir to actually be an angle, path item deletion and orientation of ↵orwell962018-06-14
| | | | | | | | wagons The occupation system as it is now will change. For each position, I will save the index in the train's path, and implement a callback system. I need this because the occupation window system will not be enough to cover all use cases (e.g. to make a train stop with it's center or back at a certain position, I need 3 different brake distances, which doesn't fit into the scheme)
* Bugfixes part 1orwell962018-06-14
| | | | There's something wrong with the new paths, next time build a path validity checker to trace the issue
* Occupation System, new train steps, still incompleteorwell962018-06-14
|
* Adapt wagons to new path systemorwell962018-06-14
| | | | Still outstanding: trains
* Restructure path systemorwell962018-06-14
| | | | The changes to the path system have not yet been integrated...
* Rewrite rail connection system...orwell962017-12-18
...to support an arbitrary number of connections for rails, which leads to these new features: - switches now get recognized by the trackworker correctly - ability to add real rail crosses During this, I also rewrote the rail registering system and the conway function (important part of path prediction) Note, developers: the track preset format changed, you might need to rewrite them according to the presets in tracks.lua if you wrote your own (possibly breaks advcarts)
"hl kwa">local cn = train.path_cn[index] local travsht = lzbdata.il_shunt local travspd = lzbdata.il_speed if travsht==nil then -- lzbdata has reset travspd = train.speed_restriction travsht = train.is_shunt or false end -- check for signal local asp, spos = il.db.get_ip_signal_asp(pts, cn) -- do ARS if needed local ars_enabled = not train.ars_disable -- Note on ars_disable: -- Theoretically, the ars_disable flag would need to behave like the speed restriction field: it should be -- stored in lzbdata and updated once the train drives over. However, for the sake of simplicity, it is simply -- a value in the train. In this case, this is sufficient because once a train triggers ARS for the first time, -- resetting the path does not matter to the set route and ARS doesn't need to be called again. if spos and ars_enabled then --atdebug(id,"IL Spos (ARS)",spos,asp) local sigd = il.db.get_sigd_for_signal(spos) if sigd then il.ars_check(sigd, train) end end --atdebug("trav: ",pos, cn, asp, spos, "travsht=", lzb.travsht) local lspd if asp then --atdebug(id,"IL Signal",spos, asp, lzbdata, "trainstate", train.speed_restriction, train.is_shunt) local nspd = 0 --interpreting aspect and determining speed to proceed if travsht then --shunt move if asp.shunt then nspd = SHUNT_SPEED_MAX elseif asp.proceed_as_main and asp.main ~= 0 then nspd = asp.main travsht = false end else --train move if asp.main ~= 0 then nspd = asp.main elseif asp.shunt then nspd = SHUNT_SPEED_MAX travsht = true end end -- nspd can now be: 1. !=0: new speed restriction, 2. =0: stop here or 3. nil: keep travspd if nspd then if nspd == -1 then travspd = nil else travspd = nspd end end --atdebug("ns,ts", nspd, travspd) lspd = travspd local udata = {signal_pos = spos} local callback = get_over_function(lspd, travsht) lzbdata.il_shunt = travsht lzbdata.il_speed = travspd --atdebug("new lzbdata",lzbdata) advtrains.lzb_add_checkpoint(train, index, lspd, callback, lzbdata, udata) end end) -- Set the ars_disable flag to the value passed -- Triggers a path invalidation if set to false function advtrains.interlocking.ars_set_disable(train, value) if value then train.ars_disable = true else train.ars_disable = nil minetest.after(0, advtrains.path_invalidate, train) end end