void NET_Mutator_Remove(entity this)
{
string s = this.netname;
- WITH(bool, mutator_log, true, LAMBDA(
+ WITH(bool, mutator_log, true, {
FOREACH(Mutators, it.registered_id == s, Mutator_Remove(it));
- ));
+ });
}
NET_HANDLE(Mutator, bool isNew)
{
make_pure(this);
this.entremove = NET_Mutator_Remove;
int added = 0;
- WITH(bool, mutator_log, true, LAMBDA(
+ WITH(bool, mutator_log, true, {
FOREACH(Mutators, it.registered_id == s, { Mutator_Add(it); ++added; });
- ));
+ });
if (added > 1) LOG_WARNF("Added more than one mutator for %s", s);
}
}
{
if (flags)
{
- FOREACH(Buffs, it.m_itemid & _buffs, LAMBDA(return it));
+ FOREACH(Buffs, it.m_itemid & _buffs, { return it; });
}
return BUFF_Null;
}
MUTATOR_HOOKFUNCTION(cl_buffs, HUD_Powerups_add)
{
int allBuffs = STAT(BUFFS);
- FOREACH(Buffs, it.m_itemid & allBuffs, LAMBDA(
+ FOREACH(Buffs, it.m_itemid & allBuffs, {
addPowerupItem(it.m_prettyName, strcat("buff_", it.m_name), it.m_color, bound(0, STAT(BUFF_TIME) - time, 99), 60);
- ));
+ });
}
MUTATOR_HOOKFUNCTION(cl_buffs, WP_Format)
{
{
float best_distance = autocvar_g_buffs_swapper_range;
entity closest = NULL;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
if(!IS_DEAD(it) && !STAT(FROZEN, it) && !it.vehicle)
if(DIFF_TEAM(it, player))
{
closest = it;
}
}
- ));
+ });
if(closest)
{
const float armor = M_ARGV(3, float);
const int deathtype = M_ARGV(5, int);
const float potential_damage = M_ARGV(6, float);
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), {
if (
(SV_DAMAGETEXT_ALL()) ||
(SV_DAMAGETEXT_PLAYERS() && it == attacker) ||
else WriteShort(MSG_ONE, potential_damage * DAMAGETEXT_PRECISION_MULTIPLIER);
}
}
- ));
+ });
}
MUTATOR_HOOKFUNCTION(mutator_instagib, MatchEnd)
{
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(instagib_stop_countdown(it)));
+ FOREACH_CLIENT(IS_PLAYER(it), { instagib_stop_countdown(it); });
}
MUTATOR_HOOKFUNCTION(mutator_instagib, MonsterDropItem)
#ifdef CSQC
void Item_ItemsTime_Init()
{
- FOREACH(Items, true, LAMBDA(
+ FOREACH(Items, true, {
ItemsTime_time[it.m_id] = -1;
- ));
+ });
ItemsTime_time[Items_MAX] = -1;
}
void Item_ItemsTime_Init()
{
- FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+ FOREACH(Items, Item_ItemsTime_Allow(it), {
it_times[it.m_id] = -1;
- ));
+ });
it_times[Items_MAX] = -1;
}
void Item_ItemsTime_ResetTimes()
{
- FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+ FOREACH(Items, Item_ItemsTime_Allow(it), {
it_times[it.m_id] = (it_times[it.m_id] == -1) ? -1 : 0;
- ));
+ });
it_times[Items_MAX] = (it_times[Items_MAX] == -1) ? -1 : 0;
}
void Item_ItemsTime_ResetTimesForPlayer(entity e)
{
- FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+ FOREACH(Items, Item_ItemsTime_Allow(it), {
IT_Write(e, it.m_id, (it_times[it.m_id] == -1) ? -1 : 0);
- ));
+ });
IT_Write(e, Items_MAX, (it_times[Items_MAX] == -1) ? -1 : 0);
}
void Item_ItemsTime_SetTimesForPlayer(entity e)
{
- FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+ FOREACH(Items, Item_ItemsTime_Allow(it), {
IT_Write(e, it.m_id, it_times[it.m_id]);
- ));
+ });
IT_Write(e, Items_MAX, it_times[Items_MAX]);
}
void Item_ItemsTime_SetTimesForAllPlayers()
{
- FOREACH_CLIENT(IS_REAL_CLIENT(it) && (warmup_stage || !IS_PLAYER(it) || autocvar_sv_itemstime == 2), LAMBDA(Item_ItemsTime_SetTimesForPlayer(it)));
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && (warmup_stage || !IS_PLAYER(it) || autocvar_sv_itemstime == 2), { Item_ItemsTime_SetTimesForPlayer(it); });
}
float Item_ItemsTime_UpdateTime(entity e, float t)
int count = 0;
if (autocvar_hud_panel_itemstime_hidespawned == 1)
{
- FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+ FOREACH(Items, Item_ItemsTime_Allow(it), {
count += (Item_ItemsTime_GetTime(it.m_id) > time || -Item_ItemsTime_GetTime(it.m_id) > time);
- ));
+ });
count += (Item_ItemsTime_GetTime(Items_MAX) > time || -Item_ItemsTime_GetTime(Items_MAX) > time);
}
else if (autocvar_hud_panel_itemstime_hidespawned == 2)
{
- FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+ FOREACH(Items, Item_ItemsTime_Allow(it), {
count += (Item_ItemsTime_GetTime(it.m_id) > time);
- ));
+ });
count += (Item_ItemsTime_GetTime(Items_MAX) > time);
}
else
{
- FOREACH(Items, Item_ItemsTime_Allow(it), LAMBDA(
+ FOREACH(Items, Item_ItemsTime_Allow(it), {
count += (Item_ItemsTime_GetTime(it.m_id) != -1);
- ));
+ });
count += (Item_ItemsTime_GetTime(Items_MAX) != -1);
}
if (count == 0)
bool item_available;
int id = 0;
string icon = "";
- FOREACH(Items, Item_ItemsTime_Allow(it) && Item_ItemsTime_GetTime(it.m_id) != -1, LAMBDA(
+ FOREACH(Items, Item_ItemsTime_Allow(it) && Item_ItemsTime_GetTime(it.m_id) != -1, {
id = it.m_id;
icon = it.m_icon;
}
if(id == Items_MAX) // can happen only in the last fake iteration
break;
- ));
+ });
// add another fake iteration for superweapons time
if(id < Items_MAX && Item_ItemsTime_GetTime(Items_MAX) != -1)
{
case PROJECTILE_NADE_BURN: return EFFECT_NADE_TRAIL_BURN(nade_team);
}
- FOREACH(Nades, true, LAMBDA(
+ FOREACH(Nades, true, {
for (int j = 0; j < 2; j++)
{
if (it.m_projectile[j] == proj)
break;
}
}
- ));
+ });
return EFFECT_Null;
}
{
vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
n = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
if(!IS_DEAD(it))
if(STAT(FROZEN, it) == 0)
if(SAME_TEAM(it, player))
it.reviving = true;
++n;
}
- ));
+ });
}
if(n && STAT(FROZEN, player) == 3) // OK, there is at least one teammate reviving us
Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
}
- FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, {
it.revive_progress = player.revive_progress;
it.reviving = false;
- ));
+ });
}
}
Nade Nade_FromProjectile(int proj)
{
- FOREACH(Nades, true, LAMBDA(
+ FOREACH(Nades, true, {
for (int j = 0; j < 2; j++)
{
if (it.m_projectile[j] == proj) return it;
}
- ));
+ });
return NADE_TYPE_Null;
}
error("This cannot be added at runtime\n");
// mark the guns as ok to use by e.g. impulse 99
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(nt_IsNewToy(it.m_id))
it.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
- ));
+ });
}
MUTATOR_ONROLLBACK_OR_REMOVE
{
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(nt_IsNewToy(it.m_id))
it.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
- ));
+ });
}
MUTATOR_ONREMOVE
WepSet seti = '0 0 0';
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
seti = it.m_wepset;
n = tokenize_console(nt_GetReplacement(it.netname, autocvar_g_new_toys_autoreplace));
for(j = 0; j < n; ++j)
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(it.netname == argv(j))
{
WepSet setk = it.m_wepset;
if(start_weapons & seti) newdefault |= setk;
if(warmup_start_weapons & seti) warmup_newdefault |= setk;
}
- ));
- ));
+ });
+ });
newdefault &= start_weapons_defaultmask;
start_weapons &= ~start_weapons_defaultmask;
nix_nextchange = 0;
nix_nextweapon = 0;
- FOREACH(Weapons, it != WEP_Null && NIX_CanChooseWeapon(it.m_id), LAMBDA(it.wr_init(it)));
+ FOREACH(Weapons, it != WEP_Null && NIX_CanChooseWeapon(it.m_id), { it.wr_init(it); });
}
MUTATOR_ONROLLBACK_OR_REMOVE
void NIX_ChooseNextWeapon()
{
RandomSelection_Init();
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(NIX_CanChooseWeapon(it.m_id))
RandomSelection_AddFloat(it.m_id, 1, (it.m_id != nix_weapon));
- ));
+ });
nix_nextweapon = RandomSelection_chosen_float;
}
if(frag_target.(weaponentity).m_weapon == WEP_Null)
continue;
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(frag_target.weapons & WepSet_FromWeapon(it))
if(frag_target.(weaponentity).m_weapon != it)
if(W_IsWeaponThrowable(frag_target, it.m_id))
W_ThrowNewWeapon(frag_target, it.m_id, false, CENTER_OR_VIEWOFS(frag_target), randomvec() * 175 + '0 0 325', weaponentity);
- ));
+ });
}
return true;
// since if the owning player disconnects, the object's owner should also be reset.
// bots can't have objects
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
if(this.crypto_idfp == it.crypto_idfp)
{
this.realowner = it;
break;
}
this.realowner = NULL;
- ));
+ });
this.nextthink = time;
sandbox_ObjectAttach_Remove(e); // detach child objects
// if the object being removed has been selected for attachment by a player, unset it
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.object_attach == e, LAMBDA(it.object_attach = NULL));
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.object_attach == e, { it.object_attach = NULL; });
if(e.material) { strunzone(e.material); e.material = string_null; }
if(e.crypto_idfp) { strunzone(e.crypto_idfp); e.crypto_idfp = string_null; }
return;
RandomSelection_Init();
- FOREACH_CLIENT(IS_PLAYER(it) && it != player && SAME_TEAM(it, player) && !IS_DEAD(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != player && SAME_TEAM(it, player) && !IS_DEAD(it), {
if(vdist(spawn_spot.origin - it.origin, >, autocvar_g_spawn_near_teammate_distance))
continue;
if(vdist(spawn_spot.origin - it.origin, <, 48))
if(!checkpvs(spawn_spot.origin, it))
continue;
RandomSelection_AddEnt(it, 1, 1);
- ));
+ });
if(RandomSelection_chosen_ent)
{
vector best_pos = '0 0 0';
float best_dist2 = FLOAT_MAX;
int tested = 0;
- FOREACH_CLIENT_RANDOM(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT_RANDOM(IS_PLAYER(it), {
if (autocvar_g_spawn_near_teammate_ignore_spawnpoint_max && tested >= autocvar_g_spawn_near_teammate_ignore_spawnpoint_max) break;
if (PHYS_INPUT_BUTTON_CHAT(it)) continue;
break; // don't test the other spots near this teammate, go to the next one
}
}
- ));
+ });
if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath)
if(best_mate)
entity item = M_ARGV(0, entity);
entity toucher = M_ARGV(1, entity);
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
if(!IS_SPEC(it) && !IS_OBSERVER(it))
continue;
if(it.superspec_flags & SSF_ITEMMSG)
}
}
}
- ));
+ });
return MUT_ITEMTOUCH_CONTINUE;
}
if(cmd_name == "followpowerup")
{
- FOREACH_CLIENT(IS_PLAYER(it) && (it.strength_finished > time || it.invincible_finished > time), LAMBDA(return superspec_Spectate(player, it)));
+ FOREACH_CLIENT(IS_PLAYER(it) && (it.strength_finished > time || it.invincible_finished > time), { return superspec_Spectate(player, it); });
superspec_msg("", "", player, "No active powerup\n", 1);
return true;
if(cmd_name == "followstrength")
{
- FOREACH_CLIENT(IS_PLAYER(it) && it.strength_finished > time, LAMBDA(return superspec_Spectate(player, it)));
+ FOREACH_CLIENT(IS_PLAYER(it) && it.strength_finished > time, { return superspec_Spectate(player, it); });
superspec_msg("", "", player, "No active Strength\n", 1);
return true;
if(cmd_name == "followshield")
{
- FOREACH_CLIENT(IS_PLAYER(it) && it.invincible_finished > time, LAMBDA(return superspec_Spectate(player, it)));
+ FOREACH_CLIENT(IS_PLAYER(it) && it.invincible_finished > time, { return superspec_Spectate(player, it); });
superspec_msg("", "", player, "No active Shield\n", 1);
return true;
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
- FOREACH_CLIENT(IS_SPEC(it), LAMBDA(
+ FOREACH_CLIENT(IS_SPEC(it), {
if(it.autospec_flags & ASF_FOLLOWKILLER && IS_PLAYER(frag_attacker) && it.enemy == frag_target)
{
if(it.autospec_flags & ASF_SHOWWHAT)
superspec_Spectate(it, frag_attacker);
}
- ));
+ });
}
MUTATOR_HOOKFUNCTION(superspec, ClientDisconnect)
if(IS_PLAYER(player))
if(!IS_DEAD(player))
if(!IS_INDEPENDENT_PLAYER(player))
- FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
if(time > it.touchexplode_time)
if(!STAT(FROZEN, it))
if(!IS_DEAD(it))
PlayerTouchExplode(player, it);
player.touchexplode_time = it.touchexplode_time = time + 0.2;
}
- ));
+ });
}
}
// need to loop, as our netname could be one of three
- FOREACH(Waypoints, it.netname == s, LAMBDA(
+ FOREACH(Waypoints, it.netname == s, {
return it.m_name;
- ));
+ });
return s;
}
s = "";
for(i = 0; i < n; ++i)
{
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(argv(i) == it.netname)
s = strcat(s, " & ", it.m_name);
- ));
+ });
}
s = sprintf(_("%s Arena"), substring(s, 3, strlen(s) - 3));
int i;
#define ADD_TO_W_LIST(pred) \
- FOREACH(Weapons, it != WEP_Null, LAMBDA( \
+ FOREACH(Weapons, it != WEP_Null, { \
if (it.impulse != imp) continue; \
if (!(pred)) continue; \
w_list = strcat(w_list, it.m_name, " / "); \
- ))
+ })
for(int imp = 1; imp <= 9; ++imp)
{
if (_FCR_entered) LOG_FATAL("FOREACH_CLIENT_RANDOM must not be nested"); \
_FCR_entered = true; \
int _cnt = 0; \
- FOREACH_CLIENT(cond, LAMBDA( \
- int _j = floor(random() * (_cnt + 1)); \
- if (_j == _cnt) \
- { \
- _FCR_clients[_cnt] = it; \
- } \
- else \
- { \
- _FCR_clients[_cnt] = _FCR_clients[_j]; \
- _FCR_clients[_j] = it; \
- } \
- _cnt++; \
- )); \
+ FOREACH_CLIENT(cond, { \
+ int _j = floor(random() * (_cnt + 1)); \
+ if (_j == _cnt) \
+ { \
+ _FCR_clients[_cnt] = it; \
+ } \
+ else \
+ { \
+ _FCR_clients[_cnt] = _FCR_clients[_j]; \
+ _FCR_clients[_j] = it; \
+ } \
+ _cnt++; \
+ }); \
for (int _i = 0; _i < _cnt; ++_i) \
{ \
const noref int i = _i; \
continue;
s = argv(0);
prio = 1;
- FOREACH_CLIENT(IS_BOT_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_BOT_CLIENT(it), {
if(s == it.cleanname)
{
prio = 0;
break;
}
- ));
+ });
RandomSelection_AddString(readfile, 1, prio);
}
readfile = RandomSelection_chosen_string;
// number bots with identical names
int j = 0;
- FOREACH_CLIENT(IS_BOT_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_BOT_CLIENT(it), {
if(it.cleanname == name)
++j;
- ));
+ });
if (j)
this.netname = this.netname_freeme = strzone(strcat(prefix, name, "(", ftos(j), ")", suffix));
else
bestbot = -1;
bestplayer = -1;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
if(IS_REAL_CLIENT(it))
bestplayer = max(bestplayer, it.totalfrags - it.totalfrags_lastcheck);
else
bestbot = max(bestbot, it.totalfrags - it.totalfrags_lastcheck);
- ));
+ });
LOG_DEBUG("autoskill: best player got ", ftos(bestplayer), ", ");
LOG_DEBUG("best bot got ", ftos(bestbot), "; ");
// don't reset counters, wait for them to accumulate
}
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.totalfrags_lastcheck = it.totalfrags));
+ FOREACH_CLIENT(IS_PLAYER(it), { it.totalfrags_lastcheck = it.totalfrags; });
}
void bot_calculate_stepheightvec()
activerealplayers = M_ARGV(0, int);
realplayers = M_ARGV(1, int);
} else {
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), {
if(IS_PLAYER(it))
++activerealplayers;
++realplayers;
- ));
+ });
}
int bots;
if(skill >= 5) // bots can only look for unloaded weapons past this skill
if(this.(weaponentity).clip_load >= 0) // only if we're not reloading a weapon already
{
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if((this.weapons & (it.m_wepset)) && (it.spawnflags & WEP_FLAG_RELOADABLE) && (this.(weaponentity).weapon_load[it.m_id] < it.reloading_ammo))
{
this.(weaponentity).m_switchweapon = it;
break;
}
- ));
+ });
}
}
}
// if this weapon is scheduled for reloading, don't switch to it during combat
if (this.(weaponentity).weapon_load[new_weapon] < 0)
{
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(it.wr_checkammo1(it, this, weaponentity) + it.wr_checkammo2(it, this, weaponentity))
return true; // other weapon available
- ));
+ });
}
return false;
{
// If no weapon was chosen get the first available weapon
if(this.(weaponentity).m_weapon==WEP_Null)
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(client_hasweapon(this, it, weaponentity, true, false))
{
this.(weaponentity).m_switchweapon = it;
return;
}
- ));
+ });
return;
}
ratingscale = ratingscale * 0.00005; // enemies are rated around 20000 already
float t;
- FOREACH_CLIENT(IS_PLAYER(it) && bot_shouldattack(this, it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && bot_shouldattack(this, it), {
// TODO: Merge this logic with the bot_shouldattack function
if(vdist(it.origin - org, <, 100) || vdist(it.origin - org, >, sradius))
continue;
ratingscale *= t;
if (ratingscale > 0)
navigation_routerating(this, it, ratingscale * BOT_RATING_ENEMY, 2000);
- ));
+ });
}
// legacy bot role for standard gamemodes
if(this.bot_barrier == 1) // find other bots
{
- FOREACH_CLIENT(it.isbot, LAMBDA(
+ FOREACH_CLIENT(it.isbot, {
if(it.bot_cmdqueuebuf_allocated)
if(it.bot_barrier != 1)
return CMD_STATUS_EXECUTING; // not all are at the barrier yet
- ));
+ });
// all bots hit the barrier!
// acknowledge barrier
- FOREACH_CLIENT(it.isbot, LAMBDA(it.bot_barrier = 2));
+ FOREACH_CLIENT(it.isbot, { it.bot_barrier = 2; });
bot_barriertime = time;
}
void bot_resetqueues()
{
- FOREACH_CLIENT(it.isbot, LAMBDA(
+ FOREACH_CLIENT(it.isbot, {
it.bot_cmd_execution_index = 0;
bot_clearqueue(it);
// also, cancel all barriers
it.(bot_placenames[i]) = string_null;
}
it.bot_places_count = 0;
- ));
+ });
bot_barriertime = time;
}
void botframe_autowaypoints()
{
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && !IS_DEAD(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && !IS_DEAD(it), {
// going back is broken, so only fix waypoints to walk TO the player
//botframe_autowaypoints_fix(p, false, botframe_autowaypoints_lastwp0);
botframe_autowaypoints_fix(it, true, botframe_autowaypoints_lastwp1);
//te_explosion(p.botframe_autowaypoints_lastwp0.origin);
- ));
+ });
if (autocvar_g_waypointeditor_auto >= 2) {
botframe_deleteuselesswaypoints();
int lost = 0;
string savevar;
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
if(it.winning)
won += 1;
else
lost += 1;
- ));
+ });
if(autocvar__campaign_testrun)
{
case CHIMPULSE_R00T.impulse:
IS_CHEAT(this, imp, 0, 0);
RandomSelection_Init();
- FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, this), LAMBDA(RandomSelection_AddEnt(it, 1, 1)));
+ FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, this), { RandomSelection_AddEnt(it, 1, 1); });
if(RandomSelection_chosen_ent)
e = RandomSelection_chosen_ent;
else
CS(e).clientdata.SendFlags = 1;
// make it spectatable
- FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e, LAMBDA(CS(it).clientdata.SendFlags = 1));
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e, { CS(it).clientdata.SendFlags = 1; });
}
void SetSpectatee(entity this, entity spectatee);
target_voicescript_clear(this);
// reset fields the weapons may use
- FOREACH(Weapons, true, LAMBDA(
+ FOREACH(Weapons, true, {
it.wr_resetplayer(it, this);
// reload all reloadable weapons
if (it.spawnflags & WEP_FLAG_RELOADABLE) {
this.(weaponentity).weapon_load[it.m_id] = it.reloading_ammo;
}
}
- ));
+ });
{
string s = spot.target;
// TODO simplify this
int totalClients = 0;
int currentlyPlaying = 0;
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
if(it != ignore)
++totalClients;
if(IS_REAL_CLIENT(it))
if(IS_PLAYER(it) || it.caplayer)
++currentlyPlaying;
- ));
+ });
float free_slots = 0;
if (!autocvar_g_maxplayers)
}
else // no, maybe it's a name?
{
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
if(strdecolorize(it.netname) == strdecolorize(argv(start_index)))
{
selection = it;
break; // no reason to keep looking
}
- ));
+ });
index = (start_index + 1);
}
else
{
selection = NULL;
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
if(strdecolorize(it.netname) == strdecolorize(input))
{
selection = it;
break; // no reason to keep looking
}
- ));
+ });
}
return selection;
cvar_set("slowmo", ftos(orig_slowmo));
// unlock the view for players so they can move around again
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
it.fixangle = false;
- ));
+ });
timeout_handler_reset(this);
}
cvar_set("slowmo", ftos(TIMEOUT_SLOWMO_VALUE));
// reset all the flood variables
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
it.nickspamcount = it.nickspamtime = it.floodcontrol_chat =
it.floodcontrol_chatteam = it.floodcontrol_chattell =
it.floodcontrol_voice = it.floodcontrol_voiceteam = 0;
- ));
+ });
// copy .v_angle to .lastV_angle for every player in order to fix their view during pause (see PlayerPreThink)
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
it.lastV_angle = it.v_angle;
- ));
+ });
this.nextthink = time; // think again next frame to handle it under TIMEOUT_ACTIVE code
}
"ent", "nickname", "ping", "pl", "time", "ip", "crypto_id"));
total_listed_players = 0;
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
is_bot = (IS_BOT_CLIENT(it));
if (is_bot)
tmp_crypto_idfp));
++total_listed_players;
- ));
+ });
print_to(caller, strcat("Finished listing ", ftos(total_listed_players), " client(s) out of ", ftos(maxclients), " slots."));
METHOD(commoncommand_##id, m_invokecmd, void(commoncommand_##id this, int request, entity caller, int arguments, string command))
STATIC_INIT(COMMON_COMMANDS_aliases) {
- FOREACH(COMMON_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svcmd"))));
+ FOREACH(COMMON_COMMANDS, true, { localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svcmd")); });
}
#include "vote.qh"
void CommonCommand_macro_help(entity caller)
{
- FOREACH(COMMON_COMMANDS, true, LAMBDA(print_to(caller, sprintf(" ^2%s^7: %s", it.m_name, it.m_description))));
+ FOREACH(COMMON_COMMANDS, true, { print_to(caller, sprintf(" ^2%s^7: %s", it.m_name, it.m_description)); });
}
float CommonCommand_macro_command(float argc, entity caller, string command)
{
string c = strtolower(argv(0));
- FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA(
+ FOREACH(COMMON_COMMANDS, it.m_name == c, {
it.m_invokecmd(it, CMD_REQUEST_COMMAND, caller, argc, command);
return true;
- ));
+ });
return false;
}
float CommonCommand_macro_usage(float argc, entity caller)
{
string c = strtolower(argv(1));
- FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA(
+ FOREACH(COMMON_COMMANDS, it.m_name == c, {
it.m_invokecmd(it, CMD_REQUEST_USAGE, caller, argc, "");
return true;
- ));
+ });
return false;
}
void CommonCommand_macro_write_aliases(float fh)
{
- FOREACH(COMMON_COMMANDS, true, LAMBDA(CMD_Write_Alias("qc_cmd_svcmd", it.m_name, it.m_description)));
+ FOREACH(COMMON_COMMANDS, true, { CMD_Write_Alias("qc_cmd_svcmd", it.m_name, it.m_description); });
}
METHOD(servercommand_##id, m_invokecmd, void(servercommand_##id this, int request, entity caller, int arguments, string command))
STATIC_INIT(SERVER_COMMANDS_aliases) {
- FOREACH(SERVER_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_sv"))));
+ FOREACH(SERVER_COMMANDS, true, { localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_sv")); });
}
{
string reason = argv(1);
int n = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
if (it.caplayer) it.caplayer = 0;
PutObserverInServer(it);
++n;
- ));
+ });
if (n) bprint(strcat("Successfully forced all (", ftos(n), ") players to spectate", (reason ? strcat(" for reason: '", reason, "'") : ""), ".\n"));
else LOG_INFO("No players found to spectate.\n");
return;
int n = 0;
float argc;
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
argc = tokenize_console(strcat("defer_clear ", ftos(etof(it))));
GameCommand_defer_clear(CMD_REQUEST_COMMAND, argc);
++n;
- ));
+ });
if (n) LOG_INFO(strcat("Successfully stuffed defer clear to all clients (", ftos(n), ")\n")); // should a message be added if no players were found?
return;
}
{
blockSpectators = 1;
// give every spectator <g_maxplayers_spectator_blocktime> seconds time to become a player
- FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_SPEC(it) || IS_OBSERVER(it)) && !it.caplayer, LAMBDA(
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_SPEC(it) || IS_OBSERVER(it)) && !it.caplayer, {
if(!it.caplayer)
{
CS(it).spectatortime = time;
Send_Notification(NOTIF_ONE_ONLY, it, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
}
- ));
+ });
bprint(strcat("^7All spectators will be automatically kicked when not joining the game after ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds!\n"));
return;
}
return;
}
- FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, {
if (it.team_forced) {
// we could theoretically assign forced players to their teams
// and shuffle the rest to fill the empty spots but in practise
LOG_INFO("Can't shuffle teams because at least one player has a forced team.\n");
return;
}
- ));
+ });
int number_of_teams = 0;
CheckAllowedTeams(NULL);
if (c4 >= 0) number_of_teams = max(4, number_of_teams);
int team_index = 0;
- FOREACH_CLIENT_RANDOM(IS_PLAYER(it) || it.caplayer, LAMBDA(
+ FOREACH_CLIENT_RANDOM(IS_PLAYER(it) || it.caplayer, {
int target_team_number = Team_NumberToTeam(team_index + 1);
if (it.team != target_team_number) MoveToTeam(it, target_team_number, 6);
team_index = (team_index + 1) % number_of_teams;
- ));
+ });
bprint("Successfully shuffled the players around randomly.\n");
return;
void GameCommand_macro_help()
{
- FOREACH(SERVER_COMMANDS, true, LAMBDA(LOG_INFOF(" ^2%s^7: %s\n", it.m_name, it.m_description)));
+ FOREACH(SERVER_COMMANDS, true, { LOG_INFOF(" ^2%s^7: %s\n", it.m_name, it.m_description); });
}
float GameCommand_macro_command(float argc, string command)
{
string c = strtolower(argv(0));
- FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA(
+ FOREACH(SERVER_COMMANDS, it.m_name == c, {
it.m_invokecmd(it, CMD_REQUEST_COMMAND, NULL, argc, command);
return true;
- ));
+ });
return false;
}
float GameCommand_macro_usage(float argc)
{
string c = strtolower(argv(1));
- FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA(
+ FOREACH(SERVER_COMMANDS, it.m_name == c, {
it.m_invokecmd(it, CMD_REQUEST_USAGE, NULL, argc, "");
return true;
- ));
+ });
return false;
}
void GameCommand_macro_write_aliases(float fh)
{
- FOREACH(SERVER_COMMANDS, true, LAMBDA(CMD_Write_Alias("qc_cmd_sv", it.m_name, it.m_description)));
+ FOREACH(SERVER_COMMANDS, true, { CMD_Write_Alias("qc_cmd_sv", it.m_name, it.m_description); });
}
void VoteReset()
{
- FOREACH_CLIENT(true, LAMBDA(it.vote_selection = 0));
+ FOREACH_CLIENT(true, { it.vote_selection = 0; });
if (vote_called)
{
Nagger_VoteCountChanged();
// add up all the votes from each connected client
- FOREACH_CLIENT(IS_REAL_CLIENT(it) && IS_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && IS_CLIENT(it), {
++vote_player_count;
if (IS_PLAYER(it)) ++vote_real_player_count;
switch (it.vote_selection)
}
default: break;
}
- ));
+ });
// Check to see if there are enough players on the server to allow master voting... otherwise, vote master could be used for evil.
if ((vote_called == VOTE_MASTER) && autocvar_sv_vote_master_playerlimit > vote_player_count)
if (it.reset2) it.reset2(it);
});
- FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(Unfreeze(it)));
+ FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), { Unfreeze(it); });
// Moving the player reset code here since the player-reset depends
// on spawnpoint entities which have to be reset first --blub
game_starttime = time + RESTART_COUNTDOWN;
// clear player attributes
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
it.alivetime = 0;
CS(it).killcount = 0;
PS_GR_P_ADDVAL(it, PLAYERSTATS_ALIVETIME, -PS_GR_P_ADDVAL(it, PLAYERSTATS_ALIVETIME, 0));
- ));
+ });
restart_mapalreadyrestarted = false; // reset this var, needed when cvar sv_ready_restart_repeatable is in use
warmup_stage = 0; // once the game is restarted the game is in match stage
// reset the .ready status of all players (also spectators)
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(it.ready = false));
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), { it.ready = false; });
readycount = 0;
Nagger_ReadyCounted(); // NOTE: this causes a resend of that entity, and will also turn off warmup state on the client
// after a restart every players number of allowed timeouts gets reset, too
if (autocvar_sv_timeout)
{
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(CS(it).allowed_timeouts = autocvar_sv_timeout_number));
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { CS(it).allowed_timeouts = autocvar_sv_timeout_number; });
}
// reset map immediately if this cvar is not set
if (!autocvar_sv_ready_restart_after_countdown) reset_map(true);
float ready_needed_factor, ready_needed_count;
float t_ready = 0, t_players = 0;
- FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_PLAYER(it) || it.caplayer == 1), LAMBDA(
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_PLAYER(it) || it.caplayer == 1), {
++t_players;
if (it.ready) ++t_ready;
- ));
+ });
readycount = t_ready;
msg_entity = caller;
}
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(++tmp_playercount));
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), { ++tmp_playercount; });
if (tmp_playercount > 1) Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, ANNCE_VOTE_CALL); // don't announce a "vote now" sound if player is alone
bprint("\{1}^2* ^3", OriginalCallerName(), "^2 calls a vote for ", vote_called_display, "\n");
if(!IS_INDEPENDENT_PLAYER(e))
if(!STAT(FROZEN, e))
- FOREACH_CLIENT(IS_PLAYER(it) && it != e, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != e, {
if(!IS_DEAD(it))
if(!IS_INDEPENDENT_PLAYER(it))
if(boxesoverlap(e.absmin, e.absmax, it.absmin, it.absmax))
d = autocvar_g_balance_firetransfer_damage * e.fire_damagepersec * t;
Fire_AddDamage(it, o, d, t, DEATH_FIRE.m_id);
}
- ));
+ });
}
void Fire_ApplyEffect(entity e)
if(to_file)
fputs(file, strcat(s, "\n"));
- FOREACH_CLIENT(IS_REAL_CLIENT(it) || (IS_BOT_CLIENT(it) && autocvar_sv_logscores_bots), LAMBDA(
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) || (IS_BOT_CLIENT(it) && autocvar_sv_logscores_bots), {
s = strcat(":player:see-labels:", GetPlayerScoreString(it, 0), ":");
s = strcat(s, ftos(rint(time - CS(it).jointime)), ":");
if(IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it))
GameLogEcho(strcat(s, ftos(it.playerid), ":", playername(it, false)));
if(to_file)
fputs(file, strcat(s, playername(it, false), "\n"));
- ));
+ });
if(teamplay)
{
{
stuffcmd(e, "\nscr_printspeed 1000000\n");
RandomSelection_Init();
- FOREACH_WORD(autocvar_sv_intermission_cdtrack, true, LAMBDA(
+ FOREACH_WORD(autocvar_sv_intermission_cdtrack, true, {
RandomSelection_AddString(it, 1, 1);
- ));
+ });
if (RandomSelection_chosen_string != "")
{
stuffcmd(e, sprintf("\ncd loop %s\n", RandomSelection_chosen_string));
GameLogClose();
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
FixIntermissionClient(it);
if(it.winning)
bprint(playername(it, false), " ^7wins.\n");
- ));
+ });
target_music_kill();
// set the .winning flag for exactly those players with a given field value
void SetWinners(.float field, float value)
{
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.winning = (it.(field) == value)));
+ FOREACH_CLIENT(IS_PLAYER(it), { it.winning = (it.(field) == value); });
}
// set the .winning flag for those players with a given field value
void AddWinners(.float field, float value)
{
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
if(it.(field) == value)
it.winning = 1;
- ));
+ });
}
// clear the .winning flags
void ClearWinners()
{
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.winning = 0));
+ FOREACH_CLIENT(IS_PLAYER(it), { it.winning = 0; });
}
void ShuffleMaplist()
team1_score = team2_score = team3_score = team4_score = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), {
switch(it.team)
{
case NUM_TEAM_1: team1_score = 1; break;
case NUM_TEAM_3: team3_score = 1; break;
case NUM_TEAM_4: team4_score = 1; break;
}
- ));
+ });
IL_EACH(g_spawnpoints, true,
{
float playerswithlaps;
float readyplayers;
totalplayers = playerswithlaps = readyplayers = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
++totalplayers;
if(PlayerScore_Add(it, SP_RACE_FASTEST, 0))
++playerswithlaps;
if(it.ready)
++readyplayers;
- ));
+ });
// at least 2 of the players have completed a lap: start the RACE
// otherwise, the players should end the qualifying on their own
redirection_nextthink = time + 1;
clients_found = 0;
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), {
// TODO add timer
LOG_INFO("Redirecting: sending connect command to ", it.netname, "\n");
if(redirection_target == "self")
else
stuffcmd(it, strcat("\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " \"connect ", redirection_target, "\"\n"));
++clients_found;
- ));
+ });
LOG_INFO("Redirecting: ", ftos(clients_found), " clients left.\n");
void MapVote_ClearAllVotes()
{
- FOREACH_CLIENT(true, LAMBDA(it.mapvote = 0));
+ FOREACH_CLIENT(true, { it.mapvote = 0; });
}
void MapVote_UnzoneStrings()
GameLogEcho(strcat(":vote:suggestion_accepted:", mapvote_maps[mappos]));
}
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(FixClientCvars(it)));
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), { FixClientCvars(it); });
if(gametypevote)
{
return;
int totalvotes = 0;
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), {
// hide scoreboard again
if(it.health != 2342)
{
if(it.mapvote)
++totalvotes;
- ));
+ });
MapVote_CheckRules_1(); // just count
}
{
g_weaponarena = 1;
g_weaponarena_list = "All Weapons";
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED))
g_weaponarena_weapons |= (it.m_wepset);
- ));
+ });
}
else if (s == "devall")
{
{
g_weaponarena = 1;
g_weaponarena_list = "Most Weapons";
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED))
if(it.spawnflags & WEP_FLAG_NORMAL)
g_weaponarena_weapons |= (it.m_wepset);
- ));
+ });
}
else if (s == "none")
{
for (i = 0; i < t; ++i)
{
s = argv(i);
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(it.netname == s)
{
g_weaponarena_weapons |= (it.m_wepset);
g_weaponarena_list = strcat(g_weaponarena_list, it.m_name, " & ");
break;
}
- ));
+ });
}
g_weaponarena_list = strzone(substring(g_weaponarena_list, 0, strlen(g_weaponarena_list) - 3));
}
}
else
{
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
int w = want_weapon(it, false);
WepSet s = it.m_wepset;
if(w & 1)
start_weapons_default |= s;
if(w & 4)
start_weapons_defaultmask |= s;
- ));
+ });
}
if(!cvar("g_use_ammunition"))
warmup_start_weapons = '0 0 0';
warmup_start_weapons_default = '0 0 0';
warmup_start_weapons_defaultmask = '0 0 0';
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
int w = want_weapon(it, g_warmup_allguns);
WepSet s = (it.m_wepset);
if(w & 1)
warmup_start_weapons_default |= s;
if(w & 4)
warmup_start_weapons_defaultmask |= s;
- ));
+ });
}
}
WepSet precache_weapons = start_weapons;
if (g_warmup_allguns != 1)
precache_weapons |= warmup_start_weapons;
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(precache_weapons & (it.m_wepset))
it.wr_init(it);
- ));
+ });
start_ammo_shells = max(0, start_ammo_shells);
start_ammo_nails = max(0, start_ammo_nails);
void precache_playermodels(string s)
{
- FOREACH_WORD(s, true, LAMBDA(precache_playermodel(it)));
+ FOREACH_WORD(s, true, { precache_playermodel(it); });
}
void precache()
if (!warmup_stage)
game_starttime = time + cvar("g_start_delay");
- FOREACH(Weapons, it != WEP_Null, LAMBDA(it.wr_init(it)));
+ FOREACH(Weapons, it != WEP_Null, { it.wr_init(it); });
readplayerstartcvars();
}
if (g) {
for (string _s = g.m_mutators; _s != ""; _s = cdr(_s)) {
string s = car(_s);
- FOREACH(Mutators, it.m_name == s, LAMBDA(Mutator_Add(it); break));
+ FOREACH(Mutators, it.m_name == s, { Mutator_Add(it); break; });
}
}
}
this.enemy.health = -1;
if(this.enemy.message)
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(centerprint(it, this.enemy.message)));
+ FOREACH_CLIENT(IS_PLAYER(it), { centerprint(it, this.enemy.message); });
SUB_UseTargets(this.enemy, this, trigger);
}
void CA_count_alive_players()
{
total_players = redalive = bluealive = yellowalive = pinkalive = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
switch(it.team)
{
case NUM_TEAM_1: ++total_players; if(!IS_DEAD(it)) ++redalive; break;
case NUM_TEAM_3: ++total_players; if(!IS_DEAD(it)) ++yellowalive; break;
case NUM_TEAM_4: ++total_players; if(!IS_DEAD(it)) ++pinkalive; break;
}
- ));
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ });
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), {
it.redalive_stat = redalive;
it.bluealive_stat = bluealive;
it.yellowalive_stat = yellowalive;
it.pinkalive_stat = pinkalive;
- ));
+ });
}
float CA_GetWinnerTeam()
{
Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_OVER);
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_OVER);
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(nades_Clear(it)));
+ FOREACH_CLIENT(IS_PLAYER(it), { nades_Clear(it); });
allowed_to_spawn = false;
game_stopped = true;
game_stopped = true;
round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(nades_Clear(it)));
+ FOREACH_CLIENT(IS_PLAYER(it), { nades_Clear(it); });
return 1;
}
return false;
players_total = players_worseeq = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
if(DIFF_TEAM(it, p))
continue;
se = PlayerScore_Add(it, SP_CTF_CAPS, 0);
if(ser <= sr)
++players_worseeq;
++players_total;
- ));
+ });
// player is in the worse half, if >= half the players are better than him, or consequently, if < half of the players are worse
// use this rule here
_sound(player, CH_TRIGGER, flag.snd_flag_pass, VOL_BASE, ATTEN_NORM);
ctf_EventLog("receive", flag.team, player);
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
if(it == sender)
Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_SENT), player.netname);
else if(it == player)
Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_RECEIVED), sender.netname);
else if(SAME_TEAM(it, sender))
Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_OTHER), sender.netname, player.netname);
- ));
+ });
// create new waypoint
ctf_FlagcarrierWaypoints(player);
Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, APP_NUM(flag.team, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
if(!flag.team)
- FOREACH_CLIENT(IS_PLAYER(it) && it != player && DIFF_TEAM(it, player), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY_NEUTRAL, Team_ColorCode(player.team), player.netname)));
+ FOREACH_CLIENT(IS_PLAYER(it) && it != player && DIFF_TEAM(it, player), { Send_Notification(NOTIF_ONE, it, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY_NEUTRAL, Team_ColorCode(player.team), player.netname); });
if(flag.team)
- FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
if(CTF_SAMETEAM(flag, it))
if(SAME_TEAM(player, it))
Send_Notification(NOTIF_ONE, it, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
else
Send_Notification(NOTIF_ONE, it, MSG_CHOICE, ((SAME_TEAM(flag, player)) ? CHOICE_CTF_PICKUP_ENEMY_TEAM : CHOICE_CTF_PICKUP_ENEMY), Team_ColorCode(player.team), player.netname);
- ));
+ });
_sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTEN_NONE);
if (!wpforenemy_announced)
{
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((it.flagcarried) ? CENTER_CTF_STALEMATE_CARRIER : CENTER_CTF_STALEMATE_OTHER))));
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((it.flagcarried) ? CENTER_CTF_STALEMATE_CARRIER : CENTER_CTF_STALEMATE_OTHER)); });
wpforenemy_announced = true;
}
// captureshield
if(this == ctf_worldflaglist) // only for the first flag
- FOREACH_CLIENT(true, LAMBDA(ctf_CaptureShield_Update(it, 1))); // release shield only
+ FOREACH_CLIENT(true, { ctf_CaptureShield_Update(it, 1); }); // release shield only
// sanity checks
if(this.mins != this.m_mins || this.maxs != this.m_maxs) { // reset the flag boundaries in case it got squished
int c = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
if(DIFF_TEAM(it, bot) || IS_DEAD(it) || it == bot)
continue;
if(vdist(it.origin - org, <, tc_radius))
++c;
- ));
+ });
return c;
}
// if there is only me on the team switch to offense
c = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this), LAMBDA(++c));
+ FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this), { ++c; });
if(c==1)
{
// if enemies are closer to our base, go there
entity closestplayer = NULL;
float distance, bestdistance = 10000;
- FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), {
distance = vlen(org - it.origin);
if(distance<bestdistance)
{
closestplayer = it;
bestdistance = distance;
}
- ));
+ });
if(closestplayer)
if(DIFF_TEAM(closestplayer, this))
}
}
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
if(it.flagcarried && (it.team == _team || _team == 0))
{
found = true;
continue; // already spectating this fc, try another
return superspec_Spectate(player, it);
}
- ));
+ });
if(!found)
superspec_msg("", "", player, "No active flag carrier\n", 1);
race_ClearRecords();
PlayerScore_Sort(race_place, 0, 1, 0);
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
if(it.race_place)
{
s = PlayerScore_Add(it, SP_RACE_FASTEST, 0);
it.race_place = 0;
}
cts_EventLog(ftos(it.race_place), it);
- ));
+ });
if(g_race_qualifying == 2)
{
this.captime = time;
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(set_dom_state(it)));
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), { set_dom_state(it); });
}
void AnimateDomPoint(entity this)
void Domination_RoundStart()
{
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.player_blocked = false));
+ FOREACH_CLIENT(IS_PLAYER(it), { it.player_blocked = false; });
}
//go to best items, or control points you don't own
MUTATOR_HOOKFUNCTION(dom, reset_map_players)
{
total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
PutClientInServer(it);
if(domination_roundbased)
it.player_blocked = 1;
if(IS_REAL_CLIENT(it))
set_dom_state(it);
- ));
+ });
return true;
}
void freezetag_count_alive_players()
{
total_players = redalive = bluealive = yellowalive = pinkalive = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
switch(it.team)
{
case NUM_TEAM_1: ++total_players; if(it.health >= 1 && STAT(FROZEN, it) != 1) ++redalive; break;
case NUM_TEAM_3: ++total_players; if(it.health >= 1 && STAT(FROZEN, it) != 1) ++yellowalive; break;
case NUM_TEAM_4: ++total_players; if(it.health >= 1 && STAT(FROZEN, it) != 1) ++pinkalive; break;
}
- ));
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ });
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), {
it.redalive_stat = redalive;
it.bluealive_stat = bluealive;
it.yellowalive_stat = yellowalive;
it.pinkalive_stat = pinkalive;
- ));
+ });
eliminatedPlayers.SendFlags |= 1;
}
{
Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_OVER);
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_OVER);
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
it.freezetag_frozen_timeout = 0;
nades_Clear(it);
- ));
+ });
game_stopped = true;
round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
return 1;
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_TIED);
}
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
it.freezetag_frozen_timeout = 0;
nades_Clear(it);
- ));
+ });
game_stopped = true;
round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
entity freezetag_LastPlayerForTeam(entity this)
{
entity last_pl = NULL;
- FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
if(it.health >= 1)
if(!STAT(FROZEN, it))
if(SAME_TEAM(it, this))
last_pl = it;
else
return NULL;
- ));
+ });
return last_pl;
}
void havocbot_goalrating_freeplayers(entity this, float ratingscale, vector org, float sradius)
{
float t;
- FOREACH_CLIENT(IS_PLAYER(it) && it != this && SAME_TEAM(it, this), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this && SAME_TEAM(it, this), {
if (STAT(FROZEN, it) == 1)
{
if(vdist(it.origin - org, >, sradius))
t = 0.2 * 150 / (this.health + this.armorvalue);
navigation_routerating(this, it, t * ratingscale, 2000);
}
- ));
+ });
}
void havocbot_role_ft_offense(entity this)
// Count how many players on team are unfrozen.
int unfrozen = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this) && !(STAT(FROZEN, it) != 1), LAMBDA(unfrozen++));
+ FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this) && !(STAT(FROZEN, it) != 1), { unfrozen++; });
// If only one left on team or if role has timed out then start trying to free players.
if (((unfrozen == 0) && (!STAT(FROZEN, this))) || (time > this.havocbot_role_timeout))
MUTATOR_HOOKFUNCTION(ft, reset_map_players)
{
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
CS(it).killcount = 0;
it.freezetag_frozen_timeout = -1;
PutClientInServer(it);
it.freezetag_frozen_timeout = 0;
- ));
+ });
freezetag_count_alive_players();
return true;
}
{
vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
n = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && it != player, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
if(STAT(FROZEN, it) == 0)
if(!IS_DEAD(it))
if(SAME_TEAM(it, player))
it.reviving = true;
++n;
}
- ));
+ });
}
}
// EVERY team mate nearby gets a point (even if multiple!)
- FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, {
PlayerScore_Add(it, SP_FREEZETAG_REVIVALS, +1);
PlayerScore_Add(it, SP_SCORE, +1);
nades_GiveBonus(it,autocvar_g_nades_bonus_score_low);
- ));
+ });
Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname);
Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_REVIVED, player.netname, o.netname);
}
- FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, {
it.revive_progress = player.revive_progress;
it.reviving = false;
- ));
+ });
}
else if(!n && STAT(FROZEN, player) == 1) // only if no teammate is nearby will we reset
{
}
else
{
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
float cs = PlayerScore_Add(it, SP_KILLS, 0);
if(cs > winning_score)
{
winning_score = cs;
winner = it;
}
- ));
+ });
}
IL_EACH(g_monsters, true,
void Invasion_RoundStart()
{
int numplayers = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
it.player_blocked = false;
++numplayers;
- ));
+ });
if(inv_roundcnt < inv_maxrounds)
inv_roundcnt += 1; // a limiter to stop crazy counts
s |= (32 ** key.count) * f;
}
- FOREACH_CLIENT(true, LAMBDA(it.kh_state = s));
+ FOREACH_CLIENT(true, { it.kh_state = s; });
FOR_EACH_KH_KEY(key)
{
{
if (!k.owner) continue;
entity first = WP_Null;
- FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, LAMBDA(first = it; break));
+ FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, { first = it; break; });
entity third = WP_Null;
- FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, LAMBDA(third = it; break));
+ FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, { third = it; break; });
WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, first, WP_KeyCarrierFinish, third);
}
}
{
if (!k.owner) continue;
entity first = WP_Null;
- FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, LAMBDA(first = it; break));
+ FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, { first = it; break; });
entity third = WP_Null;
- FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, LAMBDA(third = it; break));
+ FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, { third = it; break; });
WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, first, WP_KeyCarrierFriend, third);
}
}
int players = 0;
float of = autocvar_g_balance_keyhunt_score_destroyed_ownfactor;
- FOREACH_CLIENT(IS_PLAYER(it) && it.team != loser_team, LAMBDA(++players));
+ FOREACH_CLIENT(IS_PLAYER(it) && it.team != loser_team, { ++players; });
entity key;
int keys = 0;
continue;
players = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, LAMBDA(++players));
+ FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, { ++players; });
DistributeEvenly_Init(fragsleft, j);
fragsleft = DistributeEvenly_Get(j - 1);
DistributeEvenly_Init(DistributeEvenly_Get(1), players);
- FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, {
f = DistributeEvenly_Get(1);
kh_Scores_Event(it, NULL, "destroyed", f, 0);
- ));
+ });
--j;
}
if(kh_interferemsg_time && time > kh_interferemsg_time)
{
kh_interferemsg_time = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
if(it.team == kh_interferemsg_team)
if(it.kh_next)
Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_MEET);
Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_HELP);
else
Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(kh_interferemsg_team, CENTER_KEYHUNT_INTERFERE));
- ));
+ });
}
this.nextthink = time + 0.05;
{
int teem = kh_Team_ByID(i);
int players = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == teem)
++players;
- ));
+ });
if (!players)
missing_teams |= (2 ** i);
}
int teem = kh_Team_ByID(i);
int players = 0;
entity my_player = NULL;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == teem)
{
++players;
if(random() * players <= 1)
my_player = it;
}
- ));
+ });
kh_Key_Spawn(my_player, 360 * i / NumTeams(kh_teams), i);
}
MUTATOR_HOOKFUNCTION(lms, Bot_FixCount, CBC_ORDER_EXCLUSIVE)
{
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), {
++M_ARGV(0, int); // activerealplayers
++M_ARGV(1, int); // realplayers
- ));
+ });
return true;
}
n = 0;
c = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
++n;
if(CS(it).race_completed)
++c;
- ));
+ });
if(n && (n == c))
return WINNING_YES;
wc = WinningCondition_Scores(fraglimit, 0);
race_ClearRecords();
PlayerScore_Sort(race_place, 0, 1, 0);
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
if(it.race_place)
{
s = PlayerScore_Add(it, SP_RACE_FASTEST, 0);
it.race_place = 0;
}
race_EventLog(ftos(it.race_place), it);
- ));
+ });
if(g_race_qualifying == 2)
{
float pcount = 1; // Include myself whether or not team is already set right and I'm a "player".
if (teamplay)
{
- FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
if(it.team == this.team)
++pcount;
- ));
+ });
if (sdelay_small_count == 0)
sdelay_small_count = 1;
if (sdelay_large_count == 0)
}
else
{
- FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
++pcount;
- ));
+ });
if (sdelay_small_count == 0)
{
if (IS_INDEPENDENT_PLAYER(this))
fixedmakevectors(this.mangle);
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
if(it != o)
if(IS_INDEPENDENT_PLAYER(it) || IS_INDEPENDENT_PLAYER(o))
continue; // cannot go through someone else's portal
if(it.(weaponentity).hook)
Portal_Think_TryTeleportPlayer(this, it.(weaponentity).hook, g);
}
- ));
+ });
this.solid = SOLID_TRIGGER;
this.aiment = o;
#endif
strunzone(race_checkpoint_recordholders[cp]);
race_checkpoint_recordholders[cp] = strzone(e.netname);
if(g_race_qualifying)
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.race_checkpoint == cp, LAMBDA(race_SendNextCheckpoint(it, 0)));
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.race_checkpoint == cp, { race_SendNextCheckpoint(it, 0); });
}
}
void race_StartCompleting()
{
race_completing = 1;
- FOREACH_CLIENT(IS_PLAYER(it) && IS_DEAD(it), LAMBDA(race_AbandonRaceCheck(it)));
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_DEAD(it), { race_AbandonRaceCheck(it); });
}
void race_PreparePlayer(entity this)
race_checkpoint_recordholders[j] = string_null;
}
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
float p = it.race_place;
race_PreparePlayer(it);
it.race_place = p;
- ));
+ });
}
void race_ImposePenaltyTime(entity pl, float penalty, string reason)
WinningConditionHelper_second = NULL;
winnerscorekeeper = NULL;
secondscorekeeper = NULL;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
sk = CS(it).scorekeeper;
c = PlayerScore_Compare(winnerscorekeeper, sk, 1);
if(c < 0)
secondscorekeeper = sk;
}
}
- ));
+ });
WinningConditionHelper_equality = (PlayerScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
if(WinningConditionHelper_equality)
strunzone(worldstatus);
worldstatus = strzone(s);
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
string s = "";
if(fullstatus)
{
if(it.clientstatus)
strunzone(it.clientstatus);
it.clientstatus = strzone(s);
- ));
+ });
}
string GetScoreLogLabel(string label, float fl)
plist = NULL;
- FOREACH_CLIENT(true, LAMBDA(it.(field) = 0));
+ FOREACH_CLIENT(true, { it.(field) = 0; });
FOREACH_CLIENT(CS(it).scorekeeper,
{
}
t = 0;
- FOREACH_CLIENT(!IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(!IS_PLAYER(it), {
if (!t)
Score_NicePrint_Spectators(to);
Score_NicePrint_Spectator(to, it);
t = 1;
- ));
+ });
}
void PlayerScore_PlayerStats(entity p)
}
shortest = vlen(world.maxs - world.mins);
- FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
thisdist = vlen(it.origin - spot.origin);
if (thisdist < shortest)
shortest = thisdist;
- ));
+ });
if(shortest > mindist)
prio += SPAWN_PRIO_GOOD_DISTANCE;
void Pause_TryPause(bool ispaused)
{
int n = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
if (PHYS_INPUT_BUTTON_CHAT(it) != ispaused) return;
++n;
- ));
+ });
if (!n) return;
setpause(ispaused);
}
LOG_INFO("CEFC time: ", ftos(t * 1000), "ms; ");
int c_seeing = 0;
int c_seen = 0;
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
if(IS_REAL_CLIENT(it))
++c_seeing;
if(IS_PLAYER(it))
++c_seen;
- ));
+ });
LOG_INFO("CEFC calls per second: ", ftos(c_seeing * (c_seen - 1) / t), "; ");
LOG_INFO("CEFC 100% load at: ", ftos(solve_quadratic(t, -t, -1) * '0 1 0'), "\n");
// FIXME: also find and memorize the lowest-scoring bot on each team (in case players must be shuffled around)
// also remember the lowest-scoring player
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
float t;
if(IS_PLAYER(it) || it.caplayer)
t = it.team;
}
}
}
- ));
+ });
// if the player who has a forced team has not joined yet, reserve the spot
if(autocvar_g_campaign)
lowest_player_score = 999999999;
// find the lowest-scoring player & bot of that team
- FOREACH_CLIENT(IS_PLAYER(it) && it.team == steam, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it.team == steam, {
if(it.isbot)
{
if(it.totalfrags < lowest_bot_score)
lowest_player_score = it.totalfrags;
}
}
- ));
+ });
// prefers to move a bot...
if(lowest_bot != NULL)
if (b == accuracy_byte(a.accuracy_hit[w], a.accuracy_fired[w])) return; // no change
int sf = 1 << (w % 24);
a.SendFlags |= sf;
- FOREACH_CLIENT(IS_SPEC(it) && it.enemy == this, LAMBDA(CS(it).accuracy.SendFlags |= sf));
+ FOREACH_CLIENT(IS_SPEC(it) && it.enemy == this, { CS(it).accuracy.SendFlags |= sf; });
}
bool accuracy_isgooddamage(entity attacker, entity targ)
for (int i = 1; i < t; ++i)
{
s = argv(i);
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(it.netname == s)
{
entity replacement = spawn();
weapon_defaultspawnfunc(replacement, it);
break;
}
- ));
+ });
}
}
if (t >= 1) // always the case!
{
s = argv(0);
wpn = WEP_Null;
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
if(it.netname == s)
{
wpn = it;
break;
}
- ));
+ });
}
if (wpn == WEP_Null)
{
else
{
int superweapons = 1;
- FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ FOREACH(Weapons, it != WEP_Null, {
WepSet set = it.m_wepset;
if((set & WEPSET_SUPERWEAPONS) && (own.weapons & set)) ++superweapons;
- ));
+ });
if(superweapons <= 1)
{
wep.superweapons_finished = own.superweapons_finished;
// Find all non-hit players the beam passed close by
if(deathtype == WEP_VAPORIZER.m_id || deathtype == WEP_VORTEX.m_id)
{
- FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != this, LAMBDA(
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != this, {
if(!it.railgunhit)
if(!(IS_SPEC(it) && it.enemy == this))
{
pseudoprojectile = spawn(); // we need this so the sound uses the "entchannel4" volume
soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, SND(NEXWHOOSH_RANDOM()), VOL_BASE * f, ATTEN_NONE);
}
- ));
+ });
if(pseudoprojectile)
delete(pseudoprojectile);
if (this)
{
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
if(it == actor || (IS_SPEC(it) && it.enemy == actor))
wframe_send(it, this, a, restartanim);
- ));
+ });
}
if ((fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2) && t)