SoundMaster = SoundMaster or {}
function SoundMaster.EntityEmitSound(t)
	if string.find(t.SoundName,"vehicles") then return end
	--MsgN(t.SoundName)
	--MsgN(t.Entity)
	if IsValid(t.Entity) then
		if t.SoundName == "plats/elevator_move_loop1.wav" then t.SoundName == "common/null.wav" return true end
		if t.Entity == Entity(0) and string.find(t.SoundName,"ambient") then t.SoundName = "null.wav" return true end
		if t.Entity:IsPlayer() and t.SoundName == "items/flashlight1.wav" then t.SoundName = "rustsurvival/flashlight_toggle.mp3" return true end
		if t.Entity:IsVehicle() then 
			local replacements = {
				["physics/metal/*"] = {
					"0x00CED401","0x0DF65CA9",
					"0x0F481DDD","0x1AF0B69D",
					"0x1F56FF6A","0x03E4DA2C",
					"0x15E86B1D","0x18B930BF",
					"0x0450C95F","0x16387ED3",
				}
			}
			for i,k in pairs(replacements) do
				if string.find(t.SoundName,i) then
					t.SoundName = "soundmaster/carcrash_ac/"..table.Random(k)..".mp3"
					return true
				end
			end
		end
	end
end
hook.Add("EntityEmitSound","SoundMaster.EntityEmitSound",SoundMaster.EntityEmitSound)
