X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fw_hook.qc;h=32892d5558b5e6862848740296b7e47a2a6b2050;hb=fa6d11afb076e48b635d146a631879221b6b6991;hp=70fe77814de201e42e9f583d1e7b49c3da89e8a2;hpb=b42a2b0a6c12ccbb208bd8cafb0a8405adbc3ae0;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/w_hook.qc b/qcsrc/server/w_hook.qc index 70fe77814..32892d555 100644 --- a/qcsrc/server/w_hook.qc +++ b/qcsrc/server/w_hook.qc @@ -1,5 +1,5 @@ #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(HOOK, w_hook, IT_CELLS|IT_FUEL, 0, WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, 0, "hookgun", "hook", _("Grappling Hook")) #else #ifdef SVQC .float dmg; @@ -23,7 +23,7 @@ void W_Hook_ExplodeThink (void) f = self.dmg_last - dmg_remaining_next; self.dmg_last = dmg_remaining_next; - RadiusDamage (self, self.owner, self.dmg * f, self.dmg_edge * f, self.dmg_radius, self.owner, self.dmg_force * f, self.projectiledeathtype, world); + RadiusDamage (self, self.realowner, self.dmg * f, self.dmg_edge * f, self.dmg_radius, self.realowner, self.dmg_force * f, self.projectiledeathtype, world); self.projectiledeathtype |= HITTYPE_BOUNCE; //RadiusDamage (self, world, self.dmg * f, self.dmg_edge * f, self.dmg_radius, world, self.dmg_force * f, self.projectiledeathtype, world); @@ -41,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,37 +62,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")); + 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); gren = spawn (); - gren.owner = self; + gren.owner = gren.realowner = 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,42 +125,41 @@ float w_hook(float req) if (time > self.hook_refire) 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"); + W_DecreaseAmmo(ammo_fuel, autocvar_g_balance_hook_primary_fuel, FALSE); 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 ) @@ -168,7 +168,7 @@ float w_hook(float req) { if ( self.ammo_fuel >= (time - self.hook_time_fueldecrease) * hooked_fuel ) { - self.ammo_fuel -= (time - self.hook_time_fueldecrease) * hooked_fuel; + W_DecreaseAmmo(ammo_fuel, (time - self.hook_time_fueldecrease) * hooked_fuel, FALSE); self.hook_time_fueldecrease = time; // decrease next frame again } @@ -185,7 +185,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) @@ -226,6 +226,7 @@ float w_hook(float req) else if (req == WR_SETUP) { weapon_setup(WEP_HOOK); + self.current_ammo = ammo_fuel; self.hook_state &~= HOOK_WAITING_FOR_RELEASE; } else if (req == WR_CHECKAMMO1) @@ -233,11 +234,11 @@ 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_RESETPLAYER) { @@ -255,16 +256,16 @@ 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, CHAN_PROJECTILE, "weapons/hookbomb_impact.wav", VOL_BASE, ATTN_NORM); + sound(self, CH_SHOTS, "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"; + w_deathtypestring = _("%s did the impossible"); else if (req == WR_KILLMESSAGE) - w_deathtypestring = "%s has run into %s's gravity bomb"; + w_deathtypestring = _("%s has run into %s's gravity bomb"); return TRUE; } #endif