From: Lyberta Date: Sat, 25 Mar 2017 11:50:46 +0000 (+0300) Subject: Survival: Switched to notification system + sprite fix. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0eb05412523cada455c10198aada9b86db6de36e;p=xonotic%2Fxonotic-data.pk3dir.git Survival: Switched to notification system + sprite fix. --- diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index 259981509..ba9d950fc 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -442,6 +442,15 @@ 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"), "") @@ -771,6 +780,15 @@ 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"), "") diff --git a/qcsrc/server/mutators/mutator/gamemode_survival.qc b/qcsrc/server/mutators/mutator/gamemode_survival.qc index 3af8de59c..ed4e56800 100644 --- a/qcsrc/server/mutators/mutator/gamemode_survival.qc +++ b/qcsrc/server/mutators/mutator/gamemode_survival.qc @@ -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.