Page 1 of 1
Prototype/Sound#aggregation Documentation
Posted: Thu Jun 18, 2020 1:26 am
by kizrak
I'm trying to find more detailed documentation/explanation of how to use
Prototype/Sound#aggregation
Code: Select all
aggregation
Type: table
Table with the following members:
max_count - uint32 - Mandatory.
progress_threshold - float - Optional. - Default: 1.0 - If count already playing is true, this will determine maximum progress when instance is counted toward playing sounds.
remove - bool - Mandatory.
count_already_playing - bool - Optional. - Default: false - If true already playing sounds are taken into account when checking maxCount.
I assumed I could use this data structure to limit the number of simultaneous instance of this sound, but I've been unable to accomplish this so maybe it is used for something else that I cannot fathom.
Any help would be greatly appreciated!
Thanks,
-Kizrak
Re: Prototype/Sound#aggregation Documentation
Posted: Tue Jun 03, 2025 6:31 pm
by Stargateur
https://lua-api.factorio.com/latest/pro ... ggregation
Code: Select all
aggregation = {
max_count = 1,
remove = true,
count_already_playing = true,
},
Thus I don't see much why `count_already_playing` even exist, what does it count if not already playing sound ???
If I understand all correctly aggregation is not used when you use api such as play_sound in control.lua. It's must be used by the game for build-in sound like
https://lua-api.factorio.com/latest/pro ... ying_sound. So you must code yourself the logic in control.lua to avoid your sound to be played twice.
That would be great if play_sound take into account aggregate value too.
Re: Prototype/Sound#aggregation Documentation
Posted: Tue Jun 03, 2025 7:48 pm
by Donion
Stargateur wrote: Tue Jun 03, 2025 6:31 pm
Thus I don't see much why `count_already_playing` even exist, what does it count if not already playing sound ???
If
count_already_playing is
false the aggregation is applied only on new instances of the sound set to be played on a given tick.
Stargateur wrote: Tue Jun 03, 2025 6:31 pm
That would be great if play_sound take into account aggregate value too.
They do take the aggregation specification into account. With the caveat that the position needs to be specified. If no position is given, the sounds are played globally and global sounds are not aggregated.
Re: Prototype/Sound#aggregation Documentation
Posted: Wed Jun 11, 2025 9:54 pm
by Stargateur
Donion wrote: Tue Jun 03, 2025 7:48 pm
They do take the aggregation specification into account. With the caveat that the position needs to be specified. If no position is given, the sounds are played globally and global sounds are not aggregated.
I added:
But it didn't work.
https://github.com/Stargateur/Parley
Re: Prototype/Sound#aggregation Documentation
Posted: Thu Jun 12, 2025 8:32 am
by Donion
It should be
(without the 's')
I'll test with your mod, there
could be a bug.
Edit: seems to be working as expected once it's changed to
position.
Re: Prototype/Sound#aggregation Documentation
Posted: Thu Jun 12, 2025 3:38 pm
by Stargateur
lua really make my dyslexia hurt badly, I don't know why linter didn't catch it, Thanks a lot