Posted 30 November 2013 - 05:50 AM
We got disk.playAudio().
We got disk.stopAudio().
So what about disk.isPlaying()?
The Idea
disk.isPlaying() would be useful if you want to loop the audio from a music disk, or if you want to know when the disk ends. In some cases it would be possible to find the length of the disks by using the title and the Minecraft Wiki, but when you're using a mod like iChun's portal gun mod, it becomes difficult, because mods like these will add additional music disks. Also, when using later versions of minecraft (1.7.2+) you can add additional music disks. With unknown lengths.
An Event
Maybe, disk.isPlaying() isn't that a great idea, because it's a function. In that case, maybe it is an idea to add a event that fires the side of the music disk that stopped playing. And there's another possibility. If disk.playAudio() just returns true or false, you can still know if the disk is playing or not. However, in this case your audio will start over from the beginning.
Examples:
We got disk.stopAudio().
So what about disk.isPlaying()?
The Idea
disk.isPlaying() would be useful if you want to loop the audio from a music disk, or if you want to know when the disk ends. In some cases it would be possible to find the length of the disks by using the title and the Minecraft Wiki, but when you're using a mod like iChun's portal gun mod, it becomes difficult, because mods like these will add additional music disks. Also, when using later versions of minecraft (1.7.2+) you can add additional music disks. With unknown lengths.
An Event
Maybe, disk.isPlaying() isn't that a great idea, because it's a function. In that case, maybe it is an idea to add a event that fires the side of the music disk that stopped playing. And there's another possibility. If disk.playAudio() just returns true or false, you can still know if the disk is playing or not. However, in this case your audio will start over from the beginning.
Examples:
while true do
sEvent, param1, param2, param3 = os.pullEvent()
if sEvent == "disk_stoppedPlaying" then
disk.playAudio( param1 )
end
end
while true do
if disk.hasAudio( "bottom" ) and not disk.isPlaying( "bottom" ) then
disk.playAudio( "bottom" )
end
end
while true do
for n=1,#rs.getSides() do
if disk.hasAudio( rs.getSides()[ n ] ) and not disk.isPlaying(rs.getSides()[ n ] ) then
disk.playAudio( rs.getSides()[ n ] )
end
end
end