TheTermos / mobkit

Entity API for Minetest
MIT License
27 stars 12 forks source link

fix crash with mobkit.make_sound in 5.3-dev #23

Closed NetherEran closed 4 years ago

NetherEran commented 4 years ago

MT 5.3 checks types of values in SimpleSoundSpec tables in minetest.sound_play. This breaks mobkit's feature of passing ranges in sound definitions in mobkit.make_sound, resulting in a crash with a message like this: AsyncErr: ServerThread::run Lua: Invalid field "gain" (expected number got table).

To recreate this crash, install Markov Macaws on MT 5.3 dev-cb9a44e (a slightly older build like sfan5's most recent one might also work) and the current mobkit master. Then spawn a parrot using /spawnentity markov_macaws:macaw. Then wait a little for the parrot to try to make a sound.

This PR fixes this issue by always passing a string as SimpleSoundSpec and leaving the other stuff to the sound parameter table.

TheTermos commented 4 years ago

Seems to be working with stable versions. Thanks.