You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
4.0 KiB
Lua
107 lines
4.0 KiB
Lua
2 years ago
|
SoundMaster = SoundMaster or {}
|
||
|
soundtable = {}
|
||
|
function soundtable.Random(data)
|
||
|
math.randomseed(math.random(0,255)*5)
|
||
|
return table.Random(data)
|
||
|
end
|
||
|
/*
|
||
|
stepgravel = "0xFAF102","0xFAF103","0xFAF104","0xFAF105","0xFAF106"
|
||
|
stepsnow = "0xFAF107","0xFAF108","0xFAF109","0xFAF10A","0xFAF10B"
|
||
|
*/
|
||
|
//TODO: Unter-Wasser Sound ["rustsurvival/underwater_lp.wav"]
|
||
|
function SoundMaster.EntityEmitSound(t)
|
||
|
--MsgN(t.SoundName)
|
||
|
--MsgN(t.Entity)
|
||
|
/*if CLIENT and CleanDeathCam.Active then
|
||
|
return
|
||
|
end*/
|
||
|
if t.SoundName == "plats/elevator_move_loop1.wav" then t.SoundName = "common/null.wav" return true end
|
||
|
if t.SoundName == "ambient/water/underwater.wav" then
|
||
|
return false
|
||
|
end
|
||
|
--[[if t.SoundName == "vcmod/surface_grind.wav" then
|
||
|
return false
|
||
|
end--]]
|
||
|
if t.SoundName == "npc/scanner/scanner_photo1.wav" then
|
||
|
t.SoundName = "soundmaster/camera_ac/"..soundtable.Random({
|
||
|
"0x0C4E9EBF","0x1B33E508",
|
||
|
"0x1F6744EF","0x06DAFC36",
|
||
|
"0x08D657CA","0x11AD297B",
|
||
|
"0x098D81BF","0x1114D0AA",
|
||
|
})..".mp3"
|
||
|
return true
|
||
|
end
|
||
|
if string.find(t.SoundName,"physics/") and CLIENT then
|
||
|
if string.find(t.SoundName,"physics/wood/wood_box_footstep") then
|
||
|
t.SoundName = "soundmaster/step_ac/"..soundtable.Random({"0xFAF118","0xFAF119","0xFAF120","0xFAF121","0xFAF122","0xFAF123"})..".mp3"
|
||
|
return true
|
||
|
end
|
||
|
end
|
||
|
if string.find(t.SoundName,"player/footsteps/") and CLIENT then
|
||
|
if LocalPlayer():WaterLevel() > 1 then return false end --Unter-Wasser schritte deaktivieren
|
||
|
local stub = string.sub(t.SoundName,18,-5)
|
||
|
stub = string.sub(stub,0,string.len(stub)-1)
|
||
|
if stub == "grass" then
|
||
|
t.SoundName = "player/newfootsteps/grass"..math.random(1,4)..".wav"
|
||
|
return true
|
||
|
end
|
||
|
if stub == "metal" then
|
||
|
t.SoundName = "player/newfootsteps/metal"..math.random(1,5)..".wav"
|
||
|
return true
|
||
|
end
|
||
|
if stub == "sand" then
|
||
|
t.SoundName = "player/newfootsteps/sand"..math.random(1,5)..".wav"
|
||
|
return true
|
||
|
end
|
||
|
if stub == "wood" then
|
||
|
t.SoundName = "soundmaster/step_ac/"..soundtable.Random({"0xFAF118","0xFAF119","0xFAF120","0xFAF121","0xFAF122","0xFAF123"})..".mp3"
|
||
|
return true
|
||
|
end
|
||
|
if stub == "gravel" then
|
||
|
t.SoundName = "soundmaster/step_ac/"..soundtable.Random({"0xFAF102","0xFAF103","0xFAF104","0xFAF105","0xFAF106"})..".mp3"
|
||
|
return true
|
||
|
end
|
||
|
if stub == "dirt" then
|
||
|
t.SoundName = "soundmaster/step_ac/"..soundtable.Random({"0xFAF0E6","0xFAF0E7","0xFAF0E8","0xFAF0E9","0xFAF101"})..".mp3"
|
||
|
return true
|
||
|
end
|
||
|
if stub == "stone" or stub == "concrete" or stub == "tile" then
|
||
|
t.SoundName = "soundmaster/step_ac/"..soundtable.Random({"0xFAF10C","0xFAF10D","0xFAF10E","0xFAF110","0xFAF111","0xFAF112"})..".mp3"
|
||
|
return true
|
||
|
end
|
||
|
if stub == "slosh" or stub == "wade" then
|
||
|
t.SoundName = "soundmaster/step_ac/"..soundtable.Random({"0xFAF113","0xFAF114","0xFAF115","0xFAF116","0xFAF117"})..".mp3"
|
||
|
return true
|
||
|
end
|
||
|
end
|
||
|
if t.SoundName == "items/flashlight1.wav" then t.SoundName = "rustsurvival/flashlight_toggle.mp3" return true end
|
||
|
if IsValid(t.Entity) then
|
||
|
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
|
||
|
if t.Entity == Entity(0) and string.find(t.SoundName,"explode") then
|
||
|
t.SoundName = "rustsurvival/ambient/a_explosion.mp3"
|
||
|
return true
|
||
|
end
|
||
|
if t.Entity == Entity(0) and string.find(t.SoundName,"ambient") then t.SoundName = "common/null.wav" return true end
|
||
|
if t.Entity:IsVehicle() and string.find(t.SoundName,"explode") then
|
||
|
t.SoundName = "soundmaster/carexplosion_ac/"..soundtable.Random({"0x1D0B27DF","0x0FEDCD9C"})..".mp3"
|
||
|
return true
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
hook.Add("EntityEmitSound","SoundMaster.EntityEmitSound",SoundMaster.EntityEmitSound)
|