]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Also move the primary or secondary check to notif system
authorSamual Lenks <samual@xonotic.org>
Fri, 1 Mar 2013 07:26:38 +0000 (02:26 -0500)
committerSamual Lenks <samual@xonotic.org>
Fri, 1 Mar 2013 07:26:38 +0000 (02:26 -0500)
qcsrc/common/notifications.qh
qcsrc/server/cl_weaponsystem.qc

index 99c4b35916ad0bf81cd2603650a3d285a3965c6b..1d0626cc18d696111ad9e6249a72ae3b6f3ffcca 100644 (file)
@@ -270,7 +270,8 @@ float CPID_KH_MSG = 10;
        MSG_INFO_NOTIF(0, INFO_ITEM_WEAPON_DROP,                                1, 1, "item_wepname item_wepammo", "",  "",                                             _("^BGYou dropped the ^F1%s^BG%s\n"), "") \
        MSG_INFO_NOTIF(0, INFO_ITEM_WEAPON_GOT,                                 0, 1, "item_wepname", "",                               "",                                             _("^BGYou got the ^F1%s\n"), "") \
        MSG_INFO_NOTIF(0, INFO_ITEM_WEAPON_NOAMMO,                              0, 1, "item_wepname", "",                               "",                                             _("^BGYou don't have enough ammo for the ^F1%s\n"), "") \
-       MSG_INFO_NOTIF(0, INFO_ITEM_WEAPON_UNAVAILABLE,                 0, 1, "item_wepname", "",                               "",                                             _("^BGThe ^F1%s^BG is ^F4not available^BG on this map\n"), "") \
+       MSG_INFO_NOTIF(0, INFO_ITEM_WEAPON_PRIMORSEC,                   0, 3, "item_wepname f2primsec f3primsec", "", "",                               _("^F1%s %s^BG is unable to fire, but its ^F1%s^BG can\n"), "") \
+       MSG_INFO_NOTIF(0, INFO_ITEM_WEAPON_UNAVAILABLE,                 0, 1, "item_wepname", "",                               "",                                             _("^F1%s^BG is ^F4not available^BG on this map\n"), "") \
        MSG_INFO_NOTIF(2, INFO_JOIN_CONNECT,                                    1, 0, "s1", "",                                                 "",                                             _("^BG%s^F3 connected%s\n"), "") \
        MULTITEAM_INFO(2, INFO_JOIN_CONNECT_TEAM_, 4,                   1, 0, "s1", "",                                                 "",                                             _("^BG%s^F3 connected and joined the ^TC^TT\n"), "") \
        MSG_INFO_NOTIF(2, INFO_JOIN_PLAY,                                               1, 0, "s1", "",                                                 "",                                             _("^BG%s^F3 is now playing\n"), "") \
@@ -431,11 +432,12 @@ float CPID_KH_MSG = 10;
        MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_SELF,                                      0, 0, "",                               NO_CPID,                                "0 0", _("^K1You froze yourself"), "") \
        MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_FREEZE,                            1, 0, "s1",                             NO_CPID,                                "0 0", _("^K3You froze ^BG%s"), "") \
        MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_FROZEN,                            1, 0, "s1",                             NO_CPID,                                "0 0", _("^K1You were frozen by ^BG%s"), "") \
-       MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_DONTHAVE,                        0, 1, "item_wepname",                           CPID_ITEM,      "item_centime 0", _("^BGYou do not have the ^F1%s"), "") \
-       MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_DROP,                            1, 1, "item_wepname item_wepammo",      CPID_ITEM,      "item_centime 0", _("^BGYou dropped the ^F1%s^BG%s"), "") \
-       MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_GOT,                             0, 1, "item_wepname",                           CPID_ITEM,      "item_centime 0", _("^BGYou got the ^F1%s"), "") \
-       MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_NOAMMO,                          0, 1, "item_wepname",                           CPID_ITEM,      "item_centime 0", _("^BGYou don't have enough ammo for the ^F1%s"), "") \
-       MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_UNAVAILABLE,                     0, 1, "item_wepname",                           CPID_ITEM,      "item_centime 0", _("^BGThe ^F1%s^BG is ^F4not available^BG on this map"), "") \
+       MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_DONTHAVE,                        0, 1, "item_wepname",                                           CPID_ITEM, "item_centime 0", _("^BGYou do not have the ^F1%s"), "") \
+       MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_DROP,                            1, 1, "item_wepname item_wepammo",                      CPID_ITEM, "item_centime 0", _("^BGYou dropped the ^F1%s^BG%s"), "") \
+       MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_GOT,                             0, 1, "item_wepname",                                           CPID_ITEM, "item_centime 0", _("^BGYou got the ^F1%s"), "") \
+       MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_NOAMMO,                          0, 1, "item_wepname",                                           CPID_ITEM, "item_centime 0", _("^BGYou don't have enough ammo for the ^F1%s"), "") \
+       MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_PRIMORSEC,                       0, 3, "item_wepname f2primsec f3primsec",       CPID_ITEM, "item_centime 0", _("^F1%s %s^BG is unable to fire, but its ^F1%s^BG can"), "") \
+       MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_UNAVAILABLE,                     0, 1, "item_wepname",                                           CPID_ITEM, "item_centime 0", _("^F1%s^BG is ^F4not available^BG on this map"), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_DROPPED,                            1, 0, "s1",                     CPID_KEEPAWAY,                  "0 0", _("^BG%s^BG has dropped the ball!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_PICKUP,                                     1, 0, "s1",                     CPID_KEEPAWAY,                  "0 0", _("^BG%s^BG has picked up the ball!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_WARN,                                       0, 0, "",                               CPID_KA_WARN,                   "0 0", _("^BGKilling people while you don't have the ball gives no points!"), "") \
@@ -537,6 +539,7 @@ float CPID_KH_MSG = 10;
        MSG_MULTI_NOTIF(1, ITEM_WEAPON_DROP,                                            INFO_ITEM_WEAPON_DROP,                                          CENTER_ITEM_WEAPON_DROP) \
        MSG_MULTI_NOTIF(1, ITEM_WEAPON_GOT,                                                     INFO_ITEM_WEAPON_GOT,                                           CENTER_ITEM_WEAPON_GOT) \
        MSG_MULTI_NOTIF(1, ITEM_WEAPON_NOAMMO,                                          INFO_ITEM_WEAPON_NOAMMO,                                        CENTER_ITEM_WEAPON_NOAMMO) \
