//// Breaking the Wall
void InteractLooseBricks(string &in asEntity)
{
	PlayGuiSound("18_touch_rock.snt", 0.8f);
	AddTimer(asEntity, 1.0f, "TimerLooseBricks");
}
void TimerLooseBricks(string &in asTimer)
{
	SetEntityPlayerInteractCallback(asTimer, "InteractLooseBricks", true);
}
void UseBarOnBricks(string &in asItem, string &in asEntity)
{
	SetEntityActive("wriggle_prison_bar_bend_stone_1", true);
	CreateParticleSystemAtEntity("dust", "ps_hit_rock.ps", "AreaLooseBricks", false);
}
void UseHCOnBricks(string &in asItem, string &in asEntity)
{
	SetEntityActive("stone_chipper_move_x_1",true);
	SetEntityActive("stone_hammer_move_1",true);
		
	PlaySoundAtEntity("cumble1", "15_rock_break", "AreaHammer", 0, false);
	
	SetMoveObjectState("stone_hammer_move_1", 0.25f);
	SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
	
	AddTimer("1", 0.2f, "TimerHammer");
	AddTimer("2", 0.6f, "TimerHammer");
	AddTimer("3", 0.8f, "TimerHammer");
	AddTimer("4", 1.2f, "TimerHammer");
	AddTimer("5", 1.4f, "TimerHammer");
	
	SetEntityActive(asEntity, false);
}
void TimerHammer(string &in asTimer)
{
	if(asTimer == "1"){
		PlaySoundAtEntity("bang", "impact_rock_high", "Player", 0, false);
		PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
		SetMoveObjectState("stone_hammer_move_1", 0.0f);
		SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
	}
	if(asTimer == "2"){
		SetMoveObjectState("stone_hammer_move_1", 0.25f);
		SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
	}
	if(asTimer == "3"){
		SetMoveObjectState("stone_hammer_move_1", 0.0f);
		SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
		PlaySoundAtEntity("bang", "impact_rock_high", "Player", 0, false);
		PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
	}
	if(asTimer == "4"){
		SetMoveObjectState("stone_hammer_move_1", 0.25f);
		SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
	}
	if(asTimer == "5"){
		SetEntityActive("stone_chipper_move_x_1",false);
		SetEntityActive("stone_hammer_move_1",false);
		PlaySoundAtEntity("bang", "impact_rock_high", "Player", 0, false);
		PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
		
		CreateParticleSystemAtEntity("dust", "ps_hit_rock.ps", "AreaLooseBricks", false);
		SetLocalVarInt("UsedHC", 1);
		CollideBarBendDone("", "", 1);
	}
}
void UseBarOnWall(string &in asItem, string &in asEntity)
{
	SetMessage("BrokenWall", "UseBarOnWall", -1);
}
void InteractBendBar(string &in asEntity)
{
	PlaySoundAtEntity("rockbars", "15_rock_break", asEntity, 0.5f, false);
}
void CollideBarBendDone(string &in asParent, string &in asChild, int alState)
{
	FadeLightTo("PointLight_21", 0,0,0,0,  -1, 1);
	
	SetEntityActive("wriggle_prison_bar_bend_stone_1", false);
	
	if(GetLocalVarInt("BarInPlace") == 1)
		SetEntityActive("wriggle_prison_bar_obj_dyn_1", true);
	
	for(int i=1; i<=3; ++i)
	{
		SetPropStaticPhysics("cell_breakable_wall_rock"+i, false);
		
		if(GetLocalVarInt("UsedHC") == 1)
			AddPropImpulse("cell_breakable_wall_rock"+i, 0,0,-1.5f, "World");
		else
			AddPropImpulse("cell_breakable_wall_rock"+i, 0,0,1.5f, "World");
	}
	AddTimer("ExtraBrickPush", 0.4, "TimerExtraBrickPush");
	
	CreateParticleSystemAtEntity("dust", "ps_break_pottery.ps", "AreaLooseBricks", false);
	
	PlayGuiSound("25_break_rock.snt",1.0f);
	
	SetPropStaticPhysics("cell_breakable_wall_support_1", false);
}
void TimerExtraBrickPush(string &in asTimer)
{
	if(GetLocalVarInt("UsedHC") == 1)
		for(int i=1; i<=3; ++i)
			AddPropImpulse("cell_breakable_wall_rock"+i, 0,0,-2, "World");
	else	
		for(int i=1; i<=3; ++i)
			AddPropImpulse("cell_breakable_wall_rock"+i, 0,0,2, "World");		
}
void InteractWoodPillar(string &in asEntity)
{
	PlaySoundAtEntity("bendwood", "25_strain_wood", asEntity, 0.1f, false);
}
void CollideCollapseWall(string &in asParent, string &in asChild, int alState)
{
	for(int i=1; i<=2; ++i)
		SetEntityActive("AreaCollapseWall_"+i,false); 
		
	AddPlayerBodyForce(0,0,-5000, false);
		
	SetPropHealth("cell_breakable_wall_1", 0);
	SetPropHealth("cell_breakable_wall_support_1", 0);
	
	StartScreenShake(0.2, 0.3, 1, 1);
	
	PlayMusic("dan_grunt.ogg", false, 1.0f, 1.0f, 10, false);
	
	SetEntityActive("AreaEscaped", false);
}