]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix several bugs, also only pass the flag if the team mate isn't behind a wall
authorSamual <samual@xonotic.org>
Sun, 1 Apr 2012 02:00:38 +0000 (22:00 -0400)
committerSamual <samual@xonotic.org>
Sun, 1 Apr 2012 02:00:38 +0000 (22:00 -0400)
defaultXonotic.cfg
qcsrc/server/autocvars.qh
qcsrc/server/mutators/gamemode_ctf.qc

index 0b03ce261b8ddc5904bed5b9aa7a9688cb3b3f08..ee1049bc42b76615b1faf1622053797c8655118d 100644 (file)
@@ -607,13 +607,14 @@ set g_ctf_flag_take_damage 0
 set g_ctf_flag_dropped_waypoint 2 "show dropped flag waypointsprite when a flag is lost. 1 = team only, 2 = for all players"
 set g_ctf_flag_pickup_verbosename 1 "show the name of the person who picked up the flag too"
 set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt"
-set g_ctf_throw_velocity 500 "how far a player can throw the flag"
+set g_ctf_throw_velocity 700 "how fast or far a player can throw the flag"
 set g_ctf_allow_pass 1 "allow passing of flags to nearby team mates"
-set g_ctf_pass_radius 300 "maximum radius that you can pass to a team mate in"
+set g_ctf_pass_radius 500 "maximum radius that you can pass to a team mate in"
 set g_ctf_pass_wait 2 "delay in seconds between how often players can pass the flag (antispam, essentially)"
 set g_ctf_dropped_capture_radius 100 "allow dropped flags to be automatically captured by base flags if the dropped flag is within this radius of it"
 set g_ctf_pass_request 1 "allow players to request the flag carrier to pass the flag to them"
 set g_ctf_pass_turnrate 50 "how well the flag follows the best direction to its target while passing"
+set g_ctf_pass_timelimit 2 "how long a flag can stay trying to pass before it gives up and just becomes dropped"
 
 set g_ctf_shield_max_ratio 0   "shield at most this percentage of a team from the enemy flag (try: 0.4 for 40%)"
 set g_ctf_shield_min_negscore 20       "shield the player from the flag if he's got this negative amount of points or less"
index 8d70b4067bbbd91964565b520683951ef645a6d7..4327fac3ecf30ff94dbe3420b83c92691106076e 100644 (file)
@@ -766,6 +766,7 @@ float autocvar_g_ctf_pass_radius;
 float autocvar_g_ctf_pass_wait;
 float autocvar_g_ctf_pass_request;
 float autocvar_g_ctf_pass_turnrate;
+float autocvar_g_ctf_pass_timelimit;
 float autocvar_g_ctf_throw_velocity;
 float autocvar_g_ctf_captimerecord_always;
 float autocvar_g_ctf_dynamiclights;
