32 if (ITEM_IS_LOOT(it) && autocvar_g_showweaponspawns < 2)
34 entity wp = WaypointSprite_Spawn(
37 NULL, it.origin + (
'0 0 1' * it.maxs.z) * 1.2,
43 wp.wp_extra = this.m_id;
58 CS(
this).hasweapon_complain_spam =
time + 0.2;
63 sprint(
this,
"Invalid weapon\n");
82 if (wpn == WEP_MINE_LAYER)
83 IL_EACH(
g_mines, it.owner ==
this && it.weaponentity_fld == weaponentity,
129 float first_valid = 0, prev_valid = 0;
131 bool switchtonext =
false, switchtolast =
false;
133 if (skipmissing || this.(weaponentity).
selectweapon == 0)
144 int wepcomplainindex = 0;
145 bool have_other =
false;
148 WepSet customgroup =
'0 0 0';
165 if ((it.m_wepset & STAT(WEAPONS, this))
166 || ((it.m_wepset & weaponsInMap) && !(it.spawnflags & WEP_FLAG_HIDDEN)))
176 weaponwant =
stof(
car(rest)); rest =
cdr(rest);
178 if (
imp >= 0 && wep.impulse !=
imp)
182 if (!(
STAT(WEAPONS,
this) & wep.m_wepset))
197 wepcomplainindex = c;
207 first_valid = weaponwant;
208 if (weaponwant == weaponcur)
217 prev_valid = weaponwant;
240 entity w_ent = this.(weaponentity);
241 w_ent.cnt = w_ent.m_switchweapon.m_id;
242 w_ent.m_switchweapon = wep;
243 w_ent.selectweapon = wep.
m_id;
252 if (
STAT(WEAPONS,
this) & set)
254 STAT(WEAPONS,
this) &= ~set;
256 STAT(WEAPONS,
this) |= set;
291 if (!
W_SwitchWeapon(
this, w, weaponentity) &&
CS_CVAR(
this).cvar_cl_weapon_switch_fallback_to_impulse)
346 if (this.(weaponentity) && (this.(weaponentity).
m_weapon != WEP_Null || slot == 0))
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
int impulse
M: impulse : weapon impulse.
virtual void wr_reload()
(SERVER) handles reloading for weapon
virtual void wr_checkammo2()
(SERVER) checks ammo for weapon second
int spawnflags
M: flags : WEPSPAWNFLAG_... combined.
virtual void wr_checkammo1()
(SERVER) checks ammo for weapon primary
const int IT_UNLIMITED_AMMO
vector weaponsInMap
all the weapons actually spawned in the map, does not include filtered items
#define IL_EACH(this, cond, body)
Header file that describes the functions related to game items.
#define FOREACH(list, cond, body)
#define WriteHeader(to, id)
#define REPLICATE_APPLYCHANGE(var, ApplyChange_code)
Allows setting code that will be executed on cvar value changes.
#define REGISTRY_GET(id, i)
bool W_SwitchWeapon(entity this, Weapon w,.entity weaponentity)
float W_GetCycleWeapon(entity this, string weaponorder, float dir, float imp, bool complain, bool skipmissing,.entity weaponentity)
void W_PreviousWeapon(entity this, float list,.entity weaponentity)
Goto prev weapon.
void W_SwitchWeapon_Force(Player this, Weapon wep,.entity weaponentity)
void W_NextWeapon(entity this, int list,.entity weaponentity)
Goto next weapon.
void Send_WeaponComplain(entity e, float wpn, float type)
Switch between weapons.
void W_CycleWeapon(entity this, string weaponorder, float dir,.entity weaponentity)
void W_SwitchWeapon_TryOthers(entity this, Weapon w,.entity weaponentity)
void Weapon_whereis(Weapon this, entity cl)
void W_NextWeaponOnImpulse(entity this, float imp,.entity weaponentity)
bool client_hasweapon(entity this, Weapon wpn,.entity weaponentity, float andammo, bool complain)
void W_SwitchToOtherWeapon(entity this,.entity weaponentity)
Perform weapon to attack (weaponstate and attack_finished check is here)
void W_LastWeapon(entity this,.entity weaponentity)
Goto previously used if exists and has ammo, (second) best otherwise.
#define w_getbestweapon(ent, wepent)
bool autocvar_g_weaponswitch_debug
float hasweapon_complain_spam
int autocvar_g_showweaponspawns
string weaponorder_byimpulse
void play2(entity e, string filename)
ClientState CS(Client this)
ERASEABLE string car(string s)
returns first word
ERASEABLE string cdr(string s)
returns all but first word
#define IS_REAL_CLIENT(v)
void Weapon_whereis(Weapon this, entity cl)
#define WepSet_FromWeapon(it)
const int MAX_WEAPONSLOTS
entity weaponentities[MAX_WEAPONSLOTS]
const int WEP_FLAG_MUTATORBLOCKED
const int WEP_FLAG_DUALWIELD
int weaponslot(.entity weaponentity)
const int WEP_FLAG_HIDDEN
entity weaponorder[REGISTRY_MAX(Weapons)]
bool weaponLocked(entity player)