X-Git-Url: http://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fw_grabber.qc;h=0f5a818e144a7588b21e7a665522f8d0086fe654;hp=30937850d4bf3eb18ddcdc2d3156ac86e4f9da7c;hb=b0ed14220ec0a63a70a41bdc65420065ef65d006;hpb=f6fb313876957ca2270250111ba2bb5f9f4024a6 diff --git a/data/qcsrc/server/w_grabber.qc b/data/qcsrc/server/w_grabber.qc index 30937850..0f5a818e 100644 --- a/data/qcsrc/server/w_grabber.qc +++ b/data/qcsrc/server/w_grabber.qc @@ -1,5 +1,5 @@ #ifdef REGISTER_WEAPON -REGISTER_WEAPON(GRABBER, w_grabber, IT_FUEL, 0, WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, 0, "grabber", "grabber", "Grabber"); +REGISTER_WEAPON(GRABBER, w_grabber, IT_FUEL, 0, WEP_FLAG_CANCLIMB | WEP_TYPE_HITSCAN, 0, "grabber", "grabber", "Grabber"); #else .float dmg; .float dmg_edge; @@ -9,6 +9,22 @@ REGISTER_WEAPON(GRABBER, w_grabber, IT_FUEL, 0, WEP_FLAG_CANCLIMB | WEP_TYPE_SPL .float grabber_time_grabbered; .float grabber_time_fueldecrease; +void W_Grabber_UpdateStats(entity e, float shot, float hit) +{ + // this may not be entierly right, but for the time being we're recording the hook accuracy here + // this is likely needed for detecting if the hook has hit (linked to) another person though + if(shot) + { + e.stats_fired[e.weapon - 1] += 1; + e.stat_fired = e.weapon + 64 * floor(e.stats_fired[e.weapon - 1]); + } + if(hit) + { + e.stats_hit[e.weapon - 1] += 1; + e.stat_hit = e.weapon + 64 * floor(e.stats_hit[e.weapon - 1]); + } +} + void W_Grabber_Touch2 (void) { PROJECTILE_TOUCH; @@ -21,13 +37,17 @@ void W_Grabber_Attack2() return; W_SetupShot (self, TRUE, 0, "weapons/grabber_altfire.wav", cvar("g_balance_grabber_secondary_damage")); + W_Grabber_UpdateStats(self, TRUE, FALSE); // the hit is recorded below WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_grabber_secondary_radius"), FALSE, self, ANTILAG_LATENCY(self)); pointparticles(particleeffectnum("grabber_melee"), w_shotorg + w_shotdir * cvar("g_balance_grabber_secondary_radius"), '0 0 0', 1); if (trace_fraction < 1) + { 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); + W_Grabber_UpdateStats(self, FALSE, TRUE); // the shot is recorded above + } if not(self.items & IT_UNLIMITED_WEAPON_AMMO) self.ammo_fuel = self.ammo_fuel - cvar("g_balance_grabber_secondary_ammo");