From 2d84a142e66f76084efcdc18e90fde1a82418714 Mon Sep 17 00:00:00 2001 From: mint Date: Fri, 7 May 2021 02:52:13 -0400 Subject: [PATCH] bug fixing --- rhythmblock.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rhythmblock.lua b/rhythmblock.lua index cfaf80a..aab197c 100644 --- a/rhythmblock.lua +++ b/rhythmblock.lua @@ -56,7 +56,7 @@ function ejectDisc() -- Ejects the disc! How cool is that? stopDisc() disk.eject() elseif disk.isPresent(drive) then -- If there's a disc, it'll be ejected. - disk.eject() + disk.eject(drive) else -- If not it'll report there's no disc. status = noDiscStatus end @@ -87,12 +87,12 @@ function renderEjectButton() -- Renders the Eject button term.setTextColor(buttonColor) term.setCursorPos(centerWidth - 2, centerHeight + 4) term.write(ejectText) - statusPos() end -function statusPos() -- Resets the status position +function statusRender(s) -- Resets the status position term.setCursorPos(1, 1) term.setTextColor(textColor) +term.write(s) end term.clear() @@ -102,6 +102,7 @@ renderEjectButton() -- Rendering the eject button status = defaultStatus -- Setting the value to the default while true do + statusRender(status) local eventData = {os.pullEvent()} local event = eventData[1] @@ -116,13 +117,13 @@ while true do ejectDisc() end elseif event == "monitor_touch" then - if eventData[4] >= centerWidth - 4 and eventData[5] >= centerHeight - 4 and eventData[4] <= centerWidth + 4 and eventData[5] <= centerHeight + 2 then + if eventData[3] >= centerWidth - 4 and eventData[4] >= centerHeight - 4 and eventData[3] <= centerWidth + 4 and eventData[4] <= centerHeight + 2 then if playing == true then stopDisc() else playDisc() end - elseif eventData[4] >= centerWidth - 2 and eventData[5] >= centerHeight + 4 and eventData[4] <= centerWidth + 2 and eventData[5] <= centerHeight + 4 then + elseif eventData[3] >= centerWidth - 2 and eventData[4] >= centerHeight + 4 and eventData[3] <= centerWidth + 2 and eventData[4] <= centerHeight + 4 then ejectDisc() end elseif event == "key_up" then