Sound functions
convert_sound_id
function convert_sound_id(id: SOUNDID): VANILLA_SOUNDid:SOUNDID
Returns VANILLA_SOUND
function convert_sound_id(sound: VANILLA_SOUND): SOUNDIDsound:VANILLA_SOUND
Returns SOUNDID
create_sound
function create_sound(path: string): CustomSound?path:string
Returns CustomSound? (may be nil)
Loads a sound from disk relative to this script, ownership might be shared with other code that loads the same file. Returns nil if file can't be found
get_sound
function get_sound(path_or_vanilla_sound: string): CustomSound?path_or_vanilla_sound:string
Returns CustomSound? (may be nil)
Gets an existing sound, either if a file at the same path was already loaded or if it is already loaded by the game
play_sound
function play_sound(sound_id: SOUNDID, source_uid: integer): SoundMeta?sound_id:SOUNDIDsource_uid:integer
Returns SoundMeta? (may be nil)
function play_sound(sound: VANILLA_SOUND, source_uid: integer): SoundMeta?sound:VANILLA_SOUNDsource_uid:integer
Returns SoundMeta? (may be nil)
Use source_uid to make the sound be played at the location of that entity, set it -1 to just play it "everywhere"
Returns SoundMeta, beware that the sound can't be stopped (start_over and playing are unavailable). Should only be used for sfx.