Add NetworkSoundEventDef registration to SoundAPI #301
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is it?
This PR adds a way for developers to register
NetworkSoundEventDef
instances to the r2apiContentPack via the SoundAPI along with a few sanity checks for good measure.Why?
Currently under
SoundAPI
there is not a way to add in sounds that are network ready. This utilizes the content pack system to register these at runtime under the R2API content pack which will then allow them to be used with RoR2'sEntitySoundManager
class.How do I use it?
Similar to
ItemAPI
orArtifactAPI
, there are two ways of properly adding aNetworkSoundEventDef
.SoundAPI.AddNetworkedSoundEvent(NetworkedSoundEventDef? networkSoundEventDef)
- allows you to pass in your ownNetworkSoundEventDef
to SoundAPI and if it passes the sanity checks, into the r2apiContentPack. Useful for when you want to save a reference to saidNetworkSoundEventDef
which you can grab the event ID from when you need to pass one intoEntitySoundManager
.SoundAPI.AddNetworkedSoundEvent(string eventName)
- Allows you to pass in the name of the WWise sound event and SoundAPI will create its ownNetworkSoundEventDef
from it. If this passes the sanity checks, it is also added into the r2apiContentPack. This is less useful, as you will have to provide the eventID toEntitySoundManager
when you go to emit the sound via it.