]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make the vehicle stats more consistent. Use ammo2 to represents the percentage of...
authorSeverin Meyer <sev.ch@web.de>
Tue, 21 Jul 2015 10:51:20 +0000 (12:51 +0200)
committerSeverin Meyer <sev.ch@web.de>
Tue, 21 Jul 2015 10:51:20 +0000 (12:51 +0200)
qcsrc/server/vehicles/racer.qc
qcsrc/server/vehicles/raptor.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/vehicles/vehicle.qh

index 545e309e4fecc1720b76df3e8a13b317602e563c..aab9c20f6c3d72c31e5a84e9dc958d603031ad9a 100644 (file)
@@ -410,19 +410,26 @@ float racer_frame()
         racer.delay = time + 0.3;
 
         if(racer.misc_bulletcounter == 1)
+        {
             racer_fire_rocket("tag_rocket_r", (racer.lock_strength == 1 && racer.lock_target) ? racer.lock_target : world);
+            player.vehicle_ammo2 = 50;
+        }
         else if(racer.misc_bulletcounter == 2)
         {
             racer_fire_rocket("tag_rocket_l", (racer.lock_strength == 1 && racer.lock_target) ? racer.lock_target : world);
             racer.lock_strength  = 0;
             racer.lock_target    = world;
             racer.misc_bulletcounter = 0;
-
             racer.delay = time + autocvar_g_vehicle_racer_rocket_refire;
             racer.lip = time;
+            player.vehicle_ammo2 = 0;
         }
     }
-    player.vehicle_reload1 = bound(0, 100 * ((time - racer.lip) / (racer.delay - racer.lip)), 100);
+    else
+        if(racer.misc_bulletcounter == 0)
+            player.vehicle_ammo2 = 100;
+
+    player.vehicle_reload2 = bound(0, 100 * ((time - racer.lip) / (racer.delay - racer.lip)), 100);
 
     if(racer.vehicle_flags  & VHF_SHIELDREGEN)
         vehicles_regen(racer.dmg_time, vehicle_shield, autocvar_g_vehicle_racer_shield, autocvar_g_vehicle_racer_shield_regen_pause, autocvar_g_vehicle_racer_shield_regen, frametime, true);
index 5c14fb7935d02f87fc9febfb287d1583f259a0f5..46ffea1f8d111afeec5ac1482264910907221880 100644 (file)
@@ -653,6 +653,7 @@ float raptor_frame()
 
     raptor.bomb1.alpha = raptor.bomb2.alpha = (time - raptor.lip) / (raptor.delay - raptor.lip);
     player.vehicle_reload2 = bound(0, raptor.bomb1.alpha * 100, 100);
+    player.vehicle_ammo2 = (player.vehicle_reload2 == 100) ? 100 : 0;
 
     if(self.bomb1.cnt < time)
     {
index c2a59fd18363c36d8aebb01d7ed3f920ce759016..aa4c927be41c29ed356f4d9b4b5c219ef5e4d934 100644 (file)
@@ -538,7 +538,7 @@ float spiderbot_frame()
         vehicles_regen(spider.dmg_time, vehicle_health, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_health_regen, frametime, false);
 
     player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0;
-    player.vehicle_ammo2 = spider.tur_head.frame;
+    player.vehicle_ammo2 = (9 - spider.tur_head.frame) / 8 * 100; // Percentage, like ammo1
 
     if(spider.gun2.cnt <= time)
         player.vehicle_reload2 = 100;
index 696ea1a59fe2eadf896966fad727fcf20cc59474..0dcaa13b7ba8aae1d895173bbda6852e7188b39c 100644 (file)
@@ -153,14 +153,14 @@ const int VHF_PLAYERSLOT    = 16384;    /// This ent is a player slot on a multi
 .entity gunner1;
 .entity gunner2;
 
-.float vehicle_health;      /// If self is player this is 0..100 indicating precentage of health left on vehicle. If self is vehile, this is the real health value.
-.float vehicle_energy;      /// If self is player this is 0..100 indicating precentage of energy left on vehicle. If self is vehile, this is the real energy value.
-.float vehicle_shield;      /// If self is player this is 0..100 indicating precentage of shield left on vehicle. If self is vehile, this is the real shield value.
-
-.float vehicle_ammo1;   /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real ammo1 value.
-.float vehicle_reload1; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real reload1 value.
-.float vehicle_ammo2;   /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real ammo2 value.
-.float vehicle_reload2; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real reload2 value.
+.float vehicle_health;  /// If self is player this is 0..100 indicating precentage of health left on vehicle. If self is vehile, this is the real health value.
+.float vehicle_energy;  /// If self is player this is 0..100 indicating precentage of energy left on vehicle. If self is vehile, this is the real energy value.
+.float vehicle_shield;  /// If self is player this is 0..100 indicating precentage of shield left on vehicle. If self is vehile, this is the real shield value.
+
+.float vehicle_ammo1;   /// If self is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already stored in vehicle_energy. If self is vehile, this is the real ammo1 value.
+.float vehicle_reload1; /// If self is player this is 0..100 indicating percentage of primary reload status. If self is vehile, this is the real reload1 value.
+.float vehicle_ammo2;   /// If self is player this is 0..100 indicating percentage of secondary ammo left. If self is vehile, this is the real ammo2 value.
+.float vehicle_reload2; /// If self is player this is 0..100 indicating percentage of secondary reload status. If self is vehile, this is the real reload2 value.
 
 .float sound_nexttime;
 const float VOL_VEHICLEENGINE = 1;