e.oldorigin_x = compressShortVector(e.velocity);
- entity cl; FOR_EACH_REALCLIENT(cl) Violence_GibSplash_SendEntity(e, cl, 0);
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(Violence_GibSplash_SendEntity(e, it, 0)));
remove(e);
}
if (fake) { msg_entity = this; X(); }
else
{
- FOR_EACH_REALCLIENT(msg_entity)
- {
- if (!teamplay || msg_entity.team == this.team) X();
- }
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && (!teamplay || msg_entity.team == this.team), LAMBDA(
+ msg_entity = it;
+ X();
+ ));
}
#undef X
break;
}
else
{
- FOR_EACH_REALCLIENT(msg_entity)
- {
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ msg_entity = it;
X();
- }
+ ));
}
#undef X
break;
const int armor = MUTATOR_ARGV(1, int);
const int deathtype = MUTATOR_ARGV(2, int);
const vector location = hit.origin;
- entity e;
- FOR_EACH_REALCLIENT(e) if (
- (SV_DAMAGETEXT_ALL()) ||
- (SV_DAMAGETEXT_PLAYERS() && e == attacker) ||
- (SV_DAMAGETEXT_SPECTATORS_ONLY() && IS_SPEC(e) && e.enemy == attacker) ||
- (SV_DAMAGETEXT_SPECTATORS_ONLY() && IS_OBSERVER(e))
- ) {
- msg_entity = e;
- WriteHeader(MSG_ONE, damagetext);
- WriteShort(MSG_ONE, health);
- WriteShort(MSG_ONE, armor);
- WriteEntity(MSG_ONE, hit);
- WriteCoord(MSG_ONE, location.x);
- WriteCoord(MSG_ONE, location.y);
- WriteCoord(MSG_ONE, location.z);
- WriteInt24_t(MSG_ONE, deathtype);
- }
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ if (
+ (SV_DAMAGETEXT_ALL()) ||
+ (SV_DAMAGETEXT_PLAYERS() && it == attacker) ||
+ (SV_DAMAGETEXT_SPECTATORS_ONLY() && IS_SPEC(it) && it.enemy == attacker) ||
+ (SV_DAMAGETEXT_SPECTATORS_ONLY() && IS_OBSERVER(it))
+ ) {
+ msg_entity = it;
+ WriteHeader(MSG_ONE, damagetext);
+ WriteShort(MSG_ONE, health);
+ WriteShort(MSG_ONE, armor);
+ WriteEntity(MSG_ONE, hit);
+ WriteCoord(MSG_ONE, location.x);
+ WriteCoord(MSG_ONE, location.y);
+ WriteCoord(MSG_ONE, location.z);
+ WriteInt24_t(MSG_ONE, deathtype);
+ }
+ ));
}
#endif
void Item_ItemsTime_SetTimesForAllPlayers()
{
- entity e;
- FOR_EACH_REALCLIENT(e) if (warmup_stage || !IS_PLAYER(e))
- Item_ItemsTime_SetTimesForPlayer(e);
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && (warmup_stage || !IS_PLAYER(it)), LAMBDA(Item_ItemsTime_SetTimesForPlayer(it)));
}
float Item_ItemsTime_UpdateTime(entity e, float t)
void sv_notice_toall(string _notice, float _howlong, float _modal)
{
- entity _head;
- FOR_EACH_REALCLIENT(_head)
- sv_notice_to(_head, _notice, _howlong, _modal);
-
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(sv_notice_to(it, _notice, _howlong, _modal)));
}
#endif // SVQC
}
default:
{
- entity to;
- FOR_EACH_REALCLIENT(to)
- {
- if(Notification_ShouldSend(broadcast, to, client))
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ if(Notification_ShouldSend(broadcast, it, client))
{
- RECURSE_FROM_CHOICE(to, continue);
+ RECURSE_FROM_CHOICE(it, continue);
}
- }
+ ));
break;
}
}
// server has this disabled, kill the DB and set status to idle
if(PS_B_IN_DB >= 0)
{
- entity player;
-
db_close(PS_B_IN_DB);
PS_B_IN_DB = -1;
- FOR_EACH_REALCLIENT(player) { player.playerstats_basicstatus = PS_B_STATUS_IDLE; }
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(it.playerstats_basicstatus = PS_B_STATUS_IDLE));
}
}
}
float vol0, vol1;
vector dir0, dir1;
vector v;
- entity e;
if(time > self.teleport_time)
{
W_Tuba_NoteOff();
}
self.nextthink = time;
dist_mult = WEP_CVAR(tuba, attenuation) / autocvar_snd_soundradius;
- FOR_EACH_REALCLIENT(e)
- if(e != self.realowner)
- {
- v = self.origin - (e.origin + e.view_ofs);
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != self.realowner, LAMBDA(
+ v = self.origin - (it.origin + it.view_ofs);
vol0 = max(0, 1 - vlen(v) * dist_mult);
dir0 = normalize(v);
- v = self.realowner.origin - (e.origin + e.view_ofs);
+ v = self.realowner.origin - (it.origin + it.view_ofs);
vol1 = max(0, 1 - vlen(v) * dist_mult);
dir1 = normalize(v);
if(fabs(vol0 - vol1) > 0.005) // 0.5 percent change in volume
self.SendFlags |= 2;
break;
}
- }
+ ));
}
void W_Tuba_NoteOn(float hittype)
e.clientdata.SendFlags = 1;
// make it spectatable
- entity e2;
- FOR_EACH_REALCLIENT(e2)
- {
- if(e2 != e)
- if(IS_SPEC(e2))
- if(e2.enemy == e)
- e2.clientdata.SendFlags = 1;
- }
+ FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e, LAMBDA(it.clientdata.SendFlags = 1));
}
.string netname_previous;
void MapVote_ClearAllVotes()
{
- FOR_EACH_CLIENT(other)
- other.mapvote = 0;
+ FOREACH_CLIENT(true, LAMBDA(it.mapvote = 0));
}
void MapVote_UnzoneStrings()
GameLogEcho(strcat(":vote:suggestion_accepted:", mapvote_maps[mappos]));
}
- FOR_EACH_REALCLIENT(other)
- FixClientCvars(other);
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(FixClientCvars(it)));
if(gametypevote)
{
}
mapvote_voters = 0;
- FOR_EACH_REALCLIENT(other)
- {
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
++mapvote_voters;
- if(other.mapvote)
+ if(it.mapvote)
{
- i = other.mapvote - 1;
- //dprint("Player ", other.netname, " vote = ", ftos(other.mapvote - 1), "\n");
+ i = it.mapvote - 1;
+ //dprint("Player ", it.netname, " vote = ", ftos(it.mapvote - 1), "\n");
mapvote_selections[i] = mapvote_selections[i] + 1;
}
- }
+ ));
}
float MapVote_CheckRules_2()
return;
totalvotes = 0;
- FOR_EACH_REALCLIENT(other)
- {
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
// hide scoreboard again
- if(other.health != 2342)
+ if(it.health != 2342)
{
- other.health = 2342;
- other.impulse = 0;
- if(IS_REAL_CLIENT(other))
- {
- msg_entity = other;
- WriteByte(MSG_ONE, SVC_FINALE);
- WriteString(MSG_ONE, "");
- }
+ it.health = 2342;
+ it.impulse = 0;
+
+ msg_entity = it;
+ WriteByte(MSG_ONE, SVC_FINALE);
+ WriteString(MSG_ONE, "");
}
// clear possibly invalid votes
- if ( !(mapvote_maps_flags[other.mapvote-1] & GTV_AVAILABLE) )
- other.mapvote = 0;
+ if ( !(mapvote_maps_flags[it.mapvote-1] & GTV_AVAILABLE) )
+ it.mapvote = 0;
// use impulses as new vote
- if(other.impulse >= 1 && other.impulse <= mapvote_count)
- if( mapvote_maps_flags[other.impulse - 1] & GTV_AVAILABLE )
+ if(it.impulse >= 1 && it.impulse <= mapvote_count)
+ if( mapvote_maps_flags[it.impulse - 1] & GTV_AVAILABLE )
{
- other.mapvote = other.impulse;
- MapVote_TouchVotes(other);
+ it.mapvote = it.impulse;
+ MapVote_TouchVotes(it);
}
- other.impulse = 0;
+ it.impulse = 0;
- if(other.mapvote)
+ if(it.mapvote)
++totalvotes;
- }
+ ));
MapVote_CheckRules_1(); // just count
}
MUTATOR_HOOKFUNCTION(lms, reset_map_players)
{SELFPARAM();
- entity e;
if(restart_mapalreadyrestarted || (time < game_starttime))
- FOR_EACH_CLIENT(e)
- if(IS_PLAYER(e))
- {
- WITH(entity, self, e, PlayerScore_Add(e, SP_LMS_LIVES, LMS_NewPlayerLives()));
- }
+ FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(WITH(entity, self, it, PlayerScore_Add(it, SP_LMS_LIVES, LMS_NewPlayerLives()))));
return false;
}
MUTATOR_HOOKFUNCTION(lms, Bot_FixCount, CBC_ORDER_EXCLUSIVE)
{
- entity head;
- FOR_EACH_REALCLIENT(head)
- {
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
++bot_activerealplayers;
++bot_realplayers;
- }
+ ));
return true;
}
if(self.waypointsprite_attached)
{
setself(self.waypointsprite_attached);
- entity e;
- FOR_EACH_REALCLIENT(e)
- if(self.waypointsprite_visible_for_player(e))
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ if(self.waypointsprite_visible_for_player(it))
{
- msg_entity = e;
+ msg_entity = it;
soundto(MSG_ONE, this, CH_TRIGGER, SND(ITEMRESPAWNCOUNTDOWN), VOL_BASE, ATTEN_NORM); // play respawn sound
}
+ ));
setself(this);
WaypointSprite_Ping(self.waypointsprite_attached);