Skip to content

Commit

Permalink
okay, don't use ACF customs if you dont want your sound data being br…
Browse files Browse the repository at this point in the history
…oken

- ACF customs breaks the 'RegisterEntityModifier' for the sound data by overriding it. This is likely to happen if ACE is loaded before ACF customs.
  • Loading branch information
MartyX5555 committed Sep 10, 2023
1 parent 7069118 commit bbf576b
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lua/weapons/gmod_tool/stools/acfsound.lua
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,13 @@ local function ReplaceSound( _ , Entity , data)
pitch = 100
end

-- Workaround to fix issue with StoreEntityModifier not loading on certain entities
-- For some reason, the naming "acf_replacesound" seems not to work with the "acf_rack" entities on dedicated servers. Changing the identifier for other not sharing some keywords fixed it.
local newdata = {sound, pitch, true}
support.SetSound(Entity, {Sound = sound, Pitch = pitch})
duplicator.StoreEntityModifier( Entity, "ACFCustomSounds", newdata ) -- The new test identifier. The old one doesnt work properly with some ents
duplicator.StoreEntityModifier( Entity, "acf_replacesound", newdata )
end
end

duplicator.RegisterEntityModifier( "ACFCustomSounds", ReplaceSound )
duplicator.RegisterEntityModifier( "acf_replacesound", ReplaceSound ) -- Still calling the old identifier. We don't want old builds to lose their custom sounds if not edited later.
duplicator.RegisterEntityModifier( "acf_replacesound", ReplaceSound )

local function IsReallyValid(trace, ply)
if not trace.Entity:IsValid() then return false end
Expand Down Expand Up @@ -239,7 +235,6 @@ function TOOL:Reload( trace )
support.ResetSound(trace.Entity)

duplicator.ClearEntityModifier( trace.Entity, "acf_replacesound" )
duplicator.ClearEntityModifier( trace.Entity, "ACFCustomSounds" )

return true
end
Expand Down

0 comments on commit bbf576b

Please sign in to comment.