]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Survival: Switched to notification system + sprite fix.
authorLyberta <lyberta@lyberta.net>
Sat, 25 Mar 2017 11:50:46 +0000 (14:50 +0300)
committerLyberta <lyberta@lyberta.net>
Sat, 25 Mar 2017 11:50:46 +0000 (14:50 +0300)
qcsrc/common/notifications/all.inc
qcsrc/server/mutators/mutator/gamemode_survival.qc

index 259981509eeee3a5eb93d579423f13e01e2ca046..ba9d950fcb4d724f2c9dc558381e80badc92d4ec 100644 (file)
 
     MSG_INFO_NOTIF(SUPERWEAPON_PICKUP,                      N_CONSOLE,  1, 0, "s1", "s1",       "superweapons",         _("^BG%s^K1 picked up a Superweapon"), "")
 
+    MSG_INFO_NOTIF(SURVIVAL_1ST_ROUND_ATTACKER,             N_CONSOLE,    0, 0, "", "",         "",                     _("^BGFirst round. Eliminate the enemy team ^F1as fast as you can^BG."), "")
+    MSG_INFO_NOTIF(SURVIVAL_1ST_ROUND_DEFENDER,             N_CONSOLE,    0, 0, "", "",         "",                     _("^BGFirst round. Defend yourself ^F1as long as you can^BG."), "")
+    MSG_INFO_NOTIF(SURVIVAL_2ND_ROUND_ATTACKER,             N_CONSOLE,    0, 1, "f1time", "",   "",                     _("^BGSecond round. Eliminate the enemy team in less than ^F1%s^BG."), "")
+    MSG_INFO_NOTIF(SURVIVAL_2ND_ROUND_DEFENDER,             N_CONSOLE,    0, 1, "f1time", "",   "",                     _("^BGSecond round. Defend yourself for ^F1%s^BG."), "")
+    MSG_INFO_NOTIF(SURVIVAL_COOP_DEFENDER,                  N_CONSOLE,    0, 0, "", "",         "",                     _("^BGDefend yourself ^F1as long as you can^BG."), "")
+    MSG_INFO_NOTIF(SURVIVAL_DEFENDERS_ELIMINATED,           N_CONSOLE,    0, 0, "", "",         "",                     _("^BGDefenders were ^F1eliminated^BG."), "")
+    MSG_INFO_NOTIF(SURVIVAL_DEFENDERS_ELIMINATED_IN,        N_CONSOLE,    0, 1, "f1time", "",   "",                     _("^BGDefenders were eliminated in ^F1%s^BG."), "")
+    MSG_INFO_NOTIF(SURVIVAL_DEFENDERS_SURVIVED,             N_CONSOLE,    0, 0, "", "",         "",                     _("^BGDefenders have ^F1survived^BG."), "")
+
     MSG_INFO_NOTIF(TEAMCHANGE_LARGERTEAM,                   N_CONSOLE,  0, 0, "", "",           "",                     _("^BGYou cannot change to a larger team"), "")
     MSG_INFO_NOTIF(TEAMCHANGE_NOTALLOWED,                   N_CONSOLE,  0, 0, "", "",           "",                     _("^BGYou are not allowed to change teams"), "")
 
     MSG_CENTER_NOTIF(SUPERWEAPON_LOST,                  N_ENABLE,    0, 0, "",               CPID_POWERUP,           "0 0",  _("^F2Superweapons have been lost"), "")
     MSG_CENTER_NOTIF(SUPERWEAPON_PICKUP,                N_ENABLE,    0, 0, "",               CPID_POWERUP,           "0 0",  _("^F2You now have a superweapon"), "")
 
+    MSG_CENTER_NOTIF(SURVIVAL_1ST_ROUND_ATTACKER,       N_ENABLE,    0, 0, "",               CPID_Null,              "0 0",  _("^BGFirst round. Eliminate the enemy team ^F1as fast as you can^BG."), "")
+    MSG_CENTER_NOTIF(SURVIVAL_1ST_ROUND_DEFENDER,       N_ENABLE,    0, 0, "",               CPID_Null,              "0 0",  _("^BGFirst round. Defend yourself ^F1as long as you can^BG."), "")
+    MSG_CENTER_NOTIF(SURVIVAL_2ND_ROUND_ATTACKER,       N_ENABLE,    0, 1, "f1time",         CPID_Null,              "0 0",  _("^BGSecond round. Eliminate the enemy team in less than ^F1%s^BG."), "")
+    MSG_CENTER_NOTIF(SURVIVAL_2ND_ROUND_DEFENDER,       N_ENABLE,    0, 1, "f1time",         CPID_Null,              "0 0",  _("^BGSecond round. Defend yourself for ^F1%s^BG."), "")
+    MSG_CENTER_NOTIF(SURVIVAL_COOP_DEFENDER,            N_ENABLE,    0, 0, "",               CPID_Null,              "0 0",  _("^BGDefend yourself ^F1as long as you can^BG."), "")
+    MSG_CENTER_NOTIF(SURVIVAL_DEFENDERS_ELIMINATED,     N_ENABLE,    0, 0, "",               CPID_Null,              "0 0",  _("^BGDefenders were ^F1eliminated^BG."), "")
+    MSG_CENTER_NOTIF(SURVIVAL_DEFENDERS_ELIMINATED_IN,  N_ENABLE,    0, 1, "f1time",         CPID_Null,              "0 0",  _("^BGDefenders were eliminated in ^F1%s^BG."), "")
+    MSG_CENTER_NOTIF(SURVIVAL_DEFENDERS_SURVIVED,       N_ENABLE,    0, 0, "",               CPID_Null,              "0 0",  _("^BGDefenders have ^F1survived^BG."), "")
+
     MULTITEAM_CENTER(TEAMCHANGE, 4,                     N_ENABLE,    0, 1, "",               CPID_TEAMCHANGE,        "1 f1", _("^K1Changing to ^TC^TT^K1 in ^COUNT"), "", NAME)
     MSG_CENTER_NOTIF(TEAMCHANGE_AUTO,                   N_ENABLE,    0, 1, "",               CPID_TEAMCHANGE,        "1 f1", _("^K1Changing team in ^COUNT"), "")
     MSG_CENTER_NOTIF(TEAMCHANGE_SPECTATE,               N_ENABLE,    0, 1, "",               CPID_TEAMCHANGE,        "1 f1", _("^K1Spectating in ^COUNT"), "")