+       MSG_MULTI_NOTIF(1, ITEM_WEAPON_PRIMORSEC,                                       INFO_ITEM_WEAPON_PRIMORSEC,                                     CENTER_ITEM_WEAPON_PRIMORSEC) \
        MSG_MULTI_NOTIF(1, ITEM_WEAPON_UNAVAILABLE,                                     INFO_ITEM_WEAPON_UNAVAILABLE,                           CENTER_ITEM_WEAPON_UNAVAILABLE) \
        MSG_MULTI_NOTIF(1, WEAPON_THINKING_WITH_PORTALS,                        INFO_WEAPON_THINKING_WITH_PORTALS,                      CENTER_DEATH_SELF_GENERIC) \
        MSG_MULTI_NOTIF(1, WEAPON_CRYLINK_SUICIDE,                                      INFO_WEAPON_CRYLINK_SUICIDE,                            CENTER_DEATH_SELF_GENERIC) \
@@ -683,6 +686,8 @@ string arg_slot[NOTIF_MAX_ARGS];
        ARG_CASE(ARG_CS_SV,             "f4",                           ftos(f4)) \
        ARG_CASE(ARG_CS_SV,             "f1p2dec",                      ftos_decimals(f1/100, 2)) \
        ARG_CASE(ARG_CS_SV,             "f2p2dec",                      ftos_decimals(f2/100, 2)) \
+       ARG_CASE(ARG_CS,                        "f2primsec",            (f2 ? _("secondary") : _("primary"))) \
+       ARG_CASE(ARG_CS,                        "f3primsec",            (f3 ? _("secondary") : _("primary"))) \
        ARG_CASE(ARG_CS,                        "f1secs",                       count_seconds(f1)) \
        ARG_CASE(ARG_CS_SV,                     "f1ord",                        count_ordinal(f1)) \
        ARG_CASE(ARG_CS,                        "f1time",                       process_time("todo", f1)) \
index f1e1ec906cddbc855310a251cf7e318a87aa6b9d..c559c150db4a28adb8b41aca39b737f775277d85 100644 (file)
@@ -714,7 +714,6 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
                                if(clienttype(cl) == CLIENTTYPE_REAL)
                                {
                                        play2(cl, "weapons/unavailable.wav");
-                                       sprint(cl, strcat("You don't have any ammo for the ^2", W_Name(wpn), "\n"));
                                        Send_WeaponComplain (cl, wpn, W_Name(wpn), 0);
                                }
                                return FALSE;
@@ -821,14 +820,6 @@ void W_SwitchToOtherWeapon(entity pl)
                W_SwitchWeapon_Force(pl, ww);
 }
 
-string PrimaryOrSecondary(float secondary)
-{
-       if(secondary)
-               return "secondary";
-       else
-               return "primary";
-}
-
 .float prevdryfire;
 .float prevwarntime;
 float weapon_prepareattack_checkammo(float secondary)
@@ -852,7 +843,15 @@ float weapon_prepareattack_checkammo(float secondary)
                {
                        if(time - self.prevwarntime > 1)
                        {
-                               sprint(self, strcat("^2", W_Name(self.weapon), " ", PrimaryOrSecondary(secondary), "^7 is unable to fire, but its ^2", PrimaryOrSecondary(1 - secondary), "^7 can.\n"));
+                               Send_Notification(
+                                       NOTIF_ONE,
+                                       self,
+                                       MSG_MULTI,
+                                       ITEM_WEAPON_PRIMORSEC,
+                                       self.weapon,
+                                       secondary,
+                                       (1 - secondary)
+                               );
                        }
                        self.prevwarntime = time;
                }