#GENERAL

*name = "Blitz";
*desc = "Go bowling.";
*stackable = 1;
*model = "item_box_01";
*model_scale = 2.0;
*color = colorRGB( 1.0, 0.1, 0.1 );
*rad        = 0.5;
*mass       = 8.0;
*elasticity = 0.1;
*drag       = 0.5;
*friction   = 3.5;
*hardness   = 0.0;
*lifetime   = -1.0;
*player_only = 1;


#ON_CREATION


#ON_DAMAGE


#ON_PICK_UP
// If the player is currently running a power-up, kill it.
var bool = avar( "player_running_powerup" );
var func = nop;
func = if( bool, char_control_pop, nop );
func( "player" );
// Kill whatever power-up sound is currently running.
sound_stop( avar("player_powerup_sid") );

// Push the blitz state onto the player character.
char_control_push(
  "player",
  "pinball",
  "
    *x = 0;
    *y = 0;
    *mass = 40;
    *hardness = 50;
    *impulse = 42;
    *steering = 900;
    *time = 4.0;
    *player = 1;
    *particle = \"fire_01\";
  ",
  1
  );

// Play the blitzing sound.
//avar( "player_powerup_sid", sound_play( "blitz.wav" ) );

// Record that the player is in a power-up state.
avar( "player_running_powerup", 1 );
// Make a timer to flip the power-up state flag when this power-up finishes.
timer_kill( "powerup_ender" );
timer_make( "powerup_ender", 3.9, "avar( \"player_running_powerup\", 0 );" );

// This item is history.
kill_this( );
