From: Samual Date: Wed, 30 Mar 2011 22:17:09 +0000 (-0400) Subject: Whoops fix a bot thing quickly X-Git-Tag: xonotic-v0.7.0~240^2~179 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ccf7e59ef0392843421b3f5477f05e425fb560b9;p=xonotic%2Fxonotic-data.pk3dir.git Whoops fix a bot thing quickly --- diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 66a0cf2bc..c540a9ee5 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -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; diff --git a/qcsrc/server/bot/havocbot/role_ctf.qc b/qcsrc/server/bot/havocbot/role_ctf.qc index 0ec0abb3c..1770cb153 100644 --- a/qcsrc/server/bot/havocbot/role_ctf.qc +++ b/qcsrc/server/bot/havocbot/role_ctf.qc @@ -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) diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 0c5389e2e..251b49ab6 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -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); - } - } - */ }