X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fserver%2Fw_laser.qc;h=a7e5c4df7d272f785e3dd2fc7d4e576eed97806e;hb=71b2295b8ed7e2d9a5785467e8d9f65b69494b89;hp=4ce1331931628366bfaf35037c429edfbbe7f3b4;hpb=b3531989fe085982b9fa1b4c8e3a35947936e441;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/w_laser.qc b/qcsrc/server/w_laser.qc index 4ce133193..a7e5c4df7 100644 --- a/qcsrc/server/w_laser.qc +++ b/qcsrc/server/w_laser.qc @@ -1,5 +1,5 @@ #ifdef REGISTER_WEAPON -REGISTER_WEAPON(LASER, w_laser, 0, 1, WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, 0, "laser", "laser", _("Laser")) +REGISTER_WEAPON(LASER, w_laser, 0, 1, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, 0, "laser", "laser", _("Laser")) #else #ifdef SVQC void(float imp) W_SwitchWeapon; @@ -226,16 +226,24 @@ float w_laser(float req) } else if (req == WR_THINK) { - if (self.BUTTON_ATCK) - if (weapon_prepareattack(0, autocvar_g_balance_laser_primary_refire)) + if(autocvar_g_balance_laser_reload_ammo && self.clip_load < 1) // forced reload + weapon_action(self.weapon, WR_RELOAD); + else if (self.BUTTON_ATCK) { - W_Laser_Attack(0); - weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_laser_primary_animtime, w_ready); + if (weapon_prepareattack(0, autocvar_g_balance_laser_primary_refire)) + { + W_DecreaseAmmo(ammo_none, 1, TRUE); + + W_Laser_Attack(0); + weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_laser_primary_animtime, w_ready); + } } - if (self.BUTTON_ATCK2) + else if (self.BUTTON_ATCK2) { if(autocvar_g_balance_laser_secondary) { + W_DecreaseAmmo(ammo_none, 1, TRUE); + if (weapon_prepareattack(0, 0)) { W_Laser_Attack2(); @@ -256,13 +264,25 @@ float w_laser(float req) precache_model ("models/weapons/h_laser.iqm"); precache_sound ("weapons/lasergun_fire.wav"); precache_sound ("weapons/gauntlet_fire.wav"); + //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else } else if (req == WR_SETUP) + { weapon_setup(WEP_LASER); + self.current_ammo = ammo_none; + } else if (req == WR_CHECKAMMO1) + { return TRUE; + } else if (req == WR_CHECKAMMO2) + { return TRUE; + } + else if (req == WR_RELOAD) + { + W_Reload(0, autocvar_g_balance_laser_reload_ammo, autocvar_g_balance_laser_reload_time, "weapons/reload.wav"); + } return TRUE; }; #endif