iw5: rpg timer
All checks were successful
Build / build-linux (push) Successful in 7s

This commit is contained in:
2024-05-31 11:55:42 +02:00
parent 6f8e7954d4
commit d10cea3ed5
5 changed files with 41 additions and 4 deletions

View File

@ -19,6 +19,7 @@ _ON_PLAYER_CNCT_BEGIN
PLAYER_NOTIFY_CMD( player, "save_pos", "+reload" );
PLAYER_NOTIFY_CMD( player, "load_saved_pos", "+activate" );
player thread onWeaponFired();
player thread jumper();
player thread displaySpeed();
@ -26,6 +27,21 @@ _ON_PLAYER_CNCT_BEGIN
_ON_PLAYER_CNCT_END
onWeaponFired()
{
GENERIC_COROUTINE_END
while ( true )
{
self waittill( "weapon_fired", weapon );
if (weapon == "rpg_mp")
{
self.last_rpg_shot = getTime();
}
}
}
displaySpeed()
{
GENERIC_COROUTINE_END;
@ -36,12 +52,30 @@ displaySpeed()
self.speed_text.label = &"";
self.last_speed_sample = 0;
self.last_z_coordinate = 0.0;
while ( true )
{
player_speed = distance( ZERO_VEC3, self getvelocity() );
current_speed = int( player_speed );
if ( self.origin[2] > self.last_z_coordinate )
{
// We should be going up
if ( isDefined( self.last_rpg_shot ) && self.last_rpg_shot != 0 )
{
late = getTime() - self.last_rpg_shot;
if (late <= 500)
{
iPrintLn( "Late RPG (+" + (late) + ")" );
}
self.last_rpg_shot = 0;
}
}
self.last_z_coordinate = self.origin[2];
if ( self.last_speed_sample == current_speed )
{
// White

View File

@ -48,6 +48,7 @@
init() \
{ \
setDvar( BOUNCES_DVAR, 1 ); \
setDvar( "player_sustainAmmo", 1 ); \
thread onPlayerConnect(); \
}