Fixed bugs

This commit is contained in:
Andrew Lalis 2023-09-12 14:11:57 -04:00
parent a0f6228b6e
commit 71d24820ed
2 changed files with 7 additions and 1 deletions

View File

@ -131,6 +131,7 @@ local function handleNearbyStation()
end end
-- Either wait for the user to choose a route, or go away from the -- Either wait for the user to choose a route, or go away from the
-- station transponder. -- station transponder.
local routeChosen = false
parallel.waitForAny( parallel.waitForAny(
function () function ()
while true do while true do
@ -141,6 +142,7 @@ local function handleNearbyStation()
elseif y > 1 and y - 1 <= #routes then elseif y > 1 and y - 1 <= #routes then
local selectedRoute = routes[y-1] local selectedRoute = routes[y-1]
os.queueEvent("rail_route_selected", selectedRoute) os.queueEvent("rail_route_selected", selectedRoute)
routeChosen = true
return return
end end
end end
@ -148,6 +150,8 @@ local function handleNearbyStation()
end, end,
function () waitForNoStation(name) end function () waitForNoStation(name) end
) )
-- Quit our main loop if the user has chosen a route.
if routeChosen then return end
end end
end end
end end

View File

@ -4,7 +4,8 @@ particular route to another station.
You should add a "station_config.tbl" file containing: You should add a "station_config.tbl" file containing:
{ {
name = "Station name", name = "stationname",
displayName = "Station Name",
range = 8, range = 8,
routes = { routes = {
{name = "First", path = {"A", "B", "C"}}, {name = "First", path = {"A", "B", "C"}},
@ -50,6 +51,7 @@ local config = readConfig()
term.clear() term.clear()
term.setCursorPos(1, 1) term.setCursorPos(1, 1)
print("Running station transponder for \""..config.name.."\".") print("Running station transponder for \""..config.name.."\".")
print(" Display Name: "..config.displayName)
print(" Range: "..config.range.." blocks") print(" Range: "..config.range.." blocks")
print(" Routes:") print(" Routes:")
for i, route in pairs(config.routes) do for i, route in pairs(config.routes) do