X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fweapons%2Fselection.qc;h=cfa68dc99e38673b99c2a9863565f5d3e47b306c;hb=c741e6b3f012aa525f23e1df30d1d933b383fbc5;hp=de240ce2ef66997ddbec1bf6d5d50c437f51ee7e;hpb=802d673ea15260b02ce6760839cc40a2a57b21b1;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index de240ce2e..cfa68dc99 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -1,18 +1,18 @@ #include "selection.qh" -#include "../_all.qh" #include "weaponsystem.qh" #include "../t_items.qh" #include "../../common/constants.qh" #include "../../common/util.qh" +#include "../../common/items/item.qh" #include "../../common/weapons/all.qh" +#include "../../common/mutators/mutator/waypoints/waypointsprites.qh" // switch between weapons void Send_WeaponComplain(entity e, float wpn, float type) { msg_entity = e; - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_WEAPONCOMPLAIN); + WriteHeader(MSG_ONE, TE_CSQC_WEAPONCOMPLAIN); WriteByte(MSG_ONE, wpn); WriteByte(MSG_ONE, type); } @@ -24,8 +24,10 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) if(time < self.hasweapon_complain_spam) complain = 0; - if(wpn == WEP_HOOK.m_id && !g_grappling_hook && autocvar_g_nades && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(wpn))) - complain = 0; + // ignore hook button when using other offhand equipment + if (cl.offhand != OFFHAND_HOOK) + if (wpn == WEP_HOOK.m_id && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(wpn))) + complain = 0; if(complain) self.hasweapon_complain_spam = time + 0.2; @@ -47,8 +49,8 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) else { setself(cl); - f = WEP_ACTION(wpn, WR_CHECKAMMO1); - f = f + WEP_ACTION(wpn, WR_CHECKAMMO2); + Weapon w = get_weaponinfo(wpn); + f = w.wr_checkammo1(w) + w.wr_checkammo2(w); // always allow selecting the Mine Layer if we placed mines, so that we can detonate them entity mine; @@ -63,7 +65,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) if (complain) if(IS_REAL_CLIENT(cl)) { - play2(cl, W_Sound("unavailable")); + play2(cl, SND(UNAVAILABLE)); Send_WeaponComplain (cl, wpn, 0); } return false; @@ -107,7 +109,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) Send_WeaponComplain (cl, wpn, 2); } - play2(cl, W_Sound("unavailable")); + play2(cl, SND(UNAVAILABLE)); } return false; } @@ -260,7 +262,10 @@ void W_SwitchWeapon(float imp) else self.selectweapon = imp; // update selectweapon ANYWAY } - else if(!forbidWeaponUse(self)) { WEP_ACTION(self.weapon, WR_RELOAD); } + else if(!forbidWeaponUse(self)) { + Weapon w = get_weaponinfo(self.weapon); + w.wr_reload(w); + } } void W_CycleWeapon(string weaponorder, float dir) @@ -302,7 +307,7 @@ void W_PreviousWeapon(float list) } // previously used if exists and has ammo, (second) best otherwise -void W_LastWeapon(void) +void W_LastWeapon() {SELFPARAM(); if(client_hasweapon(self, self.cnt, true, false)) W_SwitchWeapon(self.cnt);