diff --git a/mess/tmpc.lua b/mess/tmpc.lua index dbcef7e..8aa5ec6 100644 --- a/mess/tmpc.lua +++ b/mess/tmpc.lua @@ -282,17 +282,13 @@ local mplayer = { currentScreen = 2, } -local function setupTerminal() - for k, v in pairs(mplayer.colors) do - term.setPaletteColor(v, settings.get("mplayer.colors." .. k)) - end - term.setCursorPos(1, 1) - term.setBackgroundColor(mplayer.colors.bg) - term.setTextColor(mplayer.colors.fg) - term.clear() +for k, v in pairs(mplayer.colors) do + term.setPaletteColor(v, settings.get("mplayer.colors." .. k)) end - -setupTerminal() +term.setCursorPos(1, 1) +term.setBackgroundColor(mplayer.colors.bg) +term.setTextColor(mplayer.colors.fg) +term.clear() local tw, th = term.getSize() parallel.waitForAny( @@ -416,6 +412,11 @@ function() elseif ev == "tape_removed" then mplayer.songs = {} elseif ev == "tape_inserted" then + local seekToAndPlay = nil + if drive.getState() == "PLAYING" then + seekToAndPlay = drive.getPosition() + end + drive.stop() drive.seek(-drive.getSize()) for i = 1, 48 do @@ -431,6 +432,12 @@ function() } end end + + if seekToAndPlay ~= nil then + drive.seek(-drive.getSize()) + drive.seek(seekToAndPlay) + drive.play() + end elseif ev ~= "timer" then if drive.isDummy then local m = term.redirect(peripheral.wrap("right"))