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=f438db70f008805518e89ed36d6058b9fffd1cff;hb=b0ed14220ec0a63a70a41bdc65420065ef65d006;hpb=04b1e07d5d031aee59f093bc550f2a00edb27b81;ds=sidebyside diff --git a/data/qcsrc/server/w_grabber.qc b/data/qcsrc/server/w_grabber.qc index f438db70..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; @@ -18,16 +34,20 @@ void W_Grabber_Touch2 (void) void W_Grabber_Attack2() { if(time < self.weapon_delay) - return FALSE; + 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"); @@ -40,7 +60,7 @@ void spawnfunc_weapon_grabber (void) float w_grabber(float req) { - if(self.eater.classname == "player") // we can't use weapons while in the stomach + if(self.predator.classname == "player") // we can't use weapons while in the stomach { self.grabber_state |= GRABBER_REMOVING; return FALSE;