From: Rudolf Polzer Date: Sat, 30 Oct 2010 18:52:57 +0000 (+0200) Subject: simplify code for falling damage X-Git-Tag: xonotic-v0.1.0preview~229 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fde1d63a10e42e58dc9489d1f00fe1b58bf9d1cf;p=xonotic%2Fxonotic-data.pk3dir.git simplify code for falling damage --- diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index db8bc4bfc..b00c4b4fd 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -488,15 +488,18 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht if(sound_allowed(MSG_BROADCAST, attacker)) if(!DEATH_ISWEAPON(deathtype, WEP_LASER) || attacker != self || self.health < 2 * cvar("g_balance_laser_primary_damage") * cvar("g_balance_selfdamagepercent") + 1) + if(self.health > 1) // exclude pain sounds for laserjumps as long as you aren't REALLY low on health and would die of the next two { - if(self.health > 75) // TODO make a "gentle" version? + if(deathtype == DEATH_FALL) + PlayerSound(playersound_fall, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + else if(self.health > 75) // TODO make a "gentle" version? PlayerSound(playersound_pain100, CHAN_PAIN, VOICETYPE_PLAYERSOUND); else if(self.health > 50) PlayerSound(playersound_pain75, CHAN_PAIN, VOICETYPE_PLAYERSOUND); else if(self.health > 25) PlayerSound(playersound_pain50, CHAN_PAIN, VOICETYPE_PLAYERSOUND); - else if(self.health > 1) + else PlayerSound(playersound_pain25, CHAN_PAIN, VOICETYPE_PLAYERSOUND); } } diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index 3b7d77d58..5b8ca7ff8 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -75,13 +75,7 @@ void CreatureFrame (void) else dm = min((dm - cvar("g_balance_falldamage_minspeed")) * cvar("g_balance_falldamage_factor"), cvar("g_balance_falldamage_maxdamage")); if (dm > 0) - { Damage (self, world, world, dm, DEATH_FALL, self.origin, '0 0 0'); - // this must be allowed to cut the normal pain sounds (played after them and on the same channel) - // there's no way to detect falling damage and prevent the pain sounds for this to be played instead - if(self.health > 0) - PlayerSound(playersound_fall, CHAN_PAIN, VOICETYPE_PLAYERSOUND); - } } maxspeed = cvar("g_maxspeed");