]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
properly apply damage force via ODE xonotic-v0.6.0
authorRudolf Polzer <divverent@xonotic.org>
Thu, 8 Mar 2012 13:19:55 +0000 (14:19 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Thu, 8 Mar 2012 13:19:55 +0000 (14:19 +0100)
qcsrc/server/g_damage.qc

index bdaeef0a53d19d3ed48ae81cf3468b560350ffb4..f80e3e133c9924b49843c499ec227ef99ec4e58c 100644 (file)
@@ -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);
        }