From 196833527c20e2d70c002c9a388c2096d43c2ae0 Mon Sep 17 00:00:00 2001 From: mint Date: Thu, 6 May 2021 10:22:19 -0400 Subject: [PATCH] rebranding and new stuff! --- README.md | 8 +++++-- rhythmblock.lua | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 rhythmblock.lua diff --git a/README.md b/README.md index a22fb8a..4468f5e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ -# neodj +# Rhythmblock -a GUI version of the dj command in ComputerCraft \ No newline at end of file +a GUI version of the dj command in ComputerCraft + +## WIP + +as of now this is not finished, but fast progress is being made! diff --git a/rhythmblock.lua b/rhythmblock.lua new file mode 100644 index 0000000..c2a66e1 --- /dev/null +++ b/rhythmblock.lua @@ -0,0 +1,58 @@ +accentColor = colors.gray +buttonColor = colors.lightGray +backgroundColor = colors.black + +width, height = term.getSize() +centerWidth = math.round(width / 2) +centerHeight = math.round(width / 2) +peripherals = peripheral.getNames() +playing = false +if #peripherals < 0 then + print "No drive" +else + driveCount = 0 + for n = 1, #peripherals do + local driveCheck = peripherals[n] + if peripheral.getType(driveCheck) == "drive" then + drive = driveCheck + driveCount = driveCount + 1 + end + end + if driveCount > 1 then + print("Too many disk drives. Specify where the disk drive is with the argument -d") + os.exit() + end +end + +status = "" + +function playDisc() + + if disk.isPresent(drive) and disk.hasAudio(drive) then + disk.playAudio(drive) + status = disk.getAudioTitle(drive) + playing = true + elseif disk.isPresent(drive) then + print "Not a music disc" + else + print "No disc" + end +end + +function ejectDisc() + disk.eject() + +end + +function stopDisc() + if playing == true then + disk.stopAudio() + status = "Rhythmblock 0.0.1a" + else + status = "No disc is playing" + end +end + +function renderPlayButton() + paintutils.drawFilledBox(centerWidth - 5, centerHeight - 5, centerWidth + 5, centerHeight + 5 accentColor) +end