38 WriteHeader(MSG_ENTITY, ENT_CLIENT_ITEM);
44 WriteVector(MSG_ENTITY, this.
origin);
49 WriteAngleVector(MSG_ENTITY, this.
angles);
64 LOG_TRACE(
"^1WARNING!^7 this.mdl is unset for item ", this.
classname,
"expect a crash just about now");
80 WriteVector(MSG_ENTITY, this.
velocity);
89 this.SendFlags |= ISF_LOCATION;
100 if(this.
itemdef.instanceOfPowerup)
114 if(STAT(WEAPONS,
this) || this.
itemdef.instanceOfAmmo)
123 e.ItemStatus &= ~ITS_STAYWEP;
130 e.spawnshieldtime = 1;
131 e.ItemStatus |= ITS_AVAILABLE;
138 e.spawnshieldtime = 1;
139 e.ItemStatus &= ~ITS_AVAILABLE;
143 bool nostay = def.instanceOfWeaponPickup ? !!(def.m_weapon.m_wepset &
WEPSET_SUPERWEAPONS) :
false 152 e.spawnshieldtime = 0;
153 e.ItemStatus |= (ITS_AVAILABLE | ITS_STAYWEP);
159 e.colormod =
'0 0 0';
161 e.spawnshieldtime = 1;
162 e.ItemStatus &= ~ITS_AVAILABLE;
167 e.ItemStatus |= ITS_GLOW;
173 e.ItemStatus |= ITS_ALLOWFB;
175 e.ItemStatus &= ~ITS_ALLOWFB;
178 e.ItemStatus |= ITS_ALLOWSI;
182 e.SendFlags |= ISF_STATUS;
222 if(this.waypointsprite_attached)
223 WaypointSprite_Kill(this.waypointsprite_attached);
235 if (wi != WEP_Null) {
236 entity wp = WaypointSprite_Spawn(WP_Weapon, 0, 0,
this,
'0 0 64',
NULL, 0,
this, waypointsprite_attached,
true, RADARICON_Weapon);
237 wp.wp_extra = wi.m_id;
244 entity wp = WaypointSprite_Spawn(WP_Item, 0, 0,
this,
'0 0 64',
NULL, 0,
this, waypointsprite_attached,
true, RADARICON_Item);
245 wp.wp_extra = ii.m_id;
251 if(this.waypointsprite_attached)
260 if(this.waypointsprite_attached)
263 if(this.waypointsprite_attached.waypointsprite_visible_for_player(
this.waypointsprite_attached, it, it))
270 WaypointSprite_Ping(this.waypointsprite_attached);
294 e.item_respawncounter = 0;
306 e.scheduledrespawntime =
time + t;
318 AUTOCVAR(g_pickup_respawntime_scaling_reciprocal,
float, 0.0,
"Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `reciprocal` (with `offset` and `linear` set to 0) can be used to achieve a constant number of items spawned *per player*");
319 AUTOCVAR(g_pickup_respawntime_scaling_offset,
float, 0.0,
"Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `offset` offsets the curve left or right - the results are not intuitive and I recommend plotting the respawn time and the number of items per player to see what's happening");
320 AUTOCVAR(g_pickup_respawntime_scaling_linear,
float, 1.0,
"Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `linear` can be used to simply scale the respawn time linearly");
324 float r = autocvar_g_pickup_respawntime_scaling_reciprocal;
325 float o = autocvar_g_pickup_respawntime_scaling_offset;
326 float l = autocvar_g_pickup_respawntime_scaling_linear;
328 if (r == 0 && l == 1) {
329 return normal_respawntime;
345 return normal_respawntime * (r / (players + o) + l);
347 return normal_respawntime;
353 if(e.respawntime > 0)
361 float respawn_in = adjusted_respawntime +
crandom() * e.respawntimejitter;
368 AUTOCVAR(g_pickup_respawntime_initial_random,
int, 1,
369 "For items that don't start spawned: 0: spawn after their normal respawntime; 1: spawn after `random * respawntime` with the *same* random; 2: same as 1 but each item has separate random");
376 if (autocvar_g_pickup_respawntime_initial_random == 0)
379 spawn_in = e.respawntime +
random() * e.respawntimejitter;
384 if (autocvar_g_pickup_respawntime_initial_random == 1)
386 static float shared_random = 0;
389 if (!shared_random ||
floor(
time) > shared_random)
409 if (num_weapons == 0)
414 for (
int give_attempt = 0; give_attempt < num_weapons; ++give_attempt)
417 for (
int weapon_index = 0; weapon_index < num_potential_weapons;
421 FOREACH(Weapons, it != WEP_Null,
424 if (!(STAT(WEAPONS, receiver) & it.m_wepset) && (it.netname == weapon))
426 RandomSelection_AddEnt(it, 1, 1);
458 float player_amount =
GetResource(player, res_type);
459 if (item.spawnshieldtime)
461 if ((player_amount >= ammomax) && (item.pickup_anyway <= 0))
466 ammomax =
min(amount, ammomax);
467 if(player_amount >= ammomax)
482 int _switchweapon = 0;
487 if(
CS_CVAR(player).cvar_cl_autoswitch)
492 if(player.(weaponentity).m_weapon != WEP_Null || slot == 0)
494 if(player.(weaponentity).m_switchweapon ==
w_getbestweapon(player, weaponentity))
495 _switchweapon |=
BIT(slot);
497 if(!(STAT(WEAPONS, player) &
WepSet_FromWeapon(player.(weaponentity).m_switchweapon)))
498 _switchweapon |=
BIT(slot);
502 bool pickedup =
false;
504 pickedup |=
Item_GiveAmmoTo(item, player, RES_ARMOR, item.max_armorvalue);
511 if (item.itemdef.instanceOfWeaponPickup)
514 w = STAT(WEAPONS, item);
515 w &= ~STAT(WEAPONS, player);
517 if (w || (item.spawnshieldtime && item.pickup_anyway > 0))
520 FOREACH(Weapons, it != WEP_Null, {
521 if(w & (it.m_wepset))
523 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
525 .entity weaponentity = weaponentities[slot];
526 if(player.(weaponentity).m_weapon != WEP_Null || slot == 0)
527 W_DropEvent(wr_pickup, player, it.m_id, item, weaponentity);
535 if (item.itemdef.instanceOfPowerup)
537 if ((item.itemdef == ITEM_JetpackRegen) && !(player.items & IT_FUEL_REGEN))
538 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_ITEM_FUELREGEN_GOT);
539 else if ((item.itemdef == ITEM_Jetpack) && !(player.items & IT_JETPACK))
540 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_ITEM_JETPACK_GOT);
544 if((its = (item.items - (item.items & player.items)) & IT_PICKUPMASK))
552 if (item.strength_finished)
555 float t =
max(StatusEffects_gettime(STATUSEFFECT_Strength, player),
time);
557 t += item.strength_finished;
559 t =
max(t,
time + item.strength_finished);
560 StatusEffects_apply(STATUSEFFECT_Strength, player, t, 0);
562 if (item.invincible_finished)
565 float t =
max(StatusEffects_gettime(STATUSEFFECT_Shield, player),
time);
567 t += item.invincible_finished;
569 t =
max(t,
time + item.invincible_finished);
570 StatusEffects_apply(STATUSEFFECT_Shield, player, t, 0);
572 if (item.speed_finished)
575 float t =
max(StatusEffects_gettime(STATUSEFFECT_Speed, player),
time);
577 t += item.speed_finished;
579 t =
max(t,
time + item.speed_finished);
580 StatusEffects_apply(STATUSEFFECT_Speed, player, t, 0);
582 if (item.invisibility_finished)
585 float t =
max(StatusEffects_gettime(STATUSEFFECT_Invisibility, player),
time);
587 t += item.invisibility_finished;
589 t =
max(t,
time + item.invisibility_finished);
590 StatusEffects_apply(STATUSEFFECT_Invisibility, player, t, 0);
592 if (item.superweapons_finished)
595 StatusEffects_apply(STATUSEFFECT_Superweapons, player,
max(StatusEffects_gettime(STATUSEFFECT_Superweapons, player),
time) + item.superweapons_finished, 0);
606 if(
g_cts && item.itemdef.instanceOfWeaponPickup && !
CS_CVAR(player).cvar_cl_cts_noautoswitch)
611 if(player.(weaponentity).m_weapon != WEP_Null || slot == 0)
622 if(_switchweapon &
BIT(slot))
623 if(player.(weaponentity).m_switchweapon !=
w_getbestweapon(player, weaponentity))
643 if(!(toucher.flags & FL_PICKUPITEMS)
644 || STAT(FROZEN, toucher)
647 || (this.
owner == toucher)
661 this.strength_finished =
max(0, this.strength_finished -
time);
662 this.invincible_finished =
max(0, this.invincible_finished -
time);
663 this.speed_finished =
max(0, this.speed_finished -
time);
664 this.invisibility_finished =
max(0, this.invisibility_finished -
time);
673 this.strength_finished +=
time;
674 this.invincible_finished +=
time;
675 this.speed_finished +=
time;
676 this.invisibility_finished +=
time;
687 STAT(LAST_PICKUP, toucher) =
time;
716 it.scheduledrespawntime = 0;
717 RandomSelection_AddEnt(it, it.cnt, 0);
739 if (this.waypointsprite_attached)
741 WaypointSprite_Kill(this.waypointsprite_attached);
761 RandomSelection_AddEnt(it, it.cnt, 0);
780 it.effects &= ~EF_NODRAW;
789 if(wasfreed(
this) || !
this) {
return; }
802 if(STAT(WEAPONS, player) & STAT(WEAPONS, item))
805 if(!item.spawnshieldtime)
812 int weapons_value = 0;
813 FOREACH(Weapons, it != WEP_Null && (STAT(WEAPONS, player) & it.m_wepset), {
814 weapons_value += it.bot_pickupbasevalue;
816 c -=
bound(0, weapons_value / 20000, 1) * 0.5;
818 return item.bot_pickupbasevalue * c;
823 bool need_shells =
false, need_nails =
false, need_rockets =
false, need_cells =
false, need_plasma =
false, need_fuel =
false;
829 if(item.itemdef.instanceOfWeaponPickup)
832 if(
GetResource(item, RES_SHELLS)) { need_shells =
true; ammo = ITEM_Shells; }
833 else if(
GetResource(item, RES_BULLETS)) { need_nails =
true; ammo = ITEM_Bullets; }
834 else if(
GetResource(item, RES_ROCKETS)) { need_rockets =
true; ammo = ITEM_Rockets; }
835 else if(
GetResource(item, RES_CELLS)) { need_cells =
true; ammo = ITEM_Cells; }
836 else if(
GetResource(item, RES_PLASMA)) { need_plasma =
true; ammo = ITEM_Plasma; }
837 else if(
GetResource(item, RES_FUEL)) { need_fuel =
true; ammo = ITEM_JetpackFuel; }
842 rating = ammo.m_botvalue;
846 FOREACH(Weapons, it != WEP_Null, {
847 if(!(STAT(WEAPONS, player) & (it.m_wepset)))
852 case RES_SHELLS: need_shells = true; break;
853 case RES_BULLETS: need_nails = true; break;
854 case RES_ROCKETS: need_rockets = true; break;
855 case RES_CELLS: need_cells = true; break;
856 case RES_PLASMA: need_plasma = true; break;
857 case RES_FUEL: need_fuel = true; break;
860 rating = item.bot_pickupbasevalue;
863 float noammorating = 0.5;
885 rating += wpn.bot_pickupbasevalue * 0.1;
892 float rating = item.bot_pickupbasevalue;
899 itemarmor *=
min(4, item.item_group_count);
900 itemhealth *=
min(4, item.item_group_count);
903 if (itemarmor && (
GetResource(player, RES_ARMOR) < item.max_armorvalue))
922 gettouch(
this)(
this, actor);
927 string itemname = def.m_name;
928 Model itemmodel = def.m_model;
929 Sound pickupsound = def.m_sound;
931 float pickupbasevalue = def.m_botvalue;
932 int itemflags = def.m_itemflags;
940 def.m_iteminit(def,
this);
951 int itemid = def.m_itemid;
953 int weaponid = def.instanceOfWeaponPickup ? def.m_weapon.m_id : 0;
975 precache_model(this.
model);
980 this.reset = SUB_Remove;
1017 if(this.
angles !=
'0 0 0')
1018 this.SendFlags |= ISF_ANGLES;
1034 setsize(
this, def.m_mins, def.m_maxs);
1035 this.SendFlags |= ISF_SIZE;
1062 FOREACH_ENTITY_RADIUS(this.
origin, 3, it.is_item, {
1063 LOG_TRACE(
"XXX Found duplicated item: ", itemname, vtos(this.origin));
1064 LOG_TRACE(
" vs ", it.netname, vtos(it.origin));
1065 error(
"Mapper sucks.");
1072 if ( def.instanceOfPowerup
1073 || def.instanceOfWeaponPickup
1074 || (def.instanceOfHealth && def != ITEM_HealthSmall)
1075 || (def.instanceOfArmor && def != ITEM_ArmorSmall)
1080 this.
target =
"###item###";
1087 this.bot_pickupevalfunc = pickupevalfunc;
1096 this.
skin = def.m_skin;
1099 setsize (
this, this.
pos1 = def.m_mins,
this.pos2 = def.m_maxs);
1101 this.SendFlags |= ISF_SIZE;
1104 if(def.instanceOfPowerup)
1105 this.ItemStatus |= ITS_ANIMATE1;
1108 this.ItemStatus |= ITS_ANIMATE2;
1114 if(def.instanceOfWeaponPickup)
1119 this.ItemStatus |= ITS_ANIMATE1;
1120 this.SendFlags |= ISF_COLORMAP;
1135 Net_LinkEntity(
this, !(def.instanceOfPowerup || def.instanceOfHealth || def.instanceOfArmor), 0,
ItemSend);
1150 def = def.m_spawnfunc_hookreplace(def,
this);
1158 this.
classname = def.m_canonical_spawnfunc;
1163 def.m_respawntime(),
1164 def.m_respawntimejitter()
1168 #define IS_SMALL(def) ((def.instanceOfHealth && def == ITEM_HealthSmall) || (def.instanceOfArmor && def == ITEM_ArmorSmall)) 1176 FOREACH_ENTITY_RADIUS(this.
origin, 120, (it !=
this) &&
IS_SMALL(it.itemdef),
1178 if(!this.item_group)
1182 it.item_group = group_count;
1185 this.item_group = it.item_group;
1190 it.item_group = this.item_group;
1191 else if(it.item_group != this.item_group)
1193 int grY = it.item_group;
1195 IL_EACH(g_items, IS_SMALL(it.itemdef),
1197 if(it.item_group == grY)
1198 it.item_group = this.item_group;
1245 if(!this.strength_finished)
1246 this.strength_finished = autocvar_g_balance_powerup_strength_time;
1247 if(!this.invincible_finished)
1248 this.invincible_finished = autocvar_g_balance_powerup_invincible_time;
1249 if(!this.speed_finished)
1250 this.speed_finished = autocvar_g_balance_powerup_speed_time;
1251 if(!this.invisibility_finished)
1252 this.invisibility_finished = autocvar_g_balance_powerup_invisibility_time;
1258 if(
argv(0) ==
"give")
1264 for(
int j = 0; j < n; ++j)
1267 if (
argv(j) ==
"unlimited_ammo") this.
items |= IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS;
1268 else if(
argv(j) ==
"unlimited_weapon_ammo") this.
items |= IT_UNLIMITED_AMMO;
1269 else if(
argv(j) ==
"unlimited_superweapons") this.
items |= IT_UNLIMITED_SUPERWEAPONS;
1270 else if(
argv(j) ==
"strength") this.
items |= ITEM_Strength.m_itemid;
1271 else if(
argv(j) ==
"invincible") this.
items |= ITEM_Shield.m_itemid;
1272 else if(
argv(j) ==
"speed") this.
items |= ITEM_Speed.m_itemid;
1273 else if(
argv(j) ==
"invisibility") this.
items |= ITEM_Invisibility.m_itemid;
1274 else if(
argv(j) ==
"superweapons") this.
items |= IT_SUPERWEAPON;
1275 else if(
argv(j) ==
"jetpack") this.
items |= ITEM_Jetpack.m_itemid;
1276 else if(
argv(j) ==
"fuel_regen") this.
items |= ITEM_JetpackRegen.m_itemid;
1279 FOREACH(StatusEffect, it.instanceOfBuff,
1281 string s = Buff_UndeprecateName(argv(j));
1285 if(!this.buffs_finished)
1286 this.buffs_finished = it.m_time(it);
1290 FOREACH(Weapons, it != WEP_Null, {
1294 STAT(WEAPONS,
this) |= (it.m_wepset);
1303 string itemprefix, valueprefix;
1311 itemprefix =
"max ";
1312 valueprefix =
"max ";
1316 itemprefix =
"min ";
1317 valueprefix =
"min ";
1321 itemprefix =
"minus ";
1322 valueprefix =
"max ";
1326 error(
"invalid spawnflags");
1331 str = sprintf(
"%s %s%d %s", str, itemprefix,
boolean(this.
items & IT_UNLIMITED_AMMO),
"unlimited_weapon_ammo");
1332 str = sprintf(
"%s %s%d %s", str, itemprefix,
boolean(this.
items & IT_UNLIMITED_SUPERWEAPONS),
"unlimited_superweapons");
1333 str = sprintf(
"%s %s%d %s", str, valueprefix, this.strength_finished *
boolean(this.
items & ITEM_Strength.m_itemid),
"strength");
1334 str = sprintf(
"%s %s%d %s", str, valueprefix, this.invincible_finished *
boolean(this.
items & ITEM_Shield.m_itemid),
"invincible");
1335 str = sprintf(
"%s %s%d %s", str, valueprefix, this.invisibility_finished *
boolean(this.
items & ITEM_Invisibility.m_itemid),
"invisibility");
1336 str = sprintf(
"%s %s%d %s", str, valueprefix, this.speed_finished *
boolean(this.
items & ITEM_Speed.m_itemid),
"speed");
1337 str = sprintf(
"%s %s%d %s", str, valueprefix, this.
superweapons_finished *
boolean(this.
items & IT_SUPERWEAPON),
"superweapons");
1338 str = sprintf(
"%s %s%d %s", str, itemprefix,
boolean(this.
items & ITEM_Jetpack.m_itemid),
"jetpack");
1339 str = sprintf(
"%s %s%d %s", str, itemprefix,
boolean(this.
items & ITEM_JetpackRegen.m_itemid),
"fuel_regen");
1341 res =
GetResource(
this, RES_SHELLS);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"shells");
1342 res =
GetResource(
this, RES_BULLETS);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"nails");
1343 res =
GetResource(
this, RES_ROCKETS);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"rockets");
1344 res =
GetResource(
this, RES_CELLS);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"cells");
1345 res =
GetResource(
this, RES_PLASMA);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"plasma");
1346 res =
GetResource(
this, RES_FUEL);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"fuel");
1347 res =
GetResource(
this,
RES_HEALTH);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"health");
1348 res =
GetResource(
this, RES_ARMOR);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"armor");
1349 FOREACH(StatusEffect, it.instanceOfBuff, str = sprintf(
"%s %s%d %s", str, valueprefix, this.buffs_finished *
boolean(this.buffdef == it), it.netname));
1350 FOREACH(Weapons, it != WEP_Null, str = sprintf(
"%s %s%d %s", str, itemprefix, !!(STAT(WEAPONS,
this) & (it.m_wepset)), it.netname));
1355 for(
int j = 0; j < n; ++j)
1368 v0 = (STAT(WEAPONS, e) & s);
1373 STAT(WEAPONS, e) |= s;
1375 STAT(WEAPONS, e) &= ~s;
1380 STAT(WEAPONS, e) |= s;
1384 STAT(WEAPONS, e) &= ~s;
1388 STAT(WEAPONS, e) &= ~s;
1391 v1 = (STAT(WEAPONS, e) & s);
1397 bool had_buff = StatusEffects_active(thebuff, e);
1398 float new_buff_time = ((had_buff) ? StatusEffects_gettime(thebuff, e) : 0);
1402 new_buff_time = val;
1405 new_buff_time =
max(new_buff_time, val);
1408 new_buff_time =
min(new_buff_time, val);
1411 new_buff_time += val;
1414 new_buff_time -= val;
1417 if(new_buff_time <= 0)
1425 StatusEffects_apply(thebuff, e, new_buff_time, 0);
1427 bool have_buff = StatusEffects_active(thebuff, e);
1428 return (had_buff != have_buff);
1437 if(snd_decr !=
NULL)
1440 else if(v0 >= v0 + t)
1442 if(snd_incr !=
NULL)
1447 void GiveRot(
entity e,
float v0,
float v1, .
float rotfield,
float rottime, .
float regenfield,
float regentime)
1450 e.(rotfield) =
max(e.(rotfield),
time + rottime);
1452 e.(regenfield) =
max(e.(regenfield),
time + regentime);
1461 case OP_SET: new_val = val;
break;
1462 case OP_MIN: new_val =
max(v0, val);
break;
1463 case OP_MAX: new_val =
min(v0, val);
break;
1464 case OP_PLUS: new_val = v0 + val;
break;
1465 case OP_MINUS: new_val = v0 - val;
break;
1466 default:
return false;
1473 bool had_eff = StatusEffects_active(
this, e);
1474 float new_eff_time = ((had_eff) ? StatusEffects_gettime(
this, e) : 0);
1481 new_eff_time =
max(new_eff_time, val);
1484 new_eff_time =
min(new_eff_time, val);
1487 new_eff_time += val;
1490 new_eff_time -= val;
1493 if(new_eff_time <= 0)
1499 StatusEffects_apply(
this, e, new_eff_time, 0);
1500 bool have_eff = StatusEffects_active(
this, e);
1501 return (had_eff != have_eff);
1506 float got, i, val, op;
1514 int _switchweapon = 0;
1516 if(
CS_CVAR(e).cvar_cl_autoswitch)
1521 if(e.(weaponentity).m_weapon != WEP_Null || slot == 0)
1522 if(e.(weaponentity).m_switchweapon ==
w_getbestweapon(e, weaponentity))
1523 _switchweapon |=
BIT(slot);
1531 e.statuseffects.statuseffect_time[it.
m_id] =
max(0, e.statuseffects.statuseffect_time[it.
m_id] -
time);
1551 for(i = beginarg; i < endarg; ++i)
1555 if(cmd ==
"0" ||
stof(cmd))
1579 got +=
GiveBit(e,
items, ITEM_JetpackRegen.m_itemid, op, val);
1581 got +=
GiveBit(e,
items, IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS, op, val);
1583 got +=
GiveBit(e,
items, ITEM_Jetpack.m_itemid, op, val);
1598 case "unlimited_ammo":
1600 got +=
GiveBit(e,
items, IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS, op, val);
1602 case "unlimited_weapon_ammo":
1605 case "unlimited_superweapons":
1606 got +=
GiveBit(e,
items, IT_UNLIMITED_SUPERWEAPONS, op, val);
1609 got +=
GiveBit(e,
items, ITEM_Jetpack.m_itemid, op, val);
1612 got +=
GiveBit(e,
items, ITEM_JetpackRegen.m_itemid, op, val);
1624 case "invisibility":
1627 case "superweapons":
1658 got += GiveBuff(e, it, op, val);
1662 got += GiveWeapon(e, it.m_id, op, val);
1675 FOREACH(Weapons, it != WEP_Null, {
1677 if(!(save_weapons & (it.m_wepset)))
1678 if(STAT(WEAPONS, e) & (it.m_wepset))
1694 if(!StatusEffects_active(STATUSEFFECT_Superweapons, e))
1704 if(e.statuseffects.statuseffect_time[it.
m_id] <= 0)
1705 e.statuseffects.statuseffect_time[it.
m_id] = 0;
1707 e.statuseffects.statuseffect_time[it.
m_id] +=
time;
1710 StatusEffects_update(e);
1716 if(e.(weaponentity).m_weapon != WEP_Null || slot == 0)
1718 _switchweapon |=
BIT(slot);
1726 if(_switchweapon &
BIT(slot))
1729 if(wep != e.(weaponentity).m_switchweapon)
const int NUM_TEAMS
Number of teams in the game.
const int SPRITERULE_SPECTATOR
void buff_RemoveAll(entity actor, int removal_type)
void Item_ItemsTime_SetTime(entity e, float t)
float autocvar_g_balance_pause_armor_rot
#define IL_EACH(this, cond, body)
WepSet WEPSET_SUPERWEAPONS
#define POSTGIVE_RESOURCE(e, f, t, snd_incr, snd_decr)
float autocvar_g_balance_superweapons_time
float autocvar_sv_simple_items
void Item_Think(entity this)
bool have_pickup_item(entity this)
void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names, entity ammo_entity)
Give several random weapons and ammo to the entity.
void Item_ItemsTime_SetTimesForAllPlayers()
float autocvar_g_items_mindist
void Item_FindTeam(entity this)
void W_SwitchWeapon_Force(Player this, Weapon w,.entity weaponentity)
float item_respawncounter
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
float autocvar_g_balance_pause_health_regen
float(entity, float) PlayerPhysplug
#define w_getbestweapon(ent, wepent)
#define Sound_fixpath(this)
void target_items_use(entity this, entity actor, entity trigger)
ERASEABLE void RandomSelection_Init()
#define EXACTTRIGGER_TOUCH(e, t)
void TeamBalance_Destroy(entity balance)
Destroy the team balance entity.
#define PREGIVE_RESOURCE(e, f)
#define REGISTRY_GET(id, i)
void Item_ScheduleInitialRespawn(entity e)
void Item_Respawn(entity this)
bool Item_ItemsTime_Allow(GameItem it)
#define FOREACH_CLIENT(cond, body)
void SUB_UseTargets(entity this, entity actor, entity trigger)
bool autocvar_g_fullbrightitems
Effect is being removed by a function, calls regular removal mechanics.
float ammo_pickupevalfunc(entity player, entity item)
float bot_pickupbasevalue
float generic_pickupevalfunc(entity player, entity item)
float autocvar_g_balance_pause_fuel_regen
const float EF_NODEPTHTEST
float item_spawnshieldtime
#define POSTGIVE_RES_ROT(e, f, t, rotfield, rottime, regenfield, regentime, snd_incr, snd_decr)
string Buff_UndeprecateName(string buffname)
float Item_ItemsTime_UpdateTime(entity e, float t)
void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
#define IS_REAL_CLIENT(v)
void Item_ScheduleRespawnIn(entity e, float t)
void TakeResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Takes an entity some resource but not less than a limit.
#define setmodel(this, m)
const float EF_FULLBRIGHT
Effect is being forcibly removed without calling any additional mechanics.
bool GiveStatusEffect(entity e, StatusEffects this, int op, float val)
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
float weapon_pickupevalfunc(entity player, entity item)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define PREGIVE_STATUSEFFECT(e, f)
void item_use(entity this, entity actor, entity trigger)
void GiveResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Gives an entity some resource but not more than a limit.
void W_GiveWeapon(entity e, int wep)
const int MAX_WEAPONSLOTS
void StartItem(entity this, GameItem def)
void GiveRot(entity e, float v0, float v1,.float rotfield, float rottime,.float regenfield, float regentime)
void TeamBalance_GetTeamCounts(entity balance, entity ignore)
Counts the number of players and various other information about each team.
float pauserothealth_finished
const float ITEM_RESPAWN_TICKS
entity RandomSelection_chosen_ent
float autocvar_g_items_maxdist
#define POSTGIVE_BIT(e, f, b, snd_incr, snd_decr)
float g_pickup_rockets_max
float pauserotfuel_finished
void RemoveItem(entity this)
bool GiveBuff(entity e, Buff thebuff, int op, int val)
float trace_dpstartcontents
#define crandom()
Returns a random number between -1.0 and 1.0.
float pauserotarmor_finished
bool autocvar_g_powerups_stack
float g_pickup_shells_max
void Item_Touch(entity this, entity toucher)
void UpdateItemAfterTeleport(entity this)
float autocvar_g_items_dropped_lifetime
void ItemUpdate(entity this)
bool autocvar_g_nodepthtestitems
const int CH_TRIGGER_SINGLE
void setItemGroup(entity this)
bool ItemSend(entity this, entity to, int sf)
bool Item_ItemsTime_SpectatorOnly(GameItem it)
float autocvar_g_balance_pause_health_rot
string W_UndeprecateName(string s)
#define CENTER_OR_VIEWOFS(ent)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define ITEM_DAMAGE_NEEDKILL(dt)
void GiveResource(entity receiver, Resource res_type, float amount)
Gives an entity some resource.
float superweapons_finished
bool GiveResourceValue(entity e, Resource res_type, int op, int val)
AUTOCVAR(g_pickup_respawntime_scaling_reciprocal, float, 0.0, "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `reciprocal` (with `offset` and `linear` set to 0) can be used to achieve a constant number of items spawned *per player*")
float healtharmor_pickupevalfunc(entity player, entity item)
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define ITEM_TOUCH_NEEDKILL()
void InitializeEntity(entity e, void(entity this) func, int order)
bool TeamBalance_IsTeamAllowed(entity balance, int index)
Returns whether the team change to the specified team is allowed.
const int WEP_FLAG_SPECIALATTACK
float g_pickup_plasma_max
#define ITEM_HANDLE(signal,...)
bool Item_GiveAmmoTo(entity item, entity player, Resource res_type, float ammomax)
void Item_RespawnCountdown(entity this)
#define _sound(e, c, s, v, a)
const float SOLID_TRIGGER
void Item_Show(entity e, int mode)
#define MUTATOR_CALLHOOK(id,...)
entity weaponentities[MAX_WEAPONSLOTS]
#define POSTGIVE_STATUSEFFECT(e, f, snd_incr, snd_decr)
bool Item_GiveTo(entity item, entity player)
bool Item_IsLoot(entity item)
Returns whether the item is loot.
float pauseregen_finished
int TeamBalance_GetNumberOfPlayers(entity balance, int index)
Returns the number of players (both humans and bots) in a team.
float GiveItems(entity e, float beginarg, float endarg)
float GiveWeapon(entity e, float wpn, float op, float val)
int autocvar_g_pickup_items
const int WEP_FLAG_MUTATORBLOCKED
entity TeamBalance_CheckAllowedTeams(entity for_whom)
Checks whether the player can join teams according to global configuration and mutator settings...
#define WepSet_FromWeapon(it)
#define sound(e, c, s, v, a)
ERASEABLE bool GiveBit(entity e,.int fld, int bit, int op, int val)
void waypoint_spawnforitem(entity e)
float buff_Available(entity buff)
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
bool Item_IsExpiring(entity item)
Returns whether the item is expiring (i.e.
void GiveSound(entity e, float v0, float v1, float t, Sound snd_incr, Sound snd_decr)
entity item_pickupsound_ent
#define FOREACH(list, cond, body)
#define PREGIVE_WEAPONS(e)
void Item_ScheduleRespawn(entity e)
void set_movetype(entity this, int mt)
#define POSTGIVE_WEAPON(e, b, snd_incr, snd_decr)
void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void Item_Reset(entity this)
void Item_RespawnThink(entity this)
float autocvar_g_balance_pause_fuel_rot
float adjust_respawntime(float normal_respawntime)
Adjust respawn time according to the number of players.