Been playing around with the new API a bit and noticed a few things. Not sure if these are bugs or working as intended.
- Added LuaEntity::get_connected_rail. It takes a table with rail_direction (0 front, 1 back) and rail_connection_direction (0 left, 1 straight, 2 right) and returns a new rail (or nil) following that specification from the given rail entity.
- LuaTrain::front_rail, LuaTrain::back_rail, LuaTrain::rail_direction_from_front_rail and LuaTrain::rail_direction_from_back_rail None of the methods takes any parameters.
The rail_direction_from_front_rail seems to dependent on the locomotives cardinal direction.
Code: Select all
Locodir rail_direction_from_front_rail
North 0
East 0
South 1
West 1
As you can see the rail_direction jumps from 1 to 0. (depending on the LuaEntity.direction of the LuaTrain:front_rail).
I'd expect it to be consistent for the diagonals too, like
Code: Select all
Locodir rail_direction_from_front_rail
NE 0
SE 0
SW 1
NW 1