Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NetworkSoundEventDef registration to SoundAPI #301

Merged
merged 4 commits into from
Aug 12, 2021
Merged

Add NetworkSoundEventDef registration to SoundAPI #301

merged 4 commits into from
Aug 12, 2021

Conversation

KomradeSpectre
Copy link
Contributor

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's EntitySoundManager class.

How do I use it?

Similar to ItemAPI or ArtifactAPI, there are two ways of properly adding a NetworkSoundEventDef.

  1. SoundAPI.AddNetworkedSoundEvent(NetworkedSoundEventDef? networkSoundEventDef) - allows you to pass in your own NetworkSoundEventDef to SoundAPI and if it passes the sanity checks, into the r2apiContentPack. Useful for when you want to save a reference to said NetworkSoundEventDef which you can grab the event ID from when you need to pass one into EntitySoundManager.

  2. SoundAPI.AddNetworkedSoundEvent(string eventName) - Allows you to pass in the name of the WWise sound event and SoundAPI will create its own NetworkSoundEventDef 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 to EntitySoundManager when you go to emit the sound via it.

@KomradeSpectre
Copy link
Contributor Author

Noted, will change.

R2API/SoundAPI.cs Outdated Show resolved Hide resolved
@harbingerofme harbingerofme self-assigned this Aug 12, 2021
@harbingerofme harbingerofme added the enhancement New feature or expansion of a feature label Aug 12, 2021
@tristanmcpherson
Copy link
Member

Looks good! I reviewed it earlier but was waiting for others

@tristanmcpherson tristanmcpherson merged commit ddb4714 into risk-of-thunder:master Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or expansion of a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants