Hold on... lemme strip some code real quick.
Edited:
C++ to Lua conversion straight from the Source SDK, to restore proper fall damage. :snoop:
This fix is already present in GM+, this is the code straight from it.
// HL2 has 600 gravity by default
// NOTE: The discrete ticks can have quantization error, so these numbers are biased a little to
// make the heights more exact
PLAYER_FATAL_FALL_SPEED = 922.5 // approx 60 feet sqrt( 2 * gravity * 60 * 12 )
PLAYER_MAX_SAFE_FALL_SPEED = 526.5 // approx 20 feet sqrt( 2 * gravity * 20 * 12 )
PLAYER_LAND_ON_FLOATING_OBJECT = 173 // Can fall another 173 in/sec without getting hurt
PLAYER_MIN_BOUNCE_SPEED = 173
PLAYER_FALL_PUNCH_THRESHOLD = 303.0 // won't punch player's screen/make scrape noise unless player falling at least this fast - at least a 76" fall (sqrt( 2 * g * 76))
DAMAGE_FOR_FALL_SPEED = 100.0 / ( PLAYER_FATAL_FALL_SPEED - PLAYER_MAX_SAFE_FALL_SPEED ) // damage per unit per second.
if ( SERVER ) then game.ConsoleCommand( "mp_falldamage 1\n" ) end
//=========================================================
//=========================================================
local function FlPlayerFallDamage( pPlayer, m_flFallVelocity )
local iFallDamage = server_settings.Bool( "mp_falldamage", 1 );
if ( iFallDamage ) then
m_flFallVelocity = m_flFallVelocity - PLAYER_MAX_SAFE_FALL_SPEED;
return m_flFallVelocity * DAMAGE_FOR_FALL_SPEED;
else
return 10;
end
end
hook.Add( "GetFallDamage", "FlPlayerFallDamage", FlPlayerFallDamage )