index 1918c78d3b37d972b7ccde0352d921e07b93a1cb..99be62d5907da82574adaae05bb716db1c95cd5c 100644 (file)
@@ -174,6 +174,7 @@ void ctf_CaptureShield_Spawn(entity flag)
 
 void ctf_Handle_Failed_Pass(entity flag)
 {
+       print("ctf_Handle_Failed_Pass(entity flag) called.\n");
        entity sender = flag.pass_sender;
 
        flag.movetype = MOVETYPE_TOSS;
@@ -210,6 +211,7 @@ void ctf_Handle_Failed_Pass(entity flag)
 
 void ctf_Handle_Retrieve(entity flag, entity player)
 {
+       print("ctf_Handle_Retrieve(entity flag, entity player) called.\n");
        entity tmp_player; // temporary entity which the FOR_EACH_PLAYER loop uses to scan players
        entity sender = flag.pass_sender;
        
@@ -266,13 +268,14 @@ void ctf_Handle_Throw(entity player, entity reciever, float droptype)
        flag.owner.flagcarried = world;
        flag.owner = world;
        flag.solid = SOLID_TRIGGER;
+       flag.ctf_droptime = time;
        
        switch(droptype)
        {
                case DROPTYPE_PASS:
                {
                        vector targ_origin = (0.5 * (reciever.absmin + reciever.absmax));
-                       flag.velocity = W_CalculateProjectileVelocity(player.velocity, ('0 0 200' + (normalize(targ_origin - player.origin) * autocvar_g_ctf_throw_velocity)), FALSE);
+                       flag.velocity = (normalize(targ_origin - player.origin) * autocvar_g_ctf_throw_velocity);
                        break;
                }
                
@@ -317,7 +320,6 @@ void ctf_Handle_Throw(entity player, entity reciever, float droptype)
                        flag.movetype = MOVETYPE_TOSS;
                        flag.takedamage = DAMAGE_YES;
                        flag.health = flag.max_flag_health;
-                       flag.ctf_droptime = time;
                        flag.ctf_dropper = player;
                        flag.ctf_status = FLAG_DROPPED;
                        
@@ -625,14 +627,15 @@ void ctf_FlagThink()
                }
                
                case FLAG_PASSING:
-               {
-                       traceline(self.origin, self.pass_target.origin, MOVE_NOMONSTERS, self);
-                       
+               {                       
                        vector targ_origin = (0.5 * (self.pass_target.absmin + self.pass_target.absmax));
                        
+                       traceline(self.origin, targ_origin, MOVE_NOMONSTERS, self);
+                       
                        if((self.pass_target.deadflag != DEAD_NO)
                                || (vlen(self.origin - targ_origin) > autocvar_g_ctf_pass_radius)
-                               || ((trace_fraction < 1) && (trace_ent != self.pass_target)))
+                               || ((trace_fraction < 1) && (trace_ent != self.pass_target))
+                               || (time > self.ctf_droptime + autocvar_g_ctf_pass_timelimit))
                        {
                                ctf_Handle_Failed_Pass(self);
                        }
@@ -964,25 +967,29 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey)
                                if(head != player && !IsDifferentTeam(head, player))
                                if(!player.speedrunning && !head.speedrunning)
                                {
-                                       if(autocvar_g_ctf_pass_request && !player.flagcarried && head.flagcarried) 
-                                       { 
-                                               if(clienttype(head) == CLIENTTYPE_BOT)
-                                               {
-                                                       centerprint(player, strcat("Requesting ", head.netname, " to pass you the ", head.flagcarried.netname)); 
-                                                       ctf_Handle_Throw(head, player, DROPTYPE_PASS);
+                                       traceline(player.origin, head.origin, MOVE_NOMONSTERS, player);
+                                       if not((trace_fraction < 1) && (trace_ent != head))
+                                       {
+                                               if(autocvar_g_ctf_pass_request && !player.flagcarried && head.flagcarried) 
+                                               { 
+                                                       if(clienttype(head) == CLIENTTYPE_BOT)
+                                                       {
+                                                               centerprint(player, strcat("Requesting ", head.netname, " to pass you the ", head.flagcarried.netname)); 
+                                                               ctf_Handle_Throw(head, player, DROPTYPE_PASS);
+                                                       }
+                                                       else
+                                                       {
+                                                               centerprint(head, strcat(player.netname, " requests you to pass the ", head.flagcarried.netname)); 
+                                                               centerprint(player, strcat("Requesting ", head.netname, " to pass you the ", head.flagcarried.netname)); 
+                                                       }
+                                                       player.throw_antispam = time + autocvar_g_ctf_pass_wait; 
+                                                       return 0; 
                                                }
-                                               else
+                                               else if(player.flagcarried)
                                                {
-                                                       centerprint(head, strcat(player.netname, " requests you to pass the ", head.flagcarried.netname)); 
-                                                       centerprint(player, strcat("Requesting ", head.netname, " to pass you the ", head.flagcarried.netname)); 
+                                                       if(closest_target) { if(vlen(player.origin - head.origin) < vlen(player.origin - closest_target.origin)) { closest_target = head; } }
+                                                       else { closest_target = head; }
                                                }
-                                               player.throw_antispam = time + autocvar_g_ctf_pass_wait; 
-                                               return 0; 
-                                       }
-                                       else if(player.flagcarried)
-                                       {
-                                               if(closest_target) { if(vlen(player.origin - head.origin) < vlen(player.origin - closest_target.origin)) { closest_target = head; } }
-                                               else { closest_target = head; }
                                        }
                                }
                                head = head.chain;