#include common_scripts\utility;
#include maps\mp\_utility;
#include common_scripts\_createFxMenu;
#include common_scripts\_createfx;
#include common_scripts\_fx;

createfx()
{
	level.func_position_player = ::void;
	level.func_position_player_get = ::func_position_player_get;
	level.func_loopfxthread = ::loopfxthread;
	level.func_oneshotfxthread = ::oneshotfxthread;
	level.func_create_loopsound = ::create_loopsound;
//	level.func_exploder_preload = ::exploder_before_load;;
//	level.func_exploder_postload = ::exploder_after_load;;
	level.func_updatefx = ::restart_fx_looper;
	level.func_process_fx_rotater = ::process_fx_rotater;
	level.func_player_speed = ::func_player_speed;
	
	level.mp_createfx = true;

	// MP only stuff
	level.callbackStartGameType = ::void;
	level.callbackPlayerConnect = ::void;
	level.callbackPlayerDisconnect = ::void;
	level.callbackPlayerDamage = ::void;
	level.callbackPlayerKilled = ::void;
	level.callbackEntityOutOfWorld = ::void;
	level.callbackCodeEndGame = ::void;
	level.callbackPlayerLastStand = ::void;
	level.callbackPlayerConnect = ::Callback_PlayerConnect;
	level.callbackPlayerMigrated = ::void;

	maps\mp\gametypes\_gameobjects::main( [] );	// clear out extra entities since we're tight on some levels
	
	thread func_get_level_fx(); // start gettin these on start
	createfx_common();

	level waittill( "eternity" );
}

func_position_player_get( lastPlayerOrigin )
{
	return level.player.origin;
}

Callback_PlayerConnect()
{
	self waittill( "begin" );

	if ( !isdefined( level.player ) )
	{
		spawnpoints = getentarray( "mp_global_intermission", "classname" );
		spawnangles = ( spawnpoints[0].angles[0], spawnpoints[0].angles[1], 0.0 );
		self spawn( spawnpoints[0].origin, spawnangles );
		self updateSessionState( "playing" );
		self.maxhealth = 10000000;
		self.health = 10000000;
		level.player = self;
		
		thread createFxLogic();
	}
	else
		kick( self GetEntityNumber() );
}


func_player_speed()
{
	scale = level._createfx.player_speed / 190;
	level.player SetMoveSpeedScale( scale );
}