X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fweapons%2Fselection.qc;h=12ffbb9b49bd17d2f5f664bd824dc99f97352767;hb=939f709e0b7aef15091c56a824f12732262c00f0;hp=d26ed831fbf05b7e4b427c6833705e97c80814b9;hpb=fbb52b893f7be6bf4073f1853761c4f2fc11a343;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index d26ed831f..12ffbb9b4 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -1,11 +1,10 @@ // switch between weapons -void Send_WeaponComplain(entity e, float wpn, string wpnname, float type) +void Send_WeaponComplain(entity e, float wpn, float type) { msg_entity = e; WriteByte(MSG_ONE, SVC_TEMPENTITY); WriteByte(MSG_ONE, TE_CSQC_WEAPONCOMPLAIN); WriteByte(MSG_ONE, wpn); - WriteString(MSG_ONE, wpnname); WriteByte(MSG_ONE, type); } @@ -58,7 +57,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) if(IS_REAL_CLIENT(cl)) { play2(cl, "weapons/unavailable.wav"); - Send_WeaponComplain (cl, wpn, W_Name(wpn), 0); + Send_WeaponComplain (cl, wpn, 0); } return FALSE; } @@ -71,26 +70,22 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) // Report Proper Weapon Status / Modified Weapon Ownership Message if (weaponsInMap & WepSet_FromWeapon(wpn)) { - Send_WeaponComplain(cl, wpn, W_Name(wpn), 1); + Send_WeaponComplain(cl, wpn, 1); if(autocvar_g_showweaponspawns) { entity e; - string s; - - e = get_weaponinfo(wpn); - s = e.model2; for(e = world; (e = findfloat(e, weapon, wpn)); ) { - if(e.classname == "droppedweapon") + if(e.classname == "droppedweapon" && autocvar_g_showweaponspawns < 2) continue; if(!(e.flags & FL_ITEM)) continue; WaypointSprite_Spawn( - s, + (get_weaponinfo(wpn)).wpmodel, 1, 0, - world, e.origin, + world, e.origin + ('0 0 1' * e.maxs_z) * 1.2, self, 0, world, enemy, 0, @@ -101,7 +96,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) } else { - Send_WeaponComplain (cl, wpn, W_Name(wpn), 2); + Send_WeaponComplain (cl, wpn, 2); } play2(cl, "weapons/unavailable.wav"); @@ -115,6 +110,7 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa // function. Thus we must use car/cdr. float weaponwant, first_valid, prev_valid, switchtonext, switchtolast, c; string rest; + WepSet wepset = '0 0 0'; switchtonext = switchtolast = 0; first_valid = prev_valid = 0; float weaponcur; @@ -135,15 +131,25 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa { weaponwant = stof(car(rest)); rest = cdr(rest); wep = get_weaponinfo(weaponwant); + wepset = WepSet_FromWeapon(weaponwant); if(imp >= 0) - if(wep.impulse != imp) - continue; + if(wep.impulse != imp) + continue; + + float i, have_other = FALSE; + for(i = WEP_FIRST; i <= WEP_LAST; ++i) + { + if(i != weaponwant) + if((get_weaponinfo(i)).impulse == imp || imp < 0) + if((pl.weapons & WepSet_FromWeapon(i)) || (weaponsInMap & WepSet_FromWeapon(i))) + have_other = TRUE; + } // skip weapons we don't own that aren't normal and aren't in the map - if(!(pl.weapons & WepSet_FromWeapon(weaponwant))) - if(!((get_weaponinfo(weaponwant)).spawnflags & WEP_FLAG_NORMAL)) - if(!(weaponsInMap & WepSet_FromWeapon(weaponwant))) - continue; + if(!(pl.weapons & wepset)) + if(!(weaponsInMap & wepset)) + if((wep.spawnflags & WEP_FLAG_MUTATORBLOCKED) || have_other) + continue; ++c; @@ -182,15 +188,25 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa { weaponwant = stof(car(rest)); rest = cdr(rest); wep = get_weaponinfo(weaponwant); + wepset = WepSet_FromWeapon(weaponwant); if(imp >= 0) if(wep.impulse != imp) continue; + float i, have_other = FALSE; + for(i = WEP_FIRST; i <= WEP_LAST; ++i) + { + if(i != weaponwant) + if((get_weaponinfo(i)).impulse == imp || imp < 0) + if((pl.weapons & WepSet_FromWeapon(i)) || (weaponsInMap & WepSet_FromWeapon(i))) + have_other = TRUE; + } + // skip weapons we don't own that aren't normal and aren't in the map - if(!(pl.weapons & WepSet_FromWeapon(weaponwant))) - if(!((get_weaponinfo(weaponwant)).spawnflags & WEP_FLAG_NORMAL)) - if(!(weaponsInMap & WepSet_FromWeapon(weaponwant))) - continue; + if(!(pl.weapons & wepset)) + if(!(weaponsInMap & wepset)) + if((wep.spawnflags & WEP_FLAG_MUTATORBLOCKED) || have_other) + continue; --c; if(c == 0) @@ -237,7 +253,7 @@ void W_SwitchWeapon(float imp) else self.selectweapon = imp; // update selectweapon ANYWAY } - else { WEP_ACTION(self.weapon, WR_RELOAD); } + else if(!forbidWeaponUse()) { WEP_ACTION(self.weapon, WR_RELOAD); } } void W_CycleWeapon(string weaponorder, float dir)