Merge branch 'master' into terencehill/lms_itemtimes_fix 266/head
authorterencehill <piuntn@gmail.com>
Fri, 1 Jan 2016 22:16:25 +0000 (23:16 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 1 Jan 2016 22:16:25 +0000 (23:16 +0100)
Conflicts:
qcsrc/server/mutators/mutator/gamemode_lms.qc

qcsrc/common/mutators/mutator/itemstime.qc
qcsrc/server/mutators/mutator/gamemode_lms.qc

index 20b4303..4f4f81f 100644 (file)
@@ -26,6 +26,17 @@ NET_HANDLE(itemstime, bool isNew)
 #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;
@@ -144,6 +155,17 @@ MUTATOR_HOOKFUNCTION(itemstime, MakePlayerObserver)
     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;
index 9c9e191..9d82004 100644 (file)
@@ -157,10 +157,9 @@ MUTATOR_HOOKFUNCTION(lms, reset_map_global)
 }
 
 MUTATOR_HOOKFUNCTION(lms, reset_map_players)
-{SELFPARAM();
+{
        if(restart_mapalreadyrestarted || (time < game_starttime))
-       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;
 }