]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Whoops fix a bot thing quickly
authorSamual <samual@xonotic.org>
Wed, 30 Mar 2011 22:17:09 +0000 (18:17 -0400)
committerSamual <samual@xonotic.org>
Wed, 30 Mar 2011 22:17:09 +0000 (18:17 -0400)
qcsrc/server/autocvars.qh
qcsrc/server/bot/havocbot/role_ctf.qc
qcsrc/server/mutators/gamemode_ctf.qc

index 66a0cf2bcfc98dd5dcc2e73b4c9f5d2435024438..c540a9ee5e9e2c5af423b9079866b9ec5be15f7f 100644 (file)
@@ -728,6 +728,7 @@ float autocvar_g_ctf_flag_blue_skin;
 float autocvar_g_ctf_flag_capture_effects;
 float autocvar_g_ctf_flag_glowtrails;
 float autocvar_g_ctf_flag_pickup_effects;
+float autocvar_g_ctf_flag_pickup_verbosename;
 string autocvar_g_ctf_flag_red_model;
 float autocvar_g_ctf_flag_red_skin;
 float autocvar_g_ctf_flag_returntime;
index 0ec0abb3ce5c1427d7fb8140928bd65b75cb943a..1770cb153dde6f72c02ffbd2128b1129a789e63b 100644 (file)
@@ -23,7 +23,7 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplay
 .float havocbot_cantfindflag;
 .float havocbot_role_timeout;
 .entity ctf_worldflagnext;
-.entity basewaypoint;
+.entity bot_basewaypoint;
 
 entity ctf_worldflaglist;
 vector havocbot_ctf_middlepoint;
@@ -102,7 +102,7 @@ void havocbot_goalrating_ctf_ourbase(float ratingscale)
        if not(head)
                return;
 
-       navigation_routerating(head.basewaypoint, ratingscale, 10000);
+       navigation_routerating(head.bot_basewaypoint, ratingscale, 10000);
 };
 
 void havocbot_goalrating_ctf_enemyflag(float ratingscale)
@@ -134,7 +134,7 @@ void havocbot_goalrating_ctf_enemybase(float ratingscale)
        if not(head)
                return;
 
-       navigation_routerating(head.basewaypoint, ratingscale, 10000);
+       navigation_routerating(head.bot_basewaypoint, ratingscale, 10000);
 };
 
 void havocbot_goalrating_ctf_ourstolenflag(float ratingscale)
index 0c5389e2e99b1fd002177ed717204dd3cbeffc52..251b49ab6ca45a2f6393a7bf6d381daba41a2947 100644 (file)
@@ -252,11 +252,7 @@ void ctf_Handle_Return(entity flag, entity player) // todo: re-write this
 void ctf_Handle_Pickup_Base(entity flag, entity player) // todo: re-write this
 {
        entity tmp_player;
-       if (player.next_take_time > time)
-               return;
-                       
-       if (autocvar_g_ctf_flag_pickup_effects) // pickup effect
-               pointparticles(particleeffectnum("smoke_ring"), 0.5 * (flag.absmin + flag.absmax), '0 0 0', 1);
+       string verbosename;
                
        // attach the flag to the player
        flag.owner = player;
@@ -275,9 +271,12 @@ void ctf_Handle_Pickup_Base(entity flag, entity player) // todo: re-write this
        // messages and sounds
        Send_KillNotification (player.netname, flag.netname, "", INFO_GOTFLAG, MSG_INFO);
        sound(player, CHAN_AUTO, flag.noise, VOL_BASE, ATTN_NONE);
+       verbosename = ((autocvar_g_ctf_flag_pickup_verbosename) ? strcat("(", player.netname, ")") : ""); // replace TRUE with an autocvar for it.
        FOR_EACH_PLAYER(tmp_player)
                if(tmp_player.team == flag.team)
-                       centerprint(tmp_player, "The enemy got your flag! Retrieve it!");
+                       centerprint(tmp_player, strcat("The enemy ", verbosename, " got your flag! Retrieve it!"));
+               else if((tmp_player.team == player.team) && (tmp_player != player))
+                       centerprint(tmp_player, strcat("Your team mate ", verbosename, " got the flag! Protect them!"));
        
        // scoring
        PlayerTeamScore_AddScore(player, ctf_ReadScore("score_pickup_base"));
@@ -289,13 +288,18 @@ void ctf_Handle_Pickup_Base(entity flag, entity player) // todo: re-write this
        if((player.speedrunning) && (ctf_captimerecord))
                ctf_FakeTimeLimit(player, time + ctf_captimerecord);
                
+       // effects
+       if (autocvar_g_ctf_flag_pickup_effects)
+       {
+               pointparticles(particleeffectnum("smoke_ring"), 0.5 * (flag.absmin + flag.absmax), '0 0 0', 1); // 
+       }
+       
        // waypoints 
        WaypointSprite_Spawn("flagcarrier", 0, 0, player, '0 0 64', world, player.team, player, wps_flagcarrier, FALSE); // (COLOR_TEAM1 + COLOR_TEAM2 - flag.team)
        WaypointSprite_UpdateMaxHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent) * 2);
        WaypointSprite_UpdateHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(player.health, player.armorvalue, autocvar_g_balance_armor_blockpercent));
        WaypointSprite_UpdateTeamRadar(player.wps_flagcarrier, RADARICON_FLAGCARRIER, '1 1 0');
        WaypointSprite_Ping(player.wps_flagcarrier);
-       
 }
  
 void ctf_Handle_Pickup_Dropped(entity flag, entity player) // todo: re-write this
@@ -692,13 +696,11 @@ MUTATOR_HOOKFUNCTION(ctf_RemovePlayer)
 {
        if(self.flagcarried) { ctf_Handle_Drop(self); } // figure this out
        
-       return TRUE;
+       return 0;
 }
 
 MUTATOR_HOOKFUNCTION(ctf_PlayerPreThink)
 {
-       // declarations 
-       float redflags, blueflags;
        local entity flag;
        
        // initially clear items so they can be set as necessary later.
@@ -725,38 +727,6 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerPreThink)
                ctf_Handle_Drop(self);
        
        return 0;
-
-       /* this shit fucking sucks
-       // figure out what flags we already own
-       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 // wtf?
-       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)
-       {
-               if(flag.items & IT_KEY2) // blue
-               {
-                       if(--redflags == -1) // happens exactly once (redflags is in 0..count-1, and will --'ed count times) // WHAT THE FUCK DOES THIS MEAN? whoever wrote this is shitty at explaining things.
-                               ctf_SetStatus_ForType(flag, IT_RED_FLAG_TAKEN);
-               }
-               else if(flag.items & IT_KEY1) // red
-               {
-                       if(--blueflags == -1) // happens exactly once
-                               ctf_SetStatus_ForType(flag, IT_BLUE_FLAG_TAKEN);
-               }
-       }
-       */
 }