X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fw_hook.qc;h=f0310c702e7399967d3226758b217b0d44b06301;hb=b8bf0a16d1c441ae346e4cefcbe80ae4f2937f85;hp=c6644f1003be9867516d17c0db4f15d828af9da3;hpb=278f5440b4272f696c6b6e5bb9bb3139b8b53a11;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/w_hook.qc b/qcsrc/server/w_hook.qc index c6644f100..f0310c702 100644 --- a/qcsrc/server/w_hook.qc +++ b/qcsrc/server/w_hook.qc @@ -1,5 +1,15 @@ #ifdef REGISTER_WEAPON -REGISTER_WEAPON(HOOK, w_hook, IT_CELLS|IT_FUEL, 0, WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, 0, "hookgun", "hook", _("Grappling Hook")) +REGISTER_WEAPON( +/* WEP_##id */ HOOK, +/* function */ w_hook, +/* ammotype */ IT_CELLS|IT_FUEL, +/* impulse */ 0, +/* flags */ WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, +/* rating */ 0, +/* model */ "hookgun", +/* shortname */ "hook", +/* fullname */ _("Grappling Hook") +); #else #ifdef SVQC .float dmg; @@ -56,12 +66,12 @@ void W_Hook_Damage (entity inflictor, entity attacker, float damage, float death { if (self.health <= 0) return; - + if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions - return; // g_projectiles_damage says to halt - + return; // g_projectiles_damage says to halt + self.health = self.health - damage; - + if (self.health <= 0) W_PrepareExplosionByDamage(self.realowner, W_Hook_Explode2); } @@ -94,7 +104,7 @@ 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; @@ -131,7 +141,7 @@ void spawnfunc_weapon_hook (void) float w_hook(float req) { float hooked_time_max, hooked_fuel; - + if (req == WR_AIM) { // ... sorry ... @@ -141,14 +151,14 @@ float w_hook(float req) if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_HOOK)) { if(!self.hook) - if not(self.hook_state & HOOK_WAITING_FOR_RELEASE) - if not(self.hook_state & HOOK_FIRING) + if (!(self.hook_state & HOOK_WAITING_FOR_RELEASE)) + if (!(self.hook_state & HOOK_FIRING)) if (time > self.hook_refire) if (weapon_prepareattack(0, -1)) { W_DecreaseAmmo(ammo_fuel, autocvar_g_balance_hook_primary_fuel, FALSE); self.hook_state |= HOOK_FIRING; - weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hook_primary_animtime, w_ready); + weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hook_primary_animtime, w_ready); } } @@ -167,25 +177,25 @@ float w_hook(float req) self.hook_refire = max(self.hook_refire, time + autocvar_g_balance_hook_primary_refire * W_WeaponRateFactor()); // hook also inhibits health regeneration, but only for 1 second - if not(self.items & IT_UNLIMITED_WEAPON_AMMO) + if (!(self.items & IT_UNLIMITED_WEAPON_AMMO)) self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen); } if(self.hook && self.hook.state == 1) { - hooked_time_max = autocvar_g_balance_hook_primary_hooked_time_max; + hooked_time_max = autocvar_g_balance_hook_primary_hooked_time_max; if (hooked_time_max > 0) { if ( time > self.hook_time_hooked + hooked_time_max ) self.hook_state |= HOOK_REMOVING; } - + hooked_fuel = autocvar_g_balance_hook_primary_hooked_fuel; if (hooked_fuel > 0) { if ( time > self.hook_time_fueldecrease ) { - if not(self.items & IT_UNLIMITED_WEAPON_AMMO) + if (!(self.items & IT_UNLIMITED_WEAPON_AMMO)) { if ( self.ammo_fuel >= (time - self.hook_time_fueldecrease) * hooked_fuel ) { @@ -205,22 +215,22 @@ float w_hook(float req) } else { - self.hook_time_hooked = time; + self.hook_time_hooked = time; self.hook_time_fueldecrease = time + autocvar_g_balance_hook_primary_hooked_time_free; } if (self.BUTTON_CROUCH) { - self.hook_state &~= HOOK_PULLING; + self.hook_state &= ~HOOK_PULLING; if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_HOOK)) - self.hook_state &~= HOOK_RELEASING; + self.hook_state &= ~HOOK_RELEASING; else self.hook_state |= HOOK_RELEASING; } else { self.hook_state |= HOOK_PULLING; - self.hook_state &~= HOOK_RELEASING; + self.hook_state &= ~HOOK_RELEASING; if (self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_HOOK)) { @@ -231,7 +241,7 @@ float w_hook(float req) else { self.hook_state |= HOOK_REMOVING; - self.hook_state &~= HOOK_WAITING_FOR_RELEASE; + self.hook_state &= ~HOOK_WAITING_FOR_RELEASE; } } } @@ -248,7 +258,7 @@ float w_hook(float req) { weapon_setup(WEP_HOOK); self.current_ammo = ammo_fuel; - self.hook_state &~= HOOK_WAITING_FOR_RELEASE; + self.hook_state &= ~HOOK_WAITING_FOR_RELEASE; } else if (req == WR_CHECKAMMO1) { @@ -265,6 +275,14 @@ float w_hook(float req) { self.hook_refire = time; } + else if (req == WR_SUICIDEMESSAGE) + { + return FALSE; + } + else if (req == WR_KILLMESSAGE) + { + return WEAPON_HOOK_MURDER; + } return TRUE; } #endif @@ -277,16 +295,12 @@ float w_hook(float req) org2 = w_org + w_backoff * 2; pointparticles(particleeffectnum("hookbomb_explode"), org2, '0 0 0', 1); if(!w_issilent) - sound(self, CH_SHOTS, "weapons/hookbomb_impact.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, "weapons/hookbomb_impact.wav", VOL_BASE, ATTEN_NORM); } else if(req == WR_PRECACHE) { precache_sound("weapons/hookbomb_impact.wav"); } - else if (req == WR_SUICIDEMESSAGE) - w_deathtypestring = _("%s did the impossible"); - else if (req == WR_KILLMESSAGE) - w_deathtypestring = _("%s was caught in %s's hook gravity bomb"); return TRUE; } #endif