]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clean up CTF monster checks a little
authorMario <mario.mario@y7mail.com>
Thu, 26 Dec 2013 05:38:53 +0000 (16:38 +1100)
committerMario <mario.mario@y7mail.com>
Thu, 26 Dec 2013 05:38:53 +0000 (16:38 +1100)
qcsrc/common/notifications.qh
qcsrc/server/command/cmd.qc
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/target_spawn.qc

index e434187cea46b5d39521727921eeffd9f7bc1787..578fed72418c5ca277a95a5639d4a1db8e18096d 100644 (file)
@@ -352,6 +352,7 @@ void Send_Notification_WOCOVA(
        MULTITEAM_INFO(1, INFO_CTF_LOST_, 2,                   1, 0, "s1", "s1",                        "notify_%s_lost",       _("^BG%s^BG lost the ^TC^TT^BG flag"), "") \
        MULTITEAM_INFO(1, INFO_CTF_PICKUP_, 2,                 1, 0, "s1", "s1",                        "notify_%s_taken",      _("^BG%s^BG got the ^TC^TT^BG flag"), "") \
        MULTITEAM_INFO(1, INFO_CTF_RETURN_, 2,                 1, 0, "s1", "s1",                        "notify_%s_returned",   _("^BG%s^BG returned the ^TC^TT^BG flag"), "") \
+       MULTITEAM_INFO(1, INFO_CTF_RETURN_MONSTER_, 2,         1, 0, "s1", "s1",                        "notify_%s_returned",   _("^BG%s^BG returned the ^TC^TT^BG flag"), "") \
        MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_CHEAT,             3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1",  "notify_death",         _("^BG%s%s^K1 was unfairly eliminated by ^BG%s^K1%s%s"), "") \
        MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_DROWN,             3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1",  "notify_water",         _("^BG%s%s^K1 was drowned by ^BG%s^K1%s%s"), "") \
        MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_FALL,              3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1",  "notify_fall",          _("^BG%s%s^K1 was grounded by ^BG%s^K1%s%s"), "") \
index 7b1af114cae0419a9cd063ace891ba8768a55123..f5a37191d17a68f5638849f1e01cfeaa410bc154 100644 (file)
@@ -212,6 +212,8 @@ void ClientCommand_mobedit(float request, float argc)
                                                }
                                        }
                                }
+                               
+                               return;
                        }
                }
                default:
index d3565578ae5834f257eb8d74af63e78d465ee866..66c7b8715f900707381039f7913cf10faddcbc08 100644 (file)
@@ -431,10 +431,15 @@ void ctf_Handle_Capture(entity flag, entity toucher, float capturetype)
 void ctf_Handle_Return(entity flag, entity player)
 {
        // messages and sounds
-       if(IS_PLAYER(player))
+       if(player.flags & FL_MONSTER)
+       {
+               Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_RETURN_MONSTER_), player.monster_name);
+       }
+       else
+       {
                Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_RETURN_));
-               
-       Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_RETURN_), (player.flags & FL_MONSTER) ? player.monster_name : player.netname);
+               Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_RETURN_), player.netname);
+       }
        sound(player, CH_TRIGGER, flag.snd_flag_returned, VOL_BASE, ATTEN_NONE);
        ctf_EventLog("return", flag.team, player);
 
@@ -775,6 +780,7 @@ void ctf_FlagTouch()
        if(gameover) { return; }
 
        entity toucher = other;
+       float is_not_monster = (!(toucher.flags & FL_MONSTER));
 
        // automatically kill the flag and return it if it touched lava/slime/nodrop surfaces
        if(ITEM_TOUCH_NEEDKILL())
@@ -813,9 +819,9 @@ void ctf_FlagTouch()
        {
                case FLAG_BASE:
                {
-                       if(SAME_TEAM(toucher, self) && (toucher.flagcarried) && DIFF_TEAM(toucher.flagcarried, self) && !(toucher.flags & FL_MONSTER))
+                       if(SAME_TEAM(toucher, self) && (toucher.flagcarried) && DIFF_TEAM(toucher.flagcarried, self) && is_not_monster)
                                ctf_Handle_Capture(self, toucher, CAPTURE_NORMAL); // toucher just captured the enemies flag to his base
-                       else if(DIFF_TEAM(toucher, self) && (!toucher.flagcarried) && (!toucher.ctf_captureshielded) && (time > toucher.next_take_time) && !(toucher.flags & FL_MONSTER))
+                       else if(DIFF_TEAM(toucher, self) && (!toucher.flagcarried) && (!toucher.ctf_captureshielded) && (time > toucher.next_take_time) && is_not_monster)
                                ctf_Handle_Pickup(self, toucher, PICKUP_BASE); // toucher just stole the enemies flag
                        break;
                }
@@ -824,7 +830,7 @@ void ctf_FlagTouch()
                {
                        if(SAME_TEAM(toucher, self))
                                ctf_Handle_Return(self, toucher); // toucher just returned his own flag
-                       else if(!(toucher.flags & FL_MONSTER) && (!toucher.flagcarried) && ((toucher != self.ctf_dropper) || (time > self.ctf_droptime + autocvar_g_ctf_flag_collect_delay)))
+                       else if(is_not_monster && (!toucher.flagcarried) && ((toucher != self.ctf_dropper) || (time > self.ctf_droptime + autocvar_g_ctf_flag_collect_delay)))
                                ctf_Handle_Pickup(self, toucher, PICKUP_DROPPED); // toucher just picked up a dropped enemy flag
                        break;
                }
index 657e7cb0e7b0a3082c03c9b2b36825b7fdd24556..4da6b13bbbb948060ec40541307eeffddf84be95 100644 (file)
@@ -216,8 +216,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity
                        self = e;
                        activator = act;
 
-                       if(self.target_spawn_spawnfunc)
-                               self.target_spawn_spawnfunc();
+                       self.target_spawn_spawnfunc();
 
                        self = oldself;
                        activator = oldactivator;