]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/w_grabber.qc
Many fixes and adaptations to the Accuracy Stats window, and get the Grabber to prope...
[voretournament/voretournament.git] / data / qcsrc / server / w_grabber.qc
index 30937850d4bf3eb18ddcdc2d3156ac86e4f9da7c..0f5a818e144a7588b21e7a665522f8d0086fe654 100644 (file)
@@ -1,5 +1,5 @@
 #ifdef REGISTER_WEAPON\r
-REGISTER_WEAPON(GRABBER, w_grabber, IT_FUEL, 0, WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, 0, "grabber", "grabber", "Grabber");\r
+REGISTER_WEAPON(GRABBER, w_grabber, IT_FUEL, 0, WEP_FLAG_CANCLIMB | WEP_TYPE_HITSCAN, 0, "grabber", "grabber", "Grabber");\r
 #else\r
 .float dmg;\r
 .float dmg_edge;\r
@@ -9,6 +9,22 @@ REGISTER_WEAPON(GRABBER, w_grabber, IT_FUEL, 0, WEP_FLAG_CANCLIMB | WEP_TYPE_SPL
 .float grabber_time_grabbered;\r
 .float grabber_time_fueldecrease;\r
 \r
+void W_Grabber_UpdateStats(entity e, float shot, float hit)\r
+{\r
+       // this may not be entierly right, but for the time being we're recording the hook accuracy here\r
+       // this is likely needed for detecting if the hook has hit (linked to) another person though\r
+       if(shot)\r
+       {\r
+               e.stats_fired[e.weapon - 1] += 1;\r
+               e.stat_fired = e.weapon + 64 * floor(e.stats_fired[e.weapon - 1]);\r
+       }\r
+       if(hit)\r
+       {\r
+               e.stats_hit[e.weapon - 1] += 1;\r
+               e.stat_hit = e.weapon + 64 * floor(e.stats_hit[e.weapon - 1]);\r
+       }\r
+}\r
+\r
 void W_Grabber_Touch2 (void)\r
 {\r
        PROJECTILE_TOUCH;\r
@@ -21,13 +37,17 @@ void W_Grabber_Attack2()
                return;\r
 \r
        W_SetupShot (self, TRUE, 0, "weapons/grabber_altfire.wav", cvar("g_balance_grabber_secondary_damage"));\r
+       W_Grabber_UpdateStats(self, TRUE, FALSE); // the hit is recorded below\r
 \r
        WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_grabber_secondary_radius"), FALSE, self, ANTILAG_LATENCY(self));\r
 \r
        pointparticles(particleeffectnum("grabber_melee"), w_shotorg + w_shotdir * cvar("g_balance_grabber_secondary_radius"), '0 0 0', 1);\r
 \r
        if (trace_fraction < 1)\r
+       {\r
                Damage(trace_ent, self, self, cvar("g_balance_grabber_secondary_damage"), WEP_GRABBER | HITTYPE_SECONDARY, trace_endpos, cvar("g_balance_grabber_secondary_force") * w_shotdir);\r
+               W_Grabber_UpdateStats(self, FALSE, TRUE); // the shot is recorded above\r
+       }\r
 \r
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)\r
                self.ammo_fuel = self.ammo_fuel - cvar("g_balance_grabber_secondary_ammo");\r