index 3af8de59ca138890636e8fcd3509fb8e0346866e..ed4e568005374f29d29c013e803fff887090fc83 100644 (file)
@@ -1165,19 +1165,18 @@ bool Surv_CanRoundEnd()
                if (surv_roundtype == SURVIVAL_ROUND_FIRST)
                {
                        surv_timetobeat = time - surv_roundstarttime;
-                       FOREACH_CLIENT(IS_REAL_CLIENT(it),
-                       {
-                               centerprint(it, "^3Defenders have ^2survived^3.");
-                               PrintToChat(it, "^3Defenders have ^2survived^3.");
-                       });
+                       Send_Notification(NOTIF_ALL, NULL, MSG_CENTER,
+                               CENTER_SURVIVAL_DEFENDERS_SURVIVED);
+                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO,
+                               INFO_SURVIVAL_DEFENDERS_SURVIVED);
                        Surv_RoundCleanup();
                        return true;
                }
                surv_timetobeat = autocvar_g_surv_round_timelimit;
-               Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(
-                       surv_defenderteam, CENTER_ROUND_TEAM_WIN));
-               Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(
-                       surv_defenderteam, INFO_ROUND_TEAM_WIN));
+               Send_Notification(NOTIF_ALL, NULL, MSG_CENTER,
+                       CENTER_SURVIVAL_DEFENDERS_SURVIVED);
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO,
+                       INFO_SURVIVAL_DEFENDERS_SURVIVED);
                switch (surv_defenderteam)
                {
                        case NUM_TEAM_1:
@@ -1204,21 +1203,18 @@ bool Surv_CanRoundEnd()
        if (surv_roundtype == SURVIVAL_ROUND_FIRST)
        {
                surv_timetobeat = time - surv_roundstarttime;
-               string message = strcat("^3Defenders were eliminated in ^2",
-                       seconds_tostring(surv_timetobeat), "^3.");
-               FOREACH_CLIENT(IS_REAL_CLIENT(it),
-               {
-                       centerprint(it, message);
-                       PrintToChat(it, message);
-               });
+               Send_Notification(NOTIF_ALL, NULL, MSG_CENTER,
+                       CENTER_SURVIVAL_DEFENDERS_ELIMINATED_IN, surv_timetobeat);
+               Send_Notification(NOTIF_ALL, NULL, MSG_INFO,
+                       INFO_SURVIVAL_DEFENDERS_ELIMINATED_IN, surv_timetobeat);
                Surv_RoundCleanup();
                return true;
        }
        surv_timetobeat = autocvar_g_surv_round_timelimit;
-       Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(
-               surv_attackerteam, CENTER_ROUND_TEAM_WIN));
-       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(surv_attackerteam,
-               INFO_ROUND_TEAM_WIN));
+       Send_Notification(NOTIF_ALL, NULL, MSG_CENTER,
+               CENTER_SURVIVAL_DEFENDERS_ELIMINATED);
+       Send_Notification(NOTIF_ALL, NULL, MSG_INFO,
+               INFO_SURVIVAL_DEFENDERS_ELIMINATED);
        switch (surv_attackerteam)
        {
                case NUM_TEAM_1:
@@ -1249,27 +1245,66 @@ void Surv_RoundStart()
        surv_isroundactive = true;
        surv_roundstarttime = time;
        surv_allowed_to_spawn = false;
-       string attackmessage = "";
-       string defendmessage = "";
        switch (surv_roundtype)
        {
                case SURVIVAL_ROUND_FIRST:
                {
-                       if (surv_type == SURVIVAL_TYPE_COOP)
+                       FOREACH_CLIENT(IS_PLAYER(it),
                        {
-                               defendmessage = "^3Defend yourself ^2as long as you can^3.";
-                               break;
-                       }
-                       attackmessage = "^3First round. Eliminate the enemy team ^2as fast as you can^3.";
-                       defendmessage = "^3First round. Defend yourself ^2as long as you can^3.";
+                               if (it.team == surv_attackerteam)
+                               {
+                                       Send_Notification(NOTIF_TEAM, it, MSG_CENTER,
+                                               CENTER_SURVIVAL_1ST_ROUND_ATTACKER);
+                                       Send_Notification(NOTIF_TEAM, it, MSG_INFO,
+                                               INFO_SURVIVAL_1ST_ROUND_ATTACKER);
+                                       break;
+                               }
+                       });
+                       FOREACH_CLIENT(IS_PLAYER(it),
+                       {
+                               if (it.team == surv_defenderteam)
+                               {
+                                       if (surv_type == SURVIVAL_TYPE_COOP)
+                                       {
+                                               Send_Notification(NOTIF_TEAM, it, MSG_CENTER,
+                                                       CENTER_SURVIVAL_COOP_DEFENDER);
+                                               Send_Notification(NOTIF_TEAM, it, MSG_INFO,
+                                                       INFO_SURVIVAL_COOP_DEFENDER);
+                                               break;
+                                       }
+                                       Send_Notification(NOTIF_TEAM, it, MSG_CENTER,
+                                               CENTER_SURVIVAL_1ST_ROUND_DEFENDER);
+                                       Send_Notification(NOTIF_TEAM, it, MSG_INFO,
+                                               INFO_SURVIVAL_1ST_ROUND_DEFENDER);
+                                       break;
+                               }
+                       });
                        break;
                }
                case SURVIVAL_ROUND_SECOND:
                {
-                       attackmessage = strcat("^3Second round. Eliminate the enemy team in less than ^2",
-                               seconds_tostring(surv_timetobeat), "^3.");
-                       defendmessage = strcat("^3Second round. Defend yourself for ^2",
-                               seconds_tostring(surv_timetobeat), "^3.");
+                       FOREACH_CLIENT(IS_PLAYER(it),
+                       {
+                               if (it.team == surv_attackerteam)
+                               {
+                                       Send_Notification(NOTIF_TEAM, it, MSG_CENTER,
+                                               CENTER_SURVIVAL_2ND_ROUND_ATTACKER, surv_timetobeat);
+                                       Send_Notification(NOTIF_TEAM, it, MSG_INFO,
+                                               INFO_SURVIVAL_2ND_ROUND_ATTACKER, surv_timetobeat);
+                                       break;
+                               }
+                       });
+                       FOREACH_CLIENT(IS_PLAYER(it),
+                       {
+                               if (it.team == surv_defenderteam)
+                               {
+                                       Send_Notification(NOTIF_TEAM, it, MSG_CENTER,
+                                               CENTER_SURVIVAL_2ND_ROUND_DEFENDER, surv_timetobeat);
+                                       Send_Notification(NOTIF_TEAM, it, MSG_INFO,
+                                               INFO_SURVIVAL_2ND_ROUND_DEFENDER, surv_timetobeat);
+                                       break;
+                               }
+                       });
                        break;
                }
        }
