1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-04 15:43:00 +00:00

Prevent playing music discs with speaker.playSound

I have mixed feelings about speaker.playSound. On one hand, it's pretty
useful to be able to play any sound. On the other, it sometimes feels
... maybe a little too magic?

One particular thing I don't like is that it allows you to play
arbitrary records, which sidesteps both a vanilla mechanic (finding
record discs) and existing CC functionality (disk.playAudio). We now
prevent playing record tracks from the speaker.
This commit is contained in:
Jonathan Coates
2024-03-24 12:53:57 +00:00
parent e154b0db2a
commit 0e5248e5e6
3 changed files with 159 additions and 8 deletions

View File

@@ -29,4 +29,15 @@ class Speaker_Test {
}
}
}
/**
* [SpeakerPeripheral.playSound] will not play records.
*/
@GameTest
fun Will_not_play_record(helper: GameTestHelper) = helper.sequence {
thenOnComputer {
callPeripheral("right", "playSound", SoundEvents.MUSIC_DISC_PIGSTEP.location.toString())
.assertArrayEquals(false)
}
}
}