From: Rudolf Polzer Date: Thu, 8 Mar 2012 13:19:55 +0000 (+0100) Subject: properly apply damage force via ODE X-Git-Tag: xonotic-v0.6.0^0 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ae62eb7b0a48758de854556a9f1a1d580df36cfc;p=xonotic%2Fxonotic-data.pk3dir.git properly apply damage force via ODE --- diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index bdaeef0a5..f80e3e133 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -887,7 +887,23 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if (vlen(force)) if (self.classname != "player" || time >= self.spawnshieldtime || g_midair) { - self.velocity = self.velocity + damage_explosion_calcpush(self.damageforcescale * force, self.velocity, autocvar_g_balance_damagepush_speedfactor); + vector farce = damage_explosion_calcpush(self.damageforcescale * force, self.velocity, autocvar_g_balance_damagepush_speedfactor); + if(self.movetype == MOVETYPE_PHYSICS) + { + entity farcent; + farcent = spawn(); + farcent.classname = "farce"; + farcent.enemy = self; + farcent.movedir = farce * 10; + if(self.mass) + farcent.movedir = farcent.movedir * self.mass; + farcent.origin = hitloc; + farcent.forcetype = FORCETYPE_FORCEATPOS; + farcent.nextthink = time + 0.1; + farcent.think = SUB_Remove; + } + else + self.velocity = self.velocity + farce; self.flags &~= FL_ONGROUND; UpdateCSQCProjectile(self); }