@ -17,7 +17,7 @@ local damagescales = {
function GM : ScalePlayerDamage ( pl , hitgroup , dmginfo ) -- This is used for getting shot etc
function GM : ScalePlayerDamage ( pl , hitgroup , dmginfo ) -- This is used for getting shot etc
if ( damagescales [ hitgroup ] ~= nil ) then dmginfo : ScaleDamage ( damagescales [ hitgroup ] ) end
if ( damagescales [ hitgroup ] ~= nil ) then dmginfo : ScaleDamage ( damagescales [ hitgroup ] ) end
Quantum.Debug ( tostring ( pl ) .. " got damaged ( " .. tostring ( hitgroup ) .. " : " .. tostring ( dmginfo ) .. " ) " )
Quantum.Debug ( tostring ( pl ) .. " got damaged ( " .. tostring ( hitgroup ) .. " : " .. tostring ( math.Round ( dmginfo : GetDamage ( ) ) ) .. " ) " )
end
end
function GM : GetFallDamage ( pl , vel )
function GM : GetFallDamage ( pl , vel )
@ -25,4 +25,29 @@ function GM:GetFallDamage( pl, vel )
return vel / 8 -- Makes the player take more "realistic" fall damage
return vel / 8 -- Makes the player take more "realistic" fall damage
end
end
function GM : PlayerDeathSound ( ) return true end
function GM : PlayerDeathSound ( ) return true end
hook.Add ( " EntityTakeDamage " , " Quantum_PlayerDamage_SoundEffect " , function ( pl , dmginfo )
if ( pl : IsPlayer ( ) && dmginfo : GetDamage ( ) >= 25 ) then
local soundlist = {
pain = Quantum.Server . Settings.PainSounds . Male , -- replace later with correct gender for the playermodel/character
idlepain = Quantum.Server . Settings.IdlePainSounds . Male -- same for this one
}
pl : EmitSound ( Quantum.Server . Settings.PainSounds . Male [ math.random ( 1 , # Quantum.Server . Settings.PainSounds . Male ) ] )
if ( timer.Exists ( " Quantum_PlayerHurtSounds_ " .. tostring ( pl ) ) ) then timer.Remove ( " Quantum_PlayerHurtSounds_ " .. tostring ( pl ) ) end -- if it already exists remove it
timer.Create ( " Quantum_PlayerHurtSounds_ " .. tostring ( pl ) , 4 , 0 , function ( )
local rannum = math.random ( 0 , 100 )
if ( rannum >= Quantum.Server . Settings.DamageHurtSoundRepeatChance ) then -- Make the player "moan" for a while when hurt
pl : EmitSound ( Quantum.Server . Settings.IdlePainSounds . Male [ math.random ( 1 , # Quantum.Server . Settings.IdlePainSounds . Male ) ] )
end
end )
timer.Simple ( 60 , function ( )
timer.Remove ( " Quantum_PlayerHurtSounds_ " .. tostring ( pl ) ) -- remove the timer for the player
end )
end
end )