]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
g_vehicle_*_bouncefactor - allow setting bouncyness per vehicle. g_vehicle_*_bouncest...
authorJakob MG <jakob_mg@hotmail.com>
Wed, 26 Oct 2011 07:09:26 +0000 (09:09 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Wed, 26 Oct 2011 07:09:26 +0000 (09:09 +0200)
qcsrc/server/vehicles/racer.qc
qcsrc/server/vehicles/raptor.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/vehicles/vehicles.qc
vehicle_racer.cfg
vehicle_raptor.cfg
vehicle_spiderbot.cfg

index e3c74c5e190c864a1d0832834729d2fc4b534979..ff7f2e483333ff1a318f486f54675333042f8a79 100644 (file)
@@ -66,6 +66,10 @@ float autocvar_g_vehicle_racer_blowup_coredamage;
 float autocvar_g_vehicle_racer_blowup_edgedamage;
 float autocvar_g_vehicle_racer_blowup_forceintensity;
 
+float autocvar_g_vehicle_racer_bouncefactor;
+float autocvar_g_vehicle_racer_bouncestop;
+vector autocvar_g_vehicle_racer_bouncepain;
+
 var vector racer_force_from_tag(string tag_name, float spring_length, float max_power);
 
 void racer_align4point()
@@ -527,6 +531,13 @@ void racer_exit(float eject)
        
     self.owner = world;
 }
+void racer_worldimpact()
+{
+    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);
+
+}
 
 void racer_spawn()
 {
@@ -541,6 +552,10 @@ void racer_spawn()
     self.scale          = 0.5;
 
     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.destvec = autocvar_g_vehicle_racer_bouncepain;
 }
 
 
index 201c186c37947d65ad983efd0b4c67c1f0484120..63509aecd665d655fc63c852413c97e5e6c77900 100644 (file)
@@ -57,6 +57,10 @@ float autocvar_g_vehicle_raptor_shield;
 float autocvar_g_vehicle_raptor_shield_regen;
 float autocvar_g_vehicle_raptor_shield_regen_pause;
 
+float autocvar_g_vehicle_raptor_bouncefactor;
+float autocvar_g_vehicle_raptor_bouncestop;
+vector autocvar_g_vehicle_raptor_bouncepain;
+
 void raptor_spawn();
 float raptor_frame();
 float raptor_takeoff();
@@ -66,7 +70,7 @@ float raptor_takeoff();
 
 float raptor_altitude(float amax)
 {
-       tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * amax), TRUE, self);
+       tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * amax), MOVE_WORLDONLY, self);
     return vlen(self.origin - trace_endpos);
 }
 
@@ -194,26 +198,26 @@ void raptor_enter()
 }
 
 void raptor_land()
-{
-
+{    
     float hgt;
-    
-    hgt = raptor_altitude(512);
+        
+    hgt = raptor_altitude(512);    
     self.velocity = (self.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime);
     self.angles_x *= 0.95;
     self.angles_z *= 0.95;
 
     if(hgt < 128)
-        if(self.frame != 0)
-            self.frame = max(self.frame - 0.25, 0);
+    if(hgt > 0)
+        self.frame = (hgt / 128) * 25;
 
     self.bomb1.gun1.avelocity_y = 90 + ((self.frame / 25) * 2000);
     self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity_y;
 
     if(hgt < 16)
     {
-        self.movetype   = MOVETYPE_TOSS;
-        self.think      = raptor_think;
+        self.movetype = MOVETYPE_TOSS;
+        self.think    = raptor_think;
+        self.frame    = 0;
     }
 
     self.nextthink  = time;
@@ -591,6 +595,13 @@ void raptor_die()
        self.touch     = raptor_blowup;
 }
 
+void raptor_worldimpact()
+{
+    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);
+}
+
 void raptor_spawn()
 {
     self.frame          = 0;
@@ -605,6 +616,10 @@ void raptor_spawn()
 
     setsize(self, RAPTOR_MIN, RAPTOR_MAX );
     self.delay = time;
+        
+    self.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
+    self.bouncestop = autocvar_g_vehicle_raptor_bouncestop;    
+    self.vehicle_worldimpact = raptor_worldimpact;    
 }
 
 // If we dont do this ever now and then, the raptors rotors
