modusmogulus/GmodDynamicWeaponReverb

Regarding client modified versions

Closed this issue · 6 comments

Are you open to allowing users to make their own resounds of the mod? If so, would you allow them on the workshop?

Of course, if that's what you guys want. However don't just rip the mod and blindly replace the sounds, because then all the scripts would have to be updated manually every time the main mod gets an update. Here's how you can approach this:

  1. Download the mod from the repo
  2. Do the changes that you want
  3. Run the python script that you got from downloading the repository to generate a lua script with all the sound files. Copy the generated script from lua/autorun/dwr_sounds.lua
  4. Copy the sound directory into a separate mod folder, then create directories lua/autorun and paste in the dwr_sounds.lua file, rename it to something unique (ex. dwr_new_sounds.lua)
  5. Modify dwr_sounds.lua to override the original dwr_reverbFiles global variable. You can do it by hooking into think and checking if dwr_reverbFiles is nil or not. If it's not nil, then override it and remove the hook as it is no longer needed.

Got it. Thank you for your input!

Oh yea just to add you should probably have unique file names for each sound because otherwise they might be overridden in unexpected ways

1mista commented

Where would I go to code for adding another sound position (ex. adding gunshot sounds for mid distance, between close and distant)?

Trying to one-up us, don't you?
You would do it here:

local function getPositionState(pos)

Then you probably will need to modify some logic in
local function playReverb(src, ammotype, isSuppressed, weapon)
because it's very reliant on current states right now.
This is how we get the required files, you can figure out how to place files according to this:

	local reverbOptions = getEntriesStartingWith("dwr" .. "/" .. ammotype .. "/" .. positionState .. "/" .. distanceState .. "/", dwr_reverbFiles)
	local reverbSoundFile = reverbOptions[math.random(#reverbOptions)]
1mista commented

Thank you so much man! And if I implement it before you guys, I'll be happy to share.