Skip to content

Commit

Permalink
turret watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
ineed bots committed May 9, 2024
1 parent f683a78 commit 289f2b3
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
38 changes: 38 additions & 0 deletions maps/mp/bots/_bot.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ init()

level thread handleBots();
level thread onPlayerChat();

array_thread( getentarray( "misc_turret", "classname" ), ::turret_monitoruse_watcher );
}

/*
Expand Down Expand Up @@ -1366,3 +1368,39 @@ onPlayerChat()
}
}
}

/*
Monitors turret usage
*/
turret_monitoruse_watcher()
{
self endon( "death" );

for ( ;; )
{
self waittill ( "trigger", player );

self monitor_player_turret( player );

self.owner = undefined;

if ( isdefined( player ) )
{
player.turret = undefined;
}
}
}

/*
While player uses turret
*/
monitor_player_turret( player )
{
player endon( "death" );
player endon( "disconnect" );

player.turret = self;
self.owner = player;

self waittill( "turret_deactivate" );
}
9 changes: 8 additions & 1 deletion maps/mp/bots/_bot_internal.gsc
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ getRemoteBoostTime()

case 7:
return 500;

default:
return 500;
}
Expand Down Expand Up @@ -683,6 +683,13 @@ watchPickupGun()
continue;
}

// todo have bots use turrets instead of just kicking them off of it
if ( isdefined( self.turret ) )
{
self thread use( 0.5 );
continue;
}

weap = self getcurrentweapon();

if ( weap != "none" && self getammocount( weap ) )
Expand Down

0 comments on commit 289f2b3

Please sign in to comment.