void OnStart()
{
	//Play nice music
	
	
	//Skybox
	SetSkyBoxActive(true);
	SetSkyBoxTexture("StarrySky.dds");
	
	//Fades in the screen
	FadeOut(0.0f);
	FadeIn(3.0f);
	
	//Disable player movement and annoying stuff
	SetPlayerActive(false);
	SetSanityDrainDisabled(true);
	SetInventoryDisabled(false);
	BlockDefaultHints();
	
	//Reindeer
	AddTimer("Rob1", 5.0f, "Presents"); 
	AddTimer("Rob2", 5.5f, "Presents"); 
	//Presents
	AddTimer("Rob3", 7.0f, "Presents");
	AddTimer("Rob4", 10.0f, "Presents");
	//Poisonous
	AddTimer("Rob5", 9.0f, "Presents");
	AddTimer("Rob6", 10.5f, "Presents");
	AddTimer("Rob7", 11.5f, "Presents");
	AddTimer("Rob8", 13.0f, "Presents");
	AddTimer("Rob9", 17.5f, "Presents");
	PlayMusic("29_amb_end_soft.ogg", true, 0.6f, 10, 1, false);
	PreloadParticleSystem("ps_area_fog_moving.ps");
	PreloadParticleSystem("ps_light_dust.ps");
	
}
void Presents(string &in asTimer)
{
	if(asTimer == "Rob1")
	{
		FadeOut(0.5);
	}
	if(asTimer == "Rob2")
	{
		TeleportPlayer("Presents");
		FadeIn(1);
	}
	if(asTimer == "Rob3")
	{
		FadeOut(3);
	}
	if(asTimer == "Rob4")
	{
		TeleportPlayer("Poisonous");
		FadeIn(4);
	}
	if(asTimer == "Rob5")
	{
		PlaySoundAtEntity("Whisper", "insanity_whisper_lower.snt", "Whisper3", 1.5f, false);
	}
	if(asTimer == "Rob6")
	{
		PlaySoundAtEntity("", "Poisonous_Viskningar1.snt", "Whisper1", 1, false);
		
	}
	if(asTimer == "Rob7")
	{
		PlaySoundAtEntity("", "Poisonous_Viskningar2.snt", "Whisper2", 1.5f, false);
		StopSound("Whisper", 3);
	}
	if(asTimer == "Rob8")
	{
		FadeOut(3.0f);
	}
	if(asTimer == "Rob9")
	{
		TeleportPlayer("PlayerStartArea_1");
		Intro();
		FadeIn(10);
	}
}
void Intro()
{
	//Cruising effect over the landscape
	
	
	MovePlayerHeadPos(0.0f, 0.0f, 135.0f, 6.0f, 0.0f);
	StartPlayerLookAt("barrel01_1", 1.0f, 1.0f, "");
	
	AddTimer("Cr1", 4.0f, "Action"); 
	AddTimer("Cr2", 6.0f, "Action");
	AddTimer("Cr3", 17.0f, "Action");
	AddTimer("Cr4", 20.0f, "Action");
	AddTimer("Cr5", 22.0f, "Action");
	AddTimer("Cr6", 23.0f, "Action");
	AddTimer("Cr7", 23.5f, "Action");
	AddTimer("Cr8", 25.0f, "Action");
	AddTimer("Cr9", 30.0f, "Action");
	AddTimer("Cr10", 34.0f, "Action");
	AddTimer("Cr11", 45.0f, "Action");
}
void Action(string &in asTimer)
{
	if(asTimer == "Cr1")
	{
		StopPlayerLookAt();
	}
	else if(asTimer == "Cr2")
	{
		SetMessage("Message", "Village", 16);
	}
	else if(asTimer == "Cr3")
	{
		
	}
	else if(asTimer == "Cr4")
	{
		FadeOut(1);
	}
	else if(asTimer == "Cr5")
	{
	
	}
	else if(asTimer == "Cr6")
	{
		TeleportPlayer("TestStart1");
		MovePlayerHeadPos(0.0f, 0.0f, 0.0f, 8.0f, 2.0f);
		StartPlayerLookAt("barrel01_3", 2.0f, 1.0f, "");
	}
	else if(asTimer == "Cr7")
	{
		FadeIn(3);
	}
	else if(asTimer == "Cr8")
	{
		SetMessage("Message", "Village2", 0);
	}
	else if(asTimer == "Cr9")
	{
		StopPlayerLookAt();
	}
	else if(asTimer == "Cr10")
	{
		FadeOut(3.0f);
		StopMusic(10, 1);
	}
	else if(asTimer == "Cr11")
	{
		ChangeMap("Outsidepoisonous", "PlayerStartArea_2", "", "");
	}
}
	// Block hints
void BlockDefaultHints()
{
	BlockHint("DarknessDecrease");
	BlockHint("PickLantern");
	BlockHint("PickTinderbox");
	BlockHint("SanityHit");
	BlockHint("SanityLow");
}
void OnEnter()
{
}

void OnLeave()
{
	SetupLoadScreen("LoadingText", "LoadScreen1", 0, "game_loading_desert.jpg");
}