Skip to content

Commit

Permalink
#16: Update rail network generation for switches.
Browse files Browse the repository at this point in the history
  • Loading branch information
danports committed May 17, 2020
1 parent 9842a39 commit dad98e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/railrouter/startup
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@ end

function getSwitchConnection(location, switchState)
if location then
return {location = location, switchState = switchState}
return {
location = location.location or location, -- For backwards compatibility with older switches
switchState = switchState,
distance = location.distance,
tags = location.tags
}
end
end

Expand Down
12 changes: 8 additions & 4 deletions src/railswitch/config.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ config = {
location = {
line = "Line",
position = 0,
direction = -1 -- Define continuesTo instead if switch continues to a different line.
-- Define continuesTo instead if switch continues to a different line.
direction = -1
},
divergesTo = {
line = "Line",
position = 0,
direction = 1
location = {
line = "Line",
position = 0,
direction = 1
}
-- Optional: Define distance and tags.
},
switch = {side = "back"},
slowTrack = {side = "right"}
Expand Down

0 comments on commit dad98e7

Please sign in to comment.