Change code so that a recording updates the start buffer infotext

master
Joachim Stolberg 2022-01-24 18:42:06 +01:00
parent 3afac50041
commit 0dcee15782
2 changed files with 6 additions and 1 deletions

View File

@ -37,7 +37,7 @@ local function remote_station_name(pos)
end
end
local function on_punch(pos, node, puncher)
function minecart.update_buffer_infotext(pos)
local name = M(pos):get_string("name")
local dest = remote_station_name(pos)
if dest then
@ -45,6 +45,10 @@ local function on_punch(pos, node, puncher)
else
M(pos):set_string("infotext", name .. ": " .. S("Not connected!"))
end
end
local function on_punch(pos, node, puncher)
minecart.update_buffer_infotext(pos)
M(pos):set_string("formspec", formspec(pos))
minetest.get_node_timer(pos):start(CYCLE_TIME)

View File

@ -125,6 +125,7 @@ function minecart.stop_recording(self, pos, force_exit)
local length = speed * self.runtime
local fmt = S("[minecart] Speed = %u m/s, Time = %u s, Route length = %u m")
minetest.chat_send_player(self.driver, string.format(fmt, speed, self.runtime, length))
minecart.update_buffer_infotext(self.start_pos)
end
elseif #self.checkpoints <= 3 then
minetest.chat_send_player(self.driver, S("[minecart] Your route is too short to record!"))