some organization

This commit is contained in:
ineed bots 2023-06-20 13:57:20 -06:00
parent 5a3f920155
commit 5b5133a629
3 changed files with 83 additions and 67 deletions

View File

@ -120,7 +120,7 @@ init()
level thread onPlayerConnect();
level thread handleBots();
maps\bots\_bot_script::bot_script_init();
level thread maps\bots\_bot_script::bot_script_init();
}
/*
@ -161,22 +161,6 @@ onPlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon,
self [[level.prevCallbackPlayerDamage]]( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, modelIndex, psOffsetTime );
}
on_actor_spawned()
{
if ( isDefined( level.prevCallbackActorSpawned ) )
{
self [[ level.prevCallbackActorSpawned ]]();
}
}
on_actor_killed( eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, iTimeOffset )
{
if ( isDefined( level.prevCallbackActorKilled ) )
{
self [[ level.prevCallbackActorKilled ]]( eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, iTimeOffset );
}
}
/*
Starts the callbacks.
*/
@ -185,10 +169,6 @@ hook_callbacks()
wait 0.05;
level.prevCallbackPlayerDamage = level.callbackPlayerDamage;
level.callbackPlayerDamage = ::onPlayerDamage;
level.prevCallbackActorSpawned = level.callbackActorSpawned;
level.callbackActorSpawned = ::on_actor_spawned;
level.prevCallbackActorKilled = level.callbackActorKilled;
level.callbackActorKilled = ::on_actor_killed;
}
/*

View File

@ -1,42 +1,13 @@
#include common_scripts\utility;
#include maps\_utility;
#include maps\bots\_bot_utility;
#include maps\bots\script_objectives\_obj_actions;
#include maps\bots\script_objectives\_obj_common;
#include maps\bots\script_objectives\_obj_trackers;
/*
Initialize bot script level functions
*/
bot_script_init()
{
//maps\bots\script_objectives\_obj_common;
//maps\bots\script_objectives\_obj_actions;
register_bot_action( "objective", "powerup", ::bot_grab_powerup,
::bot_powerup_process_order,
::bot_powerup_init,
::bot_powerup_post_think,
::bot_should_grab_powerup,
::bot_check_complete_grab_powerup,
::bot_powerup_should_cancel,
::bot_powerup_should_postpone,
::bot_powerup_priority );
register_bot_action( "objective", "revive", ::bot_revive_player,
::bot_revive_process_order,
::bot_revive_player_init,
::bot_revive_player_post_think,
::bot_should_revive_player,
::bot_check_complete_revive_player,
::bot_revive_player_should_cancel,
::bot_revive_player_should_postpone,
::bot_revive_player_priority );
register_bot_objective( "powerup" );
register_bot_objective( "revive" );
//maps\bots\script_objectives\_obj_trackers;
level thread store_powerups_dropped();
level thread watch_for_downed_players();
level thread maps\bots\script_objectives\_obj_init::init();
}
/*
@ -59,15 +30,8 @@ connected()
self thread difficulty();
self thread onBotSpawned();
self thread onSpawned();
self thread initialize_bot_actions_queue();
self thread bot_valid_pump();
//self thread bot_objective_inaccessible_pump();
self.on_powerup_grab_func = ::bot_on_powerup_grab;
self.on_revive_success_func = ::bot_on_revive_success;
self.obj_postponed_reason = "";
self.obj_cancel_reason = "";
self thread maps\bots\script_objectives\_obj_init::connected();
}
/*
@ -402,9 +366,11 @@ onSpawned()
for ( ;; )
{
self waittill( "spawned_player" );
self thread bot_action_think();
self.bot_lock_goal = false;
self.bot_was_follow_script_update = undefined;
self thread maps\bots\script_objectives::spawned();
}
}
@ -416,11 +382,6 @@ start_bot_threads()
self endon( "disconnect" );
level endon( "intermission" );
self endon( "zombified" );
}
//TODO: Add ability to pause an action so the bot won't be doing it while its paused but when its unpaused they can resume the action with the same settings
//Similar to postpone except instead of selecting a new action the current action is preserved
action_should_be_paused_global( primary_group_name, action_name )
{
return false;
self thread maps\bots\script_objectives::start_bot_threads();
}

View File

@ -0,0 +1,75 @@
#include common_scripts\utility;
#include maps\_utility;
#include maps\bots\_bot_utility;
#include maps\bots\script_objectives\_obj_common;
#include maps\bots\script_objectives\_obj_actions;
#include maps\bots\script_objectives\_obj_trackers;
init()
{
//maps\bots\script_objectives\_obj_common;
//maps\bots\script_objectives\_obj_actions;
register_bot_action( "objective", "powerup", ::bot_grab_powerup,
::bot_powerup_process_order,
::bot_powerup_init,
::bot_powerup_post_think,
::bot_should_grab_powerup,
::bot_check_complete_grab_powerup,
::bot_powerup_should_cancel,
::bot_powerup_should_postpone,
::bot_powerup_priority );
register_bot_action( "objective", "revive", ::bot_revive_player,
::bot_revive_process_order,
::bot_revive_player_init,
::bot_revive_player_post_think,
::bot_should_revive_player,
::bot_check_complete_revive_player,
::bot_revive_player_should_cancel,
::bot_revive_player_should_postpone,
::bot_revive_player_priority );
register_bot_objective( "powerup" );
register_bot_objective( "revive" );
//maps\bots\script_objectives\_obj_trackers;
level thread store_powerups_dropped();
level thread watch_for_downed_players();
}
connected()
{
self endon( "disconnect" );
self thread initialize_bot_actions_queue();
self thread bot_valid_pump();
//self thread bot_objective_inaccessible_pump();
self.on_powerup_grab_func = ::bot_on_powerup_grab;
self.on_revive_success_func = ::bot_on_revive_success;
self.obj_postponed_reason = "";
self.obj_cancel_reason = "";
}
spawned()
{
self endon( "disconnect" );
level endon( "intermission" );
self endon( "zombified" );
self thread bot_action_think();
}
start_bot_threads()
{
self endon( "disconnect" );
level endon( "intermission" );
self endon( "zombified" );
}
//TODO: Add ability to pause an action so the bot won't be doing it while its paused but when its unpaused they can resume the action with the same settings
//Similar to postpone except instead of selecting a new action the current action is preserved
action_should_be_paused_global( primary_group_name, action_name )
{
return false;
}