Improved damage sound effects & visual effects

master
AlmTech 5 years ago
parent f6543260e1
commit 892346db26
  1. 2
      gamemode/core/client/cl_hud.lua
  2. 27
      gamemode/core/server/sv_player_damage.lua
  3. 3
      gamemode/core/server/sv_player_init.lua
  4. 26
      gamemode/settings/sv_settings.lua

@ -58,7 +58,7 @@ function GM:HUDPaint()
end
hook.Add( "RenderScreenspaceEffects", "Quantum_HUD_RenderLowHealth", function()
if( LocalPlayer():Health() / LocalPlayer():GetMaxHealth() <= 0.20 ) then
if( LocalPlayer():Health() / LocalPlayer():GetMaxHealth() <= 0.25 ) then
DrawMotionBlur( 0.4, 0.8, 0.1 )
DrawColorModify( {
[ "$pp_colour_addr" ] = 0,

@ -17,7 +17,7 @@ local damagescales = {
function GM:ScalePlayerDamage( pl, hitgroup, dmginfo ) -- This is used for getting shot etc
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
function GM:GetFallDamage( pl, vel )
@ -26,3 +26,28 @@ function GM:GetFallDamage( pl, vel )
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)

@ -8,6 +8,9 @@
local ply = FindMetaTable( "Player" )
function GM:PlayerSpawn( ply )
ply:SetModel( "models/player/Group03/male_04.mdl" )
if( !ply:GetModel() || !ply:GetModel() == "" ) then
ply:SetupHands()
else

@ -16,3 +16,29 @@ Quantum.Server.Settings.DamageScale = { -- The scale of the damage for each hitg
[HITGROUP_LEFTLEG] = 1,
[HITGROUP_RIGHTLEG] = 1
}
Quantum.Server.Settings.PainSounds = {}
Quantum.Server.Settings.PainSounds.Male = {
"vo/npc/male01/pain01.wav",
"vo/npc/male01/pain02.wav",
"vo/npc/male01/pain03.wav",
"vo/npc/male01/pain04.wav",
"vo/npc/male01/pain05.wav",
"vo/npc/male01/pain06.wav",
"vo/npc/male01/pain07.wav",
"vo/npc/male01/pain08.wav",
"vo/npc/male01/pain09.wav"
}
Quantum.Server.Settings.DamageHurtSoundRepeatChance = 90
Quantum.Server.Settings.IdlePainSounds = {}
Quantum.Server.Settings.IdlePainSounds.Male = {
"vo/npc/male01/moan01.wav",
"vo/npc/male01/moan02.wav",
"vo/npc/male01/moan03.wav",
"vo/npc/male01/moan04.wav",
"vo/npc/male01/moan05.wav"
}

Loading…
Cancel
Save