- if(autocvar_g_maxspeed > 0 && velocity_len > autocvar_g_maxspeed)
- Damage (self, world, world, 100000, DEATH_SHOOTING_STAR.m_id, self.origin, '0 0 0');
- // play stupid sounds
- if (g_footsteps)
- if (!gameover)
- if (self.flags & FL_ONGROUND)
- if (!self.crouch)
- if (velocity_len > autocvar_sv_maxspeed * 0.6)
- if (!self.deadflag)
- if (time < self.lastground + 0.2)
- {
- if((time > self.nextstep) || (time < (self.nextstep - 10.0)))
- {
- self.nextstep = time + 0.3 + random() * 0.1;
- trace_dphitq3surfaceflags = 0;
- tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 1', MOVE_NOMONSTERS, self);
- /*
- if(trace_fraction == 1)
- dprint("nohit\n");
- else
- dprint(ftos(trace_dphitq3surfaceflags), "\n");
- */
- if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS))
- {
- if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)
- GlobalSound(globalsound_metalstep, CH_PLAYER, VOICETYPE_PLAYERSOUND);
- else
- GlobalSound(globalsound_step, CH_PLAYER, VOICETYPE_PLAYERSOUND);
- }
- }
- }
+void CreatureFrame_FallDamage(entity this)
+{
+ if(!IS_VEHICLE(this) && !(this.flags & FL_PROJECTILE)) // vehicles don't get falling damage
+ {
+ // check for falling damage
+ float velocity_len = vlen(this.velocity);
+ if(!this.hook.state)
+ {
+ float dm = vlen(this.oldvelocity) - velocity_len; // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage.
+ if (IS_DEAD(this))
+ dm = (dm - autocvar_g_balance_falldamage_deadminspeed) * autocvar_g_balance_falldamage_factor;
+ else
+ dm = min((dm - autocvar_g_balance_falldamage_minspeed) * autocvar_g_balance_falldamage_factor, autocvar_g_balance_falldamage_maxdamage);
+ if (dm > 0)
+ Damage (this, world, world, dm, DEATH_FALL.m_id, this.origin, '0 0 0');