From 120b3edec635e4306a68de57ab20b81c1c4ec78a Mon Sep 17 00:00:00 2001 From: ineed bots Date: Sat, 15 Jul 2023 16:01:35 -0600 Subject: [PATCH] better debug --- maps/bots/_bot.gsc | 31 +++++++++++++++++++++++++++++-- maps/bots/objectives/_manager.gsc | 7 ++++--- maps/bots/objectives/_powerup.gsc | 5 +++++ maps/bots/objectives/_utility.gsc | 11 +++++++++-- 4 files changed, 47 insertions(+), 7 deletions(-) diff --git a/maps/bots/_bot.gsc b/maps/bots/_bot.gsc index 5544839..0e9f5a5 100644 --- a/maps/bots/_bot.gsc +++ b/maps/bots/_bot.gsc @@ -292,9 +292,36 @@ watchBotDebugEvent() { self waittill( "bot_event", msg, str, b, c, d, e, f, g ); - if ( msg == "debug" && GetDvarInt( "bots_main_debug" ) ) + if ( GetDvarInt( "bots_main_debug" ) >= 2 ) { - PrintConsole( "Bot Warfare debug: " + self.playername + ": " + str + "\n" ); + big_str = "Bot Warfare debug: " + self getPlayerName() + ": " + msg; + + if ( isDefined( str ) && isString( str ) ) + big_str += ", " + str; + + if ( isDefined( b ) && isString( b ) ) + big_str += ", " + b; + + if ( isDefined( c ) && isString( c ) ) + big_str += ", " + c; + + if ( isDefined( d ) && isString( d ) ) + big_str += ", " + d; + + if ( isDefined( e ) && isString( e ) ) + big_str += ", " + e; + + if ( isDefined( f ) && isString( f ) ) + big_str += ", " + f; + + if ( isDefined( g ) && isString( g ) ) + big_str += ", " + g; + + PrintConsole( big_str ); + } + else if ( msg == "debug" && GetDvarInt( "bots_main_debug" ) ) + { + PrintConsole( "Bot Warfare debug: " + self getPlayerName() + ": " + str ); } } } diff --git a/maps/bots/objectives/_manager.gsc b/maps/bots/objectives/_manager.gsc index 2b7bcbc..71b7d49 100644 --- a/maps/bots/objectives/_manager.gsc +++ b/maps/bots/objectives/_manager.gsc @@ -41,7 +41,7 @@ watch_for_objective_canceled() obj_name = self.bot_current_objective.sName; } - PrintConsole( "watch_for_objective_canceled: " + self.playername + ": " + obj_name + ": " + reason ); + self BotNotifyBotEvent( "debug", "watch_for_objective_canceled: " + obj_name + ": " + reason ); } } @@ -64,7 +64,7 @@ clean_objective_on_completion() self.bot_current_objective.eParentObj.aBotProcessTimes[self GetEntityNumber() + ""] = getTime(); } - PrintConsole( "clean_objective_on_completion: " + self.playername + ": " + obj_name + ": " + successful + ": " + reason ); + self BotNotifyBotEvent( "debug", "clean_objective_on_completion: " + obj_name + ": " + successful + ": " + reason ); waittillframeend; self.bot_current_objective = undefined; @@ -157,7 +157,8 @@ bot_objective_think() } // ready to execute - PrintConsole( "bot_objective_think: " + self.playername + ": " + best_prio.sName ); + self BotNotifyBotEvent( "debug", "bot_objective_think: " + best_prio.sName ); + self.bot_current_objective = best_prio; self thread [[best_prio.eParentObj.fpExecuter]]( best_prio ); } diff --git a/maps/bots/objectives/_powerup.gsc b/maps/bots/objectives/_powerup.gsc index 4e35f01..b03ecd2 100644 --- a/maps/bots/objectives/_powerup.gsc +++ b/maps/bots/objectives/_powerup.gsc @@ -126,6 +126,11 @@ GoDoPowerup( eObj ) return; } + if ( !isDefined( powerup ) || !isDefined( powerup.origin ) ) + { + return; + } + if ( distance( powerup.origin, self.origin ) > 64 ) { eObj.sReason = "not touching it"; diff --git a/maps/bots/objectives/_utility.gsc b/maps/bots/objectives/_utility.gsc index 8cbe053..d8e8040 100644 --- a/maps/bots/objectives/_utility.gsc +++ b/maps/bots/objectives/_utility.gsc @@ -174,7 +174,11 @@ get_angle_offset_node( forward_size, angle_offset, offset ) node = self.origin + ( AnglesToForward( angles ) * forward_size ) + offset; node = clamp_to_ground( node ); - self thread debug_offset_line( node ); + if ( getDvarInt( "bots_main_debug" ) ) + { + self thread debug_offset_line( node ); + } + return node; } @@ -192,7 +196,10 @@ debug_offset_line( node ) PointInsideUseTrigger( point ) { - self thread debug_bounding_box_for_ent(); + if ( getDvarInt( "bots_main_debug" ) ) + { + self thread debug_bounding_box_for_ent(); + } mins = self getmins(); maxs = self getmaxs();