#endif
#ifdef CSQC
+void Item_ItemsTime_Init()
+{
+ FOREACH(Items, true, LAMBDA(
+ ItemsTime_time[it.m_id] = -1;
+ ));
+}
+
+STATIC_INIT(ItemsTime_Init) {
+ Item_ItemsTime_Init();
+}
+
int autocvar_hud_panel_itemstime = 2;
float autocvar_hud_panel_itemstime_dynamicsize = 1;
float autocvar_hud_panel_itemstime_ratio = 2;
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)
Item_ItemsTime_SetTimesForPlayer(self);
}
+MUTATOR_HOOKFUNCTION(itemstime, ClientConnect, CBC_ORDER_LAST)
+{SELFPARAM();
+ if(IS_PLAYER(self))
+ {
+ // client became player on connection skipping putObserverInServer step
+ if (IS_REAL_CLIENT(self))
+ if (warmup_stage)
+ Item_ItemsTime_SetTimesForPlayer(self);
+ }
+}
+
MUTATOR_HOOKFUNCTION(itemstime, PlayerSpawn)
{SELFPARAM();
if (warmup_stage) return;
#ifdef IMPLEMENTATION
- #include "../../campaign.qh"
- #include "../../command/cmd.qh"
+ #include <server/campaign.qh>
+ #include <server/command/cmd.qh>
int autocvar_g_lms_extra_lives;
bool autocvar_g_lms_join_anytime;
// LMS winning condition: game terminates if and only if there's at most one
// one player who's living lives. Top two scores being equal cancels the time
// limit.
- float WinningCondition_LMS()
+ int WinningCondition_LMS()
{
entity head, head2;
- float have_player;
- float have_players;
- float l;
+ bool have_player = false;
+ bool have_players = false;
- have_player = false;
- have_players = false;
- l = LMS_NewPlayerLives();
+ int l = LMS_NewPlayerLives();
- head = find(world, classname, "player");
+ head = find(world, classname, STR_PLAYER);
if(head)
have_player = true;
- head2 = find(head, classname, "player");
+ head2 = find(head, classname, STR_PLAYER);
if(head2)
have_players = true;
}
MUTATOR_HOOKFUNCTION(lms, reset_map_players)
-{SELFPARAM();
+{
- entity e;
if(restart_mapalreadyrestarted || (time < game_starttime))
- FOR_EACH_PLAYER(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()))));
--
++ FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(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;
}