multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.4k stars 435 forks source link

Certain sounds don't show up with onClientWorldSound #714

Open moon91210 opened 5 years ago

moon91210 commented 5 years ago

Describe the bug I'm trying to capture the sound effects of weather type 8 but none of the sounds are showing up in the event.

When I use the showsound command, all of the sounds show up in the debug but the event doesn't show anything at all.

Seems like this could be fixed easily as the showsound command already shows all the sounds.

To reproduce

setWeather(8)
addEventHandler('onClientWorldSound', root, function(group, index, x, y, z)
    print(group, index, x, y, z)
end)

Expected behaviour onClientWorldSound should trigger for the same sounds that are shown with showsound

Version 1.5.7

botder commented 5 years ago

image It works?

moon91210 commented 5 years ago

Those are the sounds of rain hitting a vehicle. Any nearby streamed in vehicle will give you those sounds even if you're too far away to hear them.

ArranTuna commented 5 years ago

Try setWeather(8) after the event handler is added - probably because it is one long sound just like that annoying wind sound that you only see pop up in that event after entering and exiting an interior.

moon91210 commented 5 years ago

No change. It's not one long sound because showsound shows all each of the sounds independently and you can mute them independently as well. i.e. the thunder sounds are in group 4, at index 1 and 4. the rain sounds are in group 6 from index 1 to 11. None of these sounds show up in the event.

The sounds botder showed are also in group 6 and start at index 12, these are the only ones showing up in the event but only when there's a vehicle streamed in.

I'm thinking it has to do with the fact that there's probably no 3d position for the rain and thunder sounds, but with the sounds of rain hitting a vehicle there is.

botder commented 5 years ago

See comment here:

https://github.com/multitheftauto/mtasa-blue/blob/67aa83e962b77c65e571457330464ca697bc88e7/Client/mods/deathmatch/logic/CClientGame.cpp#L6496-L6521

CrosRoad95 commented 5 years ago

could you just add possibility to enable this? if someone want spam, let's give it to him

moon91210 commented 5 years ago

thunder sounds don't show up and they don't spam the event. about cancelling the event, you can also use setWorldSoundEnabled instead.

qaisjp commented 5 years ago

TL;DR RxLua and "reactive programming"

Just jotting down this idea I've had: a "Filter" object. (Not saying we should implement this and not saying this is a good idea.)

Just a thought...

CrosRoad95 commented 5 years ago

same situation appear for onClientVehicleCollision, thats why i that's why I want to propose, add setEventFilter( eventName, filter, boolean ) for events that cause spam