s1-scripts-dev/raw/maps/mp/_grappling_hook.gsc
2025-05-21 16:23:17 +02:00

86 lines
2.0 KiB
Plaintext

#include maps\mp\_utility;
#include common_scripts\utility;
init()
{
if ( isGrapplingHookGameMode() )
{
thread grappling_hook_on_player_spawn();
}
}
grappling_hook_on_player_spawn()
{
level endon( "game_ended" );
while ( true )
{
level waittill( "player_spawned", player );
player give_grappling_hook();
}
}
//==============================================================================
give_grappling_hook() // self = player, should not be threaded
//==============================================================================
{
grapplingHookWeapon = get_grappling_hook_weapon();
if ( self HasWeapon( grapplingHookWeapon ) )
return;
self SetTacticalWeapon( grapplingHookWeapon );
self giveWeapon( grapplingHookWeapon );
self notify( "grappling_hook_reset" ); // clear any old threads that were spawned from a previous iteration of this function... this is required for timing reasons
self thread wait_for_grappling_hook_pressed();
}
//==============================================================================
wait_for_grappling_hook_pressed() // should be threaded
//==============================================================================
{
level endon( "game_ended" );
self endon( "death" );
self endon( "disconnect" );
self endon( "faux_spawn" );
self endon( "joined_team" );
self endon( "grappling_hook_reset" );
while ( true )
{
self waittill( "exo_ability_activate", weaponName );
if ( weaponName == level.grapplingHookWeapon )
{
}
}
}
//==============================================================================
take_grappling_hook() // self = player, should not be threaded
//==============================================================================
{
grapplingHookWeapon = get_grappling_hook_weapon();
self takeWeapon( grapplingHookWeapon );
self notify( "grappling_hook_reset" );
}
get_grappling_hook_weapon()
{
if ( IsDefined( level.grapplingHookWeapon ) )
return level.grapplingHookWeapon;
level.grapplingHookWeapon = "iw5_dlcgun12loot7_mp";
return level.grapplingHookWeapon;
}