From c6ad57d5ea017d9891c129184731d35b059afe39 Mon Sep 17 00:00:00 2001 From: Severin Meyer Date: Tue, 21 Jul 2015 12:51:20 +0200 Subject: [PATCH] Make the vehicle stats more consistent. Use ammo2 to represents the percentage of secondary ammo left. --- qcsrc/server/vehicles/racer.qc | 11 +++++++++-- qcsrc/server/vehicles/raptor.qc | 1 + qcsrc/server/vehicles/spiderbot.qc | 2 +- qcsrc/server/vehicles/vehicle.qh | 16 ++++++++-------- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/qcsrc/server/vehicles/racer.qc b/qcsrc/server/vehicles/racer.qc index 545e309e4..aab9c20f6 100644 --- a/qcsrc/server/vehicles/racer.qc +++ b/qcsrc/server/vehicles/racer.qc @@ -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); diff --git a/qcsrc/server/vehicles/raptor.qc b/qcsrc/server/vehicles/raptor.qc index 5c14fb793..46ffea1f8 100644 --- a/qcsrc/server/vehicles/raptor.qc +++ b/qcsrc/server/vehicles/raptor.qc @@ -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) { diff --git a/qcsrc/server/vehicles/spiderbot.qc b/qcsrc/server/vehicles/spiderbot.qc index c2a59fd18..aa4c927be 100644 --- a/qcsrc/server/vehicles/spiderbot.qc +++ b/qcsrc/server/vehicles/spiderbot.qc @@ -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; diff --git a/qcsrc/server/vehicles/vehicle.qh b/qcsrc/server/vehicles/vehicle.qh index 696ea1a59..0dcaa13b7 100644 --- a/qcsrc/server/vehicles/vehicle.qh +++ b/qcsrc/server/vehicles/vehicle.qh @@ -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; -- 2.39.2