index f43ec08e52f35f9a792a172a82c6a9da3e4f0093..903d3b2047ff12468f9077945768b21c83c52f52 100644 (file)
@@ -51,6 +51,11 @@ float autocvar_g_vehicle_spiderbot_rocket_noise;
 float autocvar_g_vehicle_spiderbot_rocket_turnrate;
 float autocvar_g_vehicle_spiderbot_rocket_lifetime;
 
+float autocvar_g_vehicle_spiderbot_bouncefactor;
+float autocvar_g_vehicle_spiderbot_bouncestop;
+vector autocvar_g_vehicle_spiderbot_bouncepain;
+
+
 void spiderbot_exit(float eject);
 void spiderbot_enter();
 void spiderbot_spawn();
@@ -480,7 +485,12 @@ void spiderbot_exit(float eject)
         
     self.owner = world;
 }
-
+void spider_worldimpact()
+{
+    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);    
+}
 void spiderbot_spawn()
 {
     self.frame              = 5;
@@ -496,6 +506,7 @@ void spiderbot_spawn()
 
     setorigin(self, self.pos1 + '0 0 128');
     self.angles = self.pos2;
+    self.vehicle_worldimpact = spider_worldimpact;
 }
 
 void spiderbot_headfade()
index c4e2875380486575ed766684f7def98d1053ff28..908ccc624253cb118cff557a8cde5481b5eeb869 100644 (file)
@@ -376,6 +376,28 @@ float vehicles_crushable(entity e)
     return FALSE;
 }
 
+void vehilces_worldimpact(float _minspeed, float _speedfac, float _maxpain)
+{
+    if(self.play_time < time)
+    {                    
+        float wc, take;
+        wc = vlen(self.velocity - self.oldvelocity);
+        if(_minspeed < wc)
+        {
+            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");
+            
+        }
+    }
+}
+
+.void() vehicle_worldimpact;
 void vehicles_touch()
 {
     // Vehicle currently in use
@@ -384,6 +406,8 @@ void vehicles_touch()
         // Colided with world?
         if(other == world)
         {
+            if(self.vehicle_worldimpact)
+                self.vehicle_worldimpact();
         }
         else
         {
index af6587546def9aa83b5581a4eb2efbc746754923..33fb4140baa7b79a3938cb63029e745f781ab7ef 100644 (file)
@@ -61,4 +61,8 @@ set g_vehicle_racer_blowup_coredamage       250
 set g_vehicle_racer_blowup_edgedamage       15
 set g_vehicle_racer_blowup_forceintensity   250
 
+set g_vehicle_racer_bouncefactor 0.25   // Factor of old velocity to keep after colission
+set g_vehicle_racer_bouncestop 0        // if != 0, New veloctiy after bounce = 0 if new velocity < this
+set g_vehicle_racer_bouncepain "35 2 250" // "minspeed_for_pain speedchange_to_pain_factor max_damage"
+
 set g_vehicle_racer_mass                    900
index e502c8db2ea4952d470127cf0021d3c6111d242a..2a46dd28250be16fad45df4f06cb233780357db2 100644 (file)
@@ -58,4 +58,8 @@ set g_vehicle_raptor_shield             120
 set g_vehicle_raptor_shield_regen       25
 set g_vehicle_raptor_shield_regen_pause 1.5
 
+set g_vehicle_raptor_bouncefactor 0.2
+set g_vehicle_raptor_bouncestop 0
+set g_vehicle_raptor_bouncepain "1 1.5 500"
+
 set g_vehicle_raptor_mass              2200
index 10a09454c65577f19a249219a7144bf25324ce67..bb866037adbd0d4c86b23bd660a9cf8555419aa5 100644 (file)
@@ -55,6 +55,9 @@ set g_vehicle_spiderbot_crush_force       50
 
 set g_vehicle_spiderbot_mass              5000
 
+set g_vehicle_spiderbot_bouncefactor 0   // Factor of old velocity to keep after colission
+set g_vehicle_spiderbot_bouncestop 0        // if != 0, New veloctiy after bounce = 0 if new velocity < this
+set g_vehicle_spiderbot_bouncepain "0 0 0" // "minspeed_for_pain speedchange_to_pain_factor max_damage"
 
 set cl_vehicle_spiderbot_cross_alpha 0.4
 set cl_vehicle_spiderbot_cross_size  1