@@ -1277,30 +1312,18 @@ void Surv_RoundStart()
        {
                switch (it.team)
                {
-                       case surv_attackerteam:
-                       {
-                               if (IS_REAL_CLIENT(it) && (it.surv_role ==
-                                       SURVIVAL_ROLE_PLAYER))
-                               {
-                                       centerprint(it, attackmessage);
-                                       PrintToChat(it, attackmessage);
-                               }
-                               break;
-                       }
                        case surv_defenderteam:
                        {
-                               if (IS_REAL_CLIENT(it))
-                               {
-                                       centerprint(it, defendmessage);
-                                       PrintToChat(it, defendmessage);
-                               }
                                if (it.surv_role == SURVIVAL_ROLE_PLAYER)
                                {
                                        WaypointSprite_Spawn(WP_AssaultDestroy, 0, 0, it, '0 0 64',
                                                NULL, surv_attackerteam, it, surv_attack_sprite, false,
                                                RADARICON_OBJECTIVE);
-                                       WaypointSprite_UpdateMaxHealth(it.surv_attack_sprite, 100);
-                                       WaypointSprite_UpdateHealth(it.surv_attack_sprite, 100);
+                                       WaypointSprite_UpdateMaxHealth(it.surv_attack_sprite,
+                                               autocvar_g_surv_defender_start_health +
+                                               autocvar_g_surv_defender_start_armor);
+                                       WaypointSprite_UpdateHealth(it.surv_attack_sprite,
+                                               it.health + it.armorvalue);
                                }
                                break;
                        }
@@ -1940,7 +1963,8 @@ MUTATOR_HOOKFUNCTION(surv, PlayerDamaged)
                WaypointSprite_Kill(target.surv_attack_sprite);
                return;
        }
-       WaypointSprite_UpdateHealth(target.surv_attack_sprite, target.health);
+       WaypointSprite_UpdateHealth(target.surv_attack_sprite, target.health +
+               target.armorvalue);
 }
 
 /// \brief Hook which is called when the player dies.