//pl.disableclientprediction = FALSE;
}
+void GrapplingHookReset(void)
+{
+ if(self.realowner.hook == self)
+ RemoveGrapplingHook(self.owner);
+ else // in any case:
+ remove(self);
+}
+
void GrapplingHookThink();
void GrapplingHook_Stop()
{
pointparticles(particleeffectnum("grapple_impact"), self.origin, '0 0 0', 1);
- sound (self, CHAN_PROJECTILE, "weapons/hook_impact.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CH_SHOTS, "weapons/hook_impact.wav", VOL_BASE, ATTN_NORM);
self.state = 1;
self.think = GrapplingHookThink;
void GrapplingHook_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
{
- if(self.health > 0)
+ if(self.health <= 0)
+ return;
+
+ if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, 0)) // no exceptions
+ return; // g_balance_projectiledamage says to halt
+
+ self.health = self.health - damage;
+
+ print(strcat("hook health ", ftos(self.health), " after ", ftos(damage), " damage... (at time: ", ftos(time), ")\n"));
+
+ if (self.health <= 0)
{
- self.health = self.health - damage;
- if (self.health <= 0)
+ if(attacker != self.realowner)
{
- if(attacker != self.realowner)
- {
- self.realowner.pusher = attacker;
- self.realowner.pushltime = time + autocvar_g_maxpushtime;
- }
- RemoveGrapplingHook(self.realowner);
+ self.realowner.pusher = attacker;
+ self.realowner.pushltime = time + autocvar_g_maxpushtime;
}
+ RemoveGrapplingHook(self.realowner);
}
}
if((arena_roundbased && time < warmup) || (time < game_starttime))
return;
- if(self.freezetag_frozen)
- return;
+ if(self.freezetag_frozen)
+ return;
+
+ if(self.vehicle)
+ return;
makevectors(self.v_angle);
--s;
vs = hook_shotorigin[s];
- // UGLY WORKAROUND: play this on CHAN_WEAPON2 so it can't cut off fire sounds
- sound (self, CHAN_WEAPON2, "weapons/hook_fire.wav", VOL_BASE, ATTN_NORM);
+ // UGLY WORKAROUND: play this on CH_WEAPON_B so it can't cut off fire sounds
+ sound (self, CH_WEAPON_B, "weapons/hook_fire.wav", VOL_BASE, ATTN_NORM);
org = self.origin + self.view_ofs + v_forward * vs_x + v_right * -vs_y + v_up * vs_z;
tracebox(self.origin + self.view_ofs, '-3 -3 -3', '3 3 3', org, MOVE_NORMAL, self);
missile = WarpZone_RefSys_SpawnSameRefSys(self);
missile.owner = missile.realowner = self;
self.hook = missile;
+ missile.reset = GrapplingHookReset;
missile.classname = "grapplinghook";
missile.movetype = MOVETYPE_FLY;
missile.event_damage = GrapplingHook_Damage;
missile.takedamage = DAMAGE_AIM;
missile.damageforcescale = 0;
+ missile.damagedbycontents = (autocvar_g_balance_grapplehook_damagedbycontents);
missile.hook_start = missile.hook_end = missile.origin;