X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fw_hook.qc;h=e191077b31c28f1c1902beb668cfafd6d3db38d1;hp=7b4eba094df0d558318942fbb8879947102f6097;hb=6fc98cffcb5693d2d430b1eff460016d2e623d93;hpb=072057284763e97d4978beda49de57c80dfbcd8e diff --git a/qcsrc/server/w_hook.qc b/qcsrc/server/w_hook.qc index 7b4eba094..e191077b3 100644 --- a/qcsrc/server/w_hook.qc +++ b/qcsrc/server/w_hook.qc @@ -1,6 +1,7 @@ #ifdef REGISTER_WEAPON REGISTER_WEAPON(HOOK, w_hook, IT_CELLS|IT_FUEL, 0, WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, 0, "hookgun", "hook", "Grappling Hook"); #else +#ifdef SVQC .float dmg; .float dmg_edge; .float dmg_radius; @@ -40,12 +41,12 @@ void W_Hook_Explode2 (void) self.think = W_Hook_ExplodeThink; self.nextthink = time; - self.dmg = cvar("g_balance_hook_secondary_damage"); - self.dmg_edge = cvar("g_balance_hook_secondary_edgedamage"); - self.dmg_radius = cvar("g_balance_hook_secondary_radius"); - self.dmg_force = cvar("g_balance_hook_secondary_force"); - self.dmg_power = cvar("g_balance_hook_secondary_power"); - self.dmg_duration = cvar("g_balance_hook_secondary_duration"); + self.dmg = autocvar_g_balance_hook_secondary_damage; + self.dmg_edge = autocvar_g_balance_hook_secondary_edgedamage; + self.dmg_radius = autocvar_g_balance_hook_secondary_radius; + self.dmg_force = autocvar_g_balance_hook_secondary_force; + self.dmg_power = autocvar_g_balance_hook_secondary_power; + self.dmg_duration = autocvar_g_balance_hook_secondary_duration; self.teleport_time = time; self.dmg_last = 1; self.movetype = MOVETYPE_NONE; @@ -62,36 +63,38 @@ void W_Hook_Attack2() local entity gren; if not(self.items & IT_UNLIMITED_WEAPON_AMMO) - self.ammo_cells = self.ammo_cells - cvar("g_balance_hook_secondary_ammo"); - W_SetupShot (self, FALSE, 4, "weapons/hookbomb_fire.wav", cvar("g_balance_hook_secondary_damage")); + self.ammo_cells = self.ammo_cells - autocvar_g_balance_hook_secondary_ammo; + W_SetupShot (self, FALSE, 4, "weapons/hookbomb_fire.wav", CHAN_WEAPON, autocvar_g_balance_hook_secondary_damage); gren = spawn (); gren.owner = self; gren.classname = "hookbomb"; gren.bot_dodge = TRUE; - gren.bot_dodgerating = cvar("g_balance_hook_secondary_damage"); + gren.bot_dodgerating = autocvar_g_balance_hook_secondary_damage; gren.movetype = MOVETYPE_TOSS; PROJECTILE_MAKETRIGGER(gren); gren.projectiledeathtype = WEP_HOOK | HITTYPE_SECONDARY; setorigin(gren, w_shotorg); setsize(gren, '0 0 0', '0 0 0'); - gren.nextthink = time + cvar("g_balance_hook_secondary_lifetime"); + gren.nextthink = time + autocvar_g_balance_hook_secondary_lifetime; gren.think = adaptor_think2use_hittype_splash; gren.use = W_Hook_Explode2; gren.touch = W_Hook_Touch2; - gren.velocity = '0 0 1' * cvar("g_balance_hook_secondary_speed"); - if(cvar("g_projectiles_newton_style")) + gren.velocity = '0 0 1' * autocvar_g_balance_hook_secondary_speed; + if(autocvar_g_projectiles_newton_style) gren.velocity = gren.velocity + self.velocity; - gren.gravity = cvar("g_balance_hook_secondary_gravity"); + gren.gravity = autocvar_g_balance_hook_secondary_gravity; //W_SetupProjectileVelocity(gren); // just falling down! gren.angles = '0 0 0'; gren.flags = FL_PROJECTILE; CSQCProjectile(gren, TRUE, PROJECTILE_HOOKBOMB, TRUE); + + other = gren; MUTATOR_CALLHOOK(EditProjectile); } void spawnfunc_weapon_hook (void) @@ -124,41 +127,41 @@ float w_hook(float req) if (weapon_prepareattack(0, -1)) { if not(self.items & IT_UNLIMITED_WEAPON_AMMO) - self.ammo_fuel = self.ammo_fuel - cvar("g_balance_hook_primary_fuel"); + self.ammo_fuel = self.ammo_fuel - autocvar_g_balance_hook_primary_fuel; self.hook_state |= HOOK_FIRING; - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hook_primary_animtime"), w_ready); + weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hook_primary_animtime, w_ready); } } if (self.BUTTON_ATCK2) { - if (weapon_prepareattack(1, cvar("g_balance_hook_secondary_refire"))) + if (weapon_prepareattack(1, autocvar_g_balance_hook_secondary_refire)) { W_Hook_Attack2(); - weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_hook_secondary_animtime"), w_ready); + weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hook_secondary_animtime, w_ready); } } if(self.hook) { // if hooked, no bombs, and increase the timer - self.hook_refire = max(self.hook_refire, time + cvar("g_balance_hook_primary_refire")); + self.hook_refire = max(self.hook_refire, time + autocvar_g_balance_hook_primary_refire); // hook also inhibits health regeneration, but only for 1 second if not(self.items & IT_UNLIMITED_WEAPON_AMMO) - self.pauseregen_finished = max(self.pauseregen_finished, time + cvar("g_balance_pause_fuel_regen")); + self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen); } if(self.hook && self.hook.state == 1) { - hooked_time_max = cvar("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 = cvar("g_balance_hook_primary_hooked_fuel"); + hooked_fuel = autocvar_g_balance_hook_primary_hooked_fuel; if (hooked_fuel > 0) { if ( time > self.hook_time_fueldecrease ) @@ -184,7 +187,7 @@ float w_hook(float req) else { self.hook_time_hooked = time; - self.hook_time_fueldecrease = time + cvar("g_balance_hook_primary_hooked_time_free"); + self.hook_time_fueldecrease = time + autocvar_g_balance_hook_primary_hooked_time_free; } if (self.BUTTON_CROUCH) @@ -232,16 +235,12 @@ float w_hook(float req) if(self.hook) return self.ammo_fuel > 0; else - return self.ammo_fuel >= cvar("g_balance_hook_primary_fuel"); + return self.ammo_fuel >= autocvar_g_balance_hook_primary_fuel; } else if (req == WR_CHECKAMMO2) { - return self.ammo_cells >= cvar("g_balance_hook_secondary_ammo"); + return self.ammo_cells >= autocvar_g_balance_hook_secondary_ammo; } - else if (req == WR_SUICIDEMESSAGE) - w_deathtypestring = "did the impossible"; - else if (req == WR_KILLMESSAGE) - w_deathtypestring = "has run into #'s gravity bomb"; else if (req == WR_RESETPLAYER) { self.hook_refire = time; @@ -249,3 +248,26 @@ float w_hook(float req) return TRUE; }; #endif +#ifdef CSQC +float w_hook(float req) +{ + if(req == WR_IMPACTEFFECT) + { + vector org2; + org2 = w_org + w_backoff * 2; + pointparticles(particleeffectnum("hookbomb_explode"), org2, '0 0 0', 1); + if(!w_issilent) + sound(self, CHAN_PROJECTILE, "weapons/hookbomb_impact.wav", VOL_BASE, ATTN_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 has run into %s's gravity bomb"; + return TRUE; +} +#endif +#endif