]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Ignore sky & softtargets for vehicle impact damage. Extand vehile impactdamage to...
authorJakob MG <jakob_mg@hotmail.com>
Tue, 22 Nov 2011 08:58:42 +0000 (09:58 +0100)
committerJakob MG <jakob_mg@hotmail.com>
Tue, 22 Nov 2011 08:58:42 +0000 (09:58 +0100)
qcsrc/server/sv_main.qc
qcsrc/server/vehicles/racer.qc
qcsrc/server/vehicles/raptor.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/vehicles/vehicles.qc

index eb386005d16f16201ba064b01d32e799b1a85bee..6e4b0ccb7a47e6a9e9ba20c9801af2996bff260d 100644 (file)
@@ -128,8 +128,8 @@ void CreatureFrame (void)
                                }
                        }
                }
-
-               self.oldvelocity = self.velocity;
+               
+        self.oldvelocity = self.velocity;
        }
        self = oldself;
 }
index ff7f2e483333ff1a318f486f54675333042f8a79..998736b5f6c2fa39ac74468488cc57416f3b85f7 100644 (file)
@@ -531,12 +531,10 @@ void racer_exit(float eject)
        
     self.owner = world;
 }
-void racer_worldimpact()
+void racer_impact()
 {
-    if(self.play_time < time)
     if(autocvar_g_vehicle_racer_bouncepain_x)
-        vehilces_worldimpact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
-
+        vehilces_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
 }
 
 void racer_spawn()
@@ -554,7 +552,7 @@ void racer_spawn()
     setsize(self, RACER_MIN * 0.5, RACER_MAX * 0.5);
     self.bouncefactor = autocvar_g_vehicle_racer_bouncefactor;
     self.bouncestop = autocvar_g_vehicle_racer_bouncestop;    
-    self.vehicle_worldimpact = racer_worldimpact;
+    self.vehicle_impact = racer_impact;
     //self.destvec = autocvar_g_vehicle_racer_bouncepain;
 }
 
index 63509aecd665d655fc63c852413c97e5e6c77900..f5ecd97e30429fda3cb8d3fb7529ee6ef1c385f4 100644 (file)
@@ -542,6 +542,8 @@ float raptor_frame()
         VEHICLE_UPDATE_PLAYER(shield, raptor);
 
     player.BUTTON_ATCK = player.BUTTON_ATCK2 = player.BUTTON_CROUCH = 0;
+    
+    self = player;
     return 1;
 }
 
@@ -595,11 +597,10 @@ void raptor_die()
        self.touch     = raptor_blowup;
 }
 
-void raptor_worldimpact()
+void raptor_impact()
 {
-    if(self.play_time < time)
     if(autocvar_g_vehicle_raptor_bouncepain_x)
-        vehilces_worldimpact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
+        vehilces_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
 }
 
 void raptor_spawn()
@@ -619,7 +620,7 @@ void raptor_spawn()
         
     self.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
     self.bouncestop = autocvar_g_vehicle_raptor_bouncestop;    
-    self.vehicle_worldimpact = raptor_worldimpact;    
+    self.vehicle_impact = raptor_impact;    
 }
 
 // If we dont do this ever now and then, the raptors rotors
index 903d3b2047ff12468f9077945768b21c83c52f52..79d413e1de27261139a1efcf4d7af3e69d779456 100644 (file)
@@ -485,11 +485,10 @@ void spiderbot_exit(float eject)
         
     self.owner = world;
 }
-void spider_worldimpact()
+void spider_impact()
 {
-    if(self.play_time < time)
     if(autocvar_g_vehicle_spiderbot_bouncepain_x)
-        vehilces_worldimpact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);    
+        vehilces_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);    
 }
 void spiderbot_spawn()
 {
@@ -506,7 +505,7 @@ void spiderbot_spawn()
 
     setorigin(self, self.pos1 + '0 0 128');
     self.angles = self.pos2;
-    self.vehicle_worldimpact = spider_worldimpact;
+    self.vehicle_impact = spider_impact;
 }
 
 void spiderbot_headfade()
index 908ccc624253cb118cff557a8cde5481b5eeb869..c56715e9bc1966d0860d164c133a00f8e97c54dc 100644 (file)
@@ -376,51 +376,47 @@ float vehicles_crushable(entity e)
     return FALSE;
 }
 
-void vehilces_worldimpact(float _minspeed, float _speedfac, float _maxpain)
-{
+void vehilces_impact(float _minspeed, float _speedfac, float _maxpain)
+{    
+    if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
+        return;
+    
     if(self.play_time < time)
     {                    
-        float wc, take;
-        wc = vlen(self.velocity - self.oldvelocity);
+        float wc = vlen(self.velocity - self.oldvelocity);
+        //dprint("oldvel: ", vtos(self.oldvelocity), "\n");
+        //dprint("vel: ", vtos(self.velocity), "\n");
         if(_minspeed < wc)
         {
-            take = min(_speedfac * wc, _maxpain);
+            float take = take = min(_speedfac * wc, _maxpain);
             Damage (self, world, world, take, DEATH_FALL, self.origin, '0 0 0');
             self.play_time = time + 0.25;
             
-            dprint("oldvel: ", vtos(self.oldvelocity), "\n");
-            dprint("vel: ", vtos(self.velocity), "\n");
-            dprint("wc: ", ftos(wc), "\n");
-            dprint("take: ", ftos(take), "\n");
-            
+            //dprint("wc: ", ftos(wc), "\n");
+            //dprint("take: ", ftos(take), "\n");
         }
     }
 }
 
-.void() vehicle_worldimpact;
+.void() vehicle_impact;
 void vehicles_touch()
 {
     // Vehicle currently in use
     if(self.owner)
     {
-        // Colided with world?
-        if(other == world)
-        {
-            if(self.vehicle_worldimpact)
-                self.vehicle_worldimpact();
-        }
-        else
+        if(other != world)
+        if(vehicles_crushable(other))
         {
-            if(other.vehicle_flags & VHF_ISVEHICLE)
-            {
-                //other.velocity += self.velocity * (self.mass / other.mass);
-            }
-            else if(vehicles_crushable(other))
-            {
-                if(vlen(self.velocity) != 0)
-                    Damage(other, self, self.owner, autocvar_g_vehicles_crush_dmg, DEATH_VHCRUSH, '0 0 0', normalize(other.origin - self.origin) * autocvar_g_vehicles_crush_force);
-            }
+            if(vlen(self.velocity) != 0)
+                Damage(other, self, self.owner, autocvar_g_vehicles_crush_dmg, DEATH_VHCRUSH, '0 0 0', normalize(other.origin - self.origin) * autocvar_g_vehicles_crush_force);
+            
+            return; // Dont do selfdamage when hitting "soft targets".
         }
+        
+        if(self.play_time < time)
+        if(self.vehicle_impact)
+            self.vehicle_impact();
+        
         return;
     }