Display output bugfix

This commit is contained in:
Joachim Stolberg 2019-01-01 16:44:13 +01:00
parent 833bf95f9c
commit 063ee294e6
2 changed files with 5 additions and 7 deletions

View File

@ -35,10 +35,7 @@ local function generate_string(sortedList)
default.gui_slots.. default.gui_slots..
"item_image[0,0;1,1;hyperloop:booking]".. "item_image[0,0;1,1;hyperloop:booking]"..
"label[4,0; "..I("Select your destination").."]"} "label[4,0; "..I("Select your destination").."]"}
tRes[2] = "label[1,0.6;"..I("Destination").."]label[5,0.6;".. tRes[2] = "tablecolumns[text,width=20;text,width=6,align=right;text]"
I("Distance").."]label[7,0.6;"..I("Local Info").."]"
tRes[3] = "tablecolumns[text,width=30;text,width=11,align=right;text]"
local stations = {} local stations = {}
for idx,tDest in ipairs(sortedList) do for idx,tDest in ipairs(sortedList) do
@ -52,12 +49,12 @@ local function generate_string(sortedList)
end end
if #stations>0 then if #stations>0 then
tRes[#tRes+1] = "table[0,1;11.5,7;button;"..table.concat(stations, ",").."]" tRes[#tRes+1] = "table[0,1;11.8,7.2;button;"..table.concat(stations, ",").."]"
else else
tRes[#tRes+1] = "button_exit[4,4;3,1;button;Update]" tRes[#tRes+1] = "button_exit[4,4;3,1;button;Update]"
end end
return table.concat(tRes ) return table.concat(tRes)
end end
local function store_station_list(pos, sortedList) local function store_station_list(pos, sortedList)

View File

@ -101,6 +101,7 @@ end
local function display_timer(pos, elapsed) local function display_timer(pos, elapsed)
-- update display with trip data -- update display with trip data
print("display_timer")
local tStation = hyperloop.get_base_station(pos) local tStation = hyperloop.get_base_station(pos)
if tStation then if tStation then
local meta = M(pos) local meta = M(pos)
@ -130,6 +131,7 @@ end
-- place the player, close the door, activate display -- place the player, close the door, activate display
local function on_start_travel(pos, node, clicker) local function on_start_travel(pos, node, clicker)
-- arrival data -- arrival data
local meta = M(pos)
local tDeparture, departure_pos = hyperloop.get_base_station(pos) local tDeparture, departure_pos = hyperloop.get_base_station(pos)
local arrival_pos = hyperloop.get_arrival(departure_pos) local arrival_pos = hyperloop.get_arrival(departure_pos)
if arrival_pos == nil then if arrival_pos == nil then
@ -173,7 +175,6 @@ local function on_start_travel(pos, node, clicker)
hyperloop.block(departure_pos, arrival_pos, atime+10) hyperloop.block(departure_pos, arrival_pos, atime+10)
-- store some data for on_timer() -- store some data for on_timer()
local meta = M(pos)
meta:set_int("arrival_time", atime) meta:set_int("arrival_time", atime)
meta:set_string("lcd_text", text) meta:set_string("lcd_text", text)
minetest.get_node_timer(pos):start(1.0) minetest.get_node_timer(pos):start(1.0)