21 WriteHeader(
MSG_ONE, TE_CSQC_WEAPONCOMPLAIN);
29 IL_EACH(
g_items, it.weapon ==
this.m_id && (!it.team || (it.ItemStatus & ITS_AVAILABLE)),
31 if (Item_IsLoot(it) && (autocvar_g_showweaponspawns < 2))
35 entity wp = WaypointSprite_Spawn(
38 NULL, it.origin + (
'0 0 1' * it.maxs.z) * 1.2,
44 wp.wp_extra =
this.m_id;
57 if (wpn == WEP_HOOK && !((STAT(WEAPONS,
this) | weaponsInMap) &
WepSet_FromWeapon(wpn)))
61 CS(
this).hasweapon_complain_spam =
time + 0.2;
66 sprint(
this,
"Invalid weapon\n");
75 if(this.
items & IT_UNLIMITED_AMMO)
81 f = wpn.wr_checkammo1(wpn,
this, weaponentity) + wpn.wr_checkammo2(wpn,
this, weaponentity);
84 if(wpn == WEP_MINE_LAYER)
85 IL_EACH(g_mines, it.owner ==
this && it.weaponentity_fld == weaponentity,
96 play2(
this,
SND(UNAVAILABLE));
117 Weapon_whereis(it, this);
126 play2(
this,
SND(UNAVAILABLE));
135 float weaponwant, first_valid, prev_valid, switchtonext, switchtolast;
137 switchtonext = switchtolast = 0;
138 first_valid = prev_valid = 0;
142 if(skipmissing || this.(weaponentity).
selectweapon == 0)
143 weaponcur = this.(weaponentity).m_switchweapon.m_id;
145 weaponcur =
this.(weaponentity).selectweapon;
155 weaponwant =
stof(
car(rest)); rest =
cdr(rest);
157 wepset = wep.m_wepset;
159 if(wep.impulse != imp)
162 bool have_other =
false;
163 FOREACH(Weapons, it != WEP_Null, {
165 if(it.impulse == imp || imp < 0)
166 if((STAT(WEAPONS,
this) & (it.m_wepset)) || (weaponsInMap & (it.m_wepset)))
171 if(!(STAT(WEAPONS,
this) & wepset))
172 if(!(weaponsInMap & wepset))
183 first_valid = weaponwant;
184 if(weaponwant == weaponcur)
193 prev_valid = weaponwant;
211 weaponwant =
stof(
car(rest)); rest =
cdr(rest);
213 wepset = wep.m_wepset;
215 if(wep.impulse != imp)
218 bool have_other =
false;
219 FOREACH(Weapons, it != WEP_Null, {
221 if(it.impulse == imp || imp < 0)
222 if((STAT(WEAPONS,
this) & (it.m_wepset)) || (weaponsInMap & (it.m_wepset)))
227 if(!(STAT(WEAPONS,
this) & wepset))
228 if(!(weaponsInMap & wepset))
246 entity w_ent = this.(weaponentity);
247 w_ent.cnt = w_ent.m_switchweapon.m_id;
248 w_ent.m_switchweapon = wep;
249 w_ent.selectweapon = wep.
m_id;
258 if (STAT(WEAPONS,
this) &
set)
260 STAT(WEAPONS,
this) &= ~set;
262 STAT(WEAPONS,
this) |=
set;
268 if (ww == WEP_Null)
return;
274 if(this.(weaponentity).m_switchweapon != w)
290 w.wr_reload(w, actor, weaponentity);
298 if(!
W_SwitchWeapon(
this, w, weaponentity) &&
CS_CVAR(
this).cvar_cl_weapon_switch_fallback_to_impulse)
355 if (this.(weaponentity) && (this.(weaponentity).m_weapon != WEP_Null || slot == 0))
356 this.(weaponentity).m_switchweapon =
w_getbestweapon(
this, weaponentity);
#define IL_EACH(this, cond, body)
float hasweapon_complain_spam
void W_SwitchToOtherWeapon(entity this,.entity weaponentity)
void W_SwitchWeapon_TryOthers(entity this, Weapon w,.entity weaponentity)
#define w_getbestweapon(ent, wepent)
void W_NextWeapon(entity this, int list,.entity weaponentity)
#define REGISTRY_GET(id, i)
ClientState CS(Client this)
ERASEABLE string cdr(string s)
returns all but first word
void Send_WeaponComplain(entity e, float wpn, float type)
ERASEABLE string car(string s)
returns first word
#define IS_REAL_CLIENT(v)
int weaponslot(.entity weaponentity)
int spawnflags
M: flags : WEPSPAWNFLAG_...
bool weaponLocked(entity player)
int autocvar_g_showweaponspawns
bool autocvar_g_weaponswitch_debug
const int MAX_WEAPONSLOTS
int impulse
M: impulse : weapon impulse.
REPLICATE_APPLYCHANGE("cl_weaponpriority", for(int slot=0;slot< MAX_WEAPONSLOTS;++slot) { .entity weaponentity=weaponentities[slot];if(this.(weaponentity) &&(this.(weaponentity).m_weapon !=WEP_Null||slot==0)) this.(weaponentity).m_switchweapon=w_getbestweapon(this, weaponentity);})
float W_GetCycleWeapon(entity this, string weaponorder, float dir, float imp, float complain, float skipmissing,.entity weaponentity)
entity weaponorder[REGISTRY_MAX(Weapons)]
void W_NextWeaponOnImpulse(entity this, float imp,.entity weaponentity)
bool W_SwitchWeapon(entity this, Weapon w,.entity weaponentity)
void W_SwitchWeapon_Force(Player this, Weapon wep,.entity weaponentity)
entity weaponentities[MAX_WEAPONSLOTS]
const int WEP_FLAG_MUTATORBLOCKED
#define WepSet_FromWeapon(it)
void Weapon_whereis(Weapon this, entity cl)
const int WEP_FLAG_DUALWIELD
Header file that describes the functions related to game items.
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
bool client_hasweapon(entity this, Weapon wpn,.entity weaponentity, float andammo, bool complain)
#define FOREACH(list, cond, body)
string weaponorder_byimpulse
void W_CycleWeapon(entity this, string weaponorder, float dir,.entity weaponentity)
void W_LastWeapon(entity this,.entity weaponentity)
void W_PreviousWeapon(entity this, float list,.entity weaponentity)