]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/ctf.qc
beginning of a SANE accuracy networking system
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / ctf.qc
index 4148136daf62dd0454c3c80f9c92c3359edeb75e..690231b605c90b0728e4d99f24d4fe040324a94f 100644 (file)
@@ -188,7 +188,7 @@ void place_flag()
        self.nextthink = time + 0.1;
        self.cnt = FLAG_BASE;
        self.mangle = self.angles;
-       self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP;
+       self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
        //self.effects = self.effects | EF_DIMLIGHT;
        if(self.noalign)
        {
@@ -473,7 +473,7 @@ void FlagTouch()
                                h0 = strcat(h0, "^7's"); // h0: display text for previous netname
                        if (flagcaptimerecord == 0)
                        {
-                               bprint(other.netname, "^7 captured the ", other.flagcarried.netname, " in ", s, " seconds\n");
+                               s = strcat(" in ", s, " seconds");
                                flagcaptimerecord = t;
                                db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time"), ftos(t));
                                db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"), h1);
@@ -481,7 +481,7 @@ void FlagTouch()
                        }
                        else if (t < flagcaptimerecord)
                        {
-                               bprint(other.netname, "^7 captured the ", other.flagcarried.netname, " in ", s, ", breaking ", strcat(h0, " previous record of ", s0, " seconds\n"));
+                               s = strcat(" in ", s, " seconds, breaking ", h0, " previous record of ", s0, " seconds");
                                flagcaptimerecord = t;
                                db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time"), ftos(t));
                                db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"), h1);
@@ -489,11 +489,13 @@ void FlagTouch()
                        }
                        else
                        {
-                               bprint(other.netname, "^7 captured the ", other.flagcarried.netname, " in ", s, ", failing to break ", strcat(h0, " record of ", s0, " seconds\n"));
+                               s = strcat(" in ", s, " seconds, failing to break ", h0, " record of ", s0, " seconds");
                        }
                }
                else
-                       bprint(other.netname, "^7 captured the ", other.flagcarried.netname, "\n");
+                       s = "";
+
+               Send_KillNotification (other.netname, other.flagcarried.netname, s, INFO_CAPTUREFLAG, MSG_INFO);
 
                PlayerTeamScore_Add(other, SP_CTF_CAPS, ST_CTF_CAPS, 1);
                LogCTF("capture", other.flagcarried.team, other);
@@ -1056,42 +1058,40 @@ void ctf_setstatus()
        self.items &~= IT_BLUE_FLAG_LOST;
        self.items &~= IT_CTF_SHIELDED;
 
-       if (g_ctf) {
-               local entity flag;
-               float redflags, blueflags;
+       local entity flag;
+       float redflags, blueflags;
 
-               if(self.ctf_captureshielded)
-                       self.items |= IT_CTF_SHIELDED;
+       if(self.ctf_captureshielded)
+               self.items |= IT_CTF_SHIELDED;
 
-               redflags = 0;
-               blueflags = 0;
+       redflags = 0;
+       blueflags = 0;
 
-               for (flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext) if(flag.cnt != FLAG_BASE)
-               {
-                       if(flag.items & IT_KEY2) // blue
-                               ++redflags;
-                       else if(flag.items & IT_KEY1) // red
-                               ++blueflags;
-               }
+       for (flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext) if(flag.cnt != FLAG_BASE)
+       {
+               if(flag.items & IT_KEY2) // blue
+                       ++redflags;
+               else if(flag.items & IT_KEY1) // red
+                       ++blueflags;
+       }
 
-               // blinking magic: if there is more than one flag, show one of these in a clever way
-               if(redflags)
-                       redflags = mod(floor(time * redflags * 0.75), redflags);
-               if(blueflags)
-                       blueflags = mod(floor(time * blueflags * 0.75), blueflags);
+       // blinking magic: if there is more than one flag, show one of these in a clever way
+       if(redflags)
+               redflags = mod(floor(time * redflags * 0.75), redflags);
+       if(blueflags)
+               blueflags = mod(floor(time * blueflags * 0.75), blueflags);
 
-               for (flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext) if(flag.cnt != FLAG_BASE)
+       for (flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext) if(flag.cnt != FLAG_BASE)
+       {
+               if(flag.items & IT_KEY2) // blue
                {
-                       if(flag.items & IT_KEY2) // blue
-                       {
-                               if(--redflags == -1) // happens exactly once (redflags is in 0..count-1, and will --'ed count times)
-                                       ctf_setstatus2(flag, IT_RED_FLAG_TAKEN);
-                       }
-                       else if(flag.items & IT_KEY1) // red
-                       {
-                               if(--blueflags == -1) // happens exactly once
-                                       ctf_setstatus2(flag, IT_BLUE_FLAG_TAKEN);
-                       }
+                       if(--redflags == -1) // happens exactly once (redflags is in 0..count-1, and will --'ed count times)
+                               ctf_setstatus2(flag, IT_RED_FLAG_TAKEN);
+               }
+               else if(flag.items & IT_KEY1) // red
+               {
+                       if(--blueflags == -1) // happens exactly once
+                               ctf_setstatus2(flag, IT_BLUE_FLAG_TAKEN);
                }
        }
 };