X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fw_hook.qc;h=695ac381fe55afcaeb750f2890e313addb6ef915;hb=8c5c39bee4bc48057f5094d635b80a46b060b207;hp=ba315f96ae45845a68ac1e284c3047d774ac0f1a;hpb=a6608982df09dd6eabf4af28d8c459e267a0b0d3;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/w_hook.qc b/qcsrc/server/w_hook.qc index ba315f96a..695ac381f 100644 --- a/qcsrc/server/w_hook.qc +++ b/qcsrc/server/w_hook.qc @@ -52,6 +52,20 @@ void W_Hook_Explode2 (void) self.movetype = MOVETYPE_NONE; } +void W_Hook_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) +{ + if (self.health <= 0) + return; + + if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions + return; // g_projectiles_damage says to halt + + self.health = self.health - damage; + + if (self.health <= 0) + W_PrepareExplosionByDamage(self.realowner, W_Hook_Explode2); +} + void W_Hook_Touch2 (void) { PROJECTILE_TOUCH; @@ -60,7 +74,7 @@ void W_Hook_Touch2 (void) void W_Hook_Attack2() { - local entity gren; + entity gren; W_DecreaseAmmo(ammo_cells, autocvar_g_balance_hook_secondary_ammo, FALSE); W_SetupShot (self, FALSE, 4, "weapons/hookbomb_fire.wav", CH_WEAPON_A, autocvar_g_balance_hook_secondary_damage); @@ -80,6 +94,12 @@ void W_Hook_Attack2() gren.think = adaptor_think2use_hittype_splash; gren.use = W_Hook_Explode2; gren.touch = W_Hook_Touch2; + + gren.takedamage = DAMAGE_YES; + gren.health = autocvar_g_balance_hook_secondary_health; + gren.damageforcescale = autocvar_g_balance_hook_secondary_damageforcescale; + gren.event_damage = W_Hook_Damage; + gren.damagedbycontents = TRUE; gren.velocity = '0 0 1' * autocvar_g_balance_hook_secondary_speed; if(autocvar_g_projectiles_newton_style) @@ -245,7 +265,7 @@ float w_hook(float req) self.hook_refire = time; } return TRUE; -}; +} #endif #ifdef CSQC float w_hook(float req)