Code: Select all
game.local_player.surface.create_entity({name="straight-rail", position={0,0}, direction=defines.direction.northeast})
Additionally diagonal rails seem to allow four different diagonal directions (1,3,5,7) (while horizontal/vertical only uses two (0,2)), but creating diagonal rails with directions 1 and 5 or 3 and 7 respectively produces straight rail in the same diagonal direction but both are offset by two tiles.
I've found some old bugreports about blueprints and diagonal rail, but those seem to have been resolved already (possibly in the wrong way?).