CC: Tweaked

CC: Tweaked

42M Downloads

Add a getType method for the DiskDrive peripheral

ArsiTheFox opened this issue ยท 6 comments

commented

I think adding a getType method for the DiskDrive would be a good addition so we can only allow certain devices through code like:
Disc
Disk
Computer
Turtle
Pocket
Maybe in the isDiskPresent method it could return the type of disk or make a method on its own

commented

I assume that disc is for the vanilla and vanilla-like music discs personally, I would call those records in a getType method for less ambiguity.

commented

I assume that disc is for the vanilla and vanilla-like music discs personally, I would call those records in a getType method for less ambiguity.

Yes definitely

commented

Curious as to the use-case of "only allow certain devices"?

I don't have any objections, but I am worried that people are going to start relying on getType() == "record" or something instead of disk.hasAudio, and that's going to blow up once you have non-default IMedia implementations.

commented

Curious as to the use-case of "only allow certain devices"?

I don't have any objections, but I am worried that people are going to start relying on getType() == "record" or something instead of disk.hasAudio, and that's going to blow up once you have non-default IMedia implementations.

Well because there is no way to differentiate if a computer, pocket computer, or turtle is in the drive you can only check if the item has data

commented

Well, I got that far :p. Just curious as to what you're actually trying to do here.

commented

A good solution would be to just do getType() == "audio" instead of record and have it be that if disk.hasAudio instead of if its record. Solves issue in future new audio media compatibility.

In fact that is exactly what #638 does under the hood it just calls all playable audio sources record