$poseparameter "move_yaw" -180 180 wrap

$weightlist upperbodyreplace "Valvebiped.bip01_spine" 1.0
//$weightlist Lowerbodyreplace "valvebiped.bip01" 1.0 "valvebiped.bip01_spine1" 0.0
$weightlist pelvisonly "Valvebiped.bip01_Pelvis" 1.0 "Valvebiped.bip01_Spine" 0.0 "ValveBiped.Bip01_L_Thigh" 0.0 "ValveBiped.Bip01_R_Thigh" 0.0 

//---------------------------------------------------------------

$sequence idle_subtle idle02 loop activity ACT_IDLE 1 node "standing" cmdlist lockfeet
//sequence idle_angry idle_angry loop activity ACT_IDLE_ANGRY 1 node "standing" cmdlist lockfeet
$sequence idle_angry @idle_subtle loop activity ACT_IDLE_ANGRY 1 node "standing"
//$sequence idle01 idle01 loop frames 0 358 fixuploop -15 0 activity node "standing" cmdlist lockfeet
//$sequence Idle02 Idle02 loop activity ACT_IDLE 1 node "standing" cmdlist lockfeet
//$sequence Idle03 Idle03 loop activity ACT_IDLE 1 node "standing" cmdlist lockfeet

$sequence LineIdle01 "Idle_standing_in_line_slouched_leftfoot" loop ACT_BUSY_QUEUE 1 cmdlist lockfeet
$sequence LineIdle02 "d1_t01_BreakRoom_WatchBreen" loop ACT_BUSY_QUEUE 1 cmdlist lockfeet { ikrule lhand touch "ValveBiped.Bip01_Spine2" ikrule rhand touch "ValveBiped.Bip01_Spine2" }
$sequence LineIdle03 "Idle03" loop ACT_BUSY_QUEUE 1 cmdlist lockfeet
$sequence LineIdle04 "Idle_standing_in_line_pockets" loop ACT_BUSY_QUEUE 1 cmdlist lockfeet { ikrule lhand touch "ValveBiped.Bip01_Pelvis" ikrule rhand touch "ValveBiped.Bip01_Pelvis" }

$sequence Crouch_idleD Crouchidle_D fps 30 loop activity ACT_COVER_LOW -1 node "crouching" cmdlist lockfeetandlefthand

//$skiptransition "crouchingA" "crouchingB" "crouchingC"

//---------------------------------------------------------------


// all movement cycles begin right-foot-planted, left-foot-nearest-to-right


// walking, no weapon
$animation a_WalkS WalkS loop LX LY startloop 0 rotateto -180 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 7 21 ..
	ikrule rfoot footstep range .. 22  6 ..
}
$animation a_WalkSE WalkSE loop LX LY startloop 0 rotateto -135 {
	alignto idle_subtle
	ikrule lfoot footstep range ..  8 21 ..
	ikrule rfoot footstep range .. 22  7 ..
}
$animation a_WalkE WalkE loop LX LY startloop 0 rotateto -90 {
	alignto idle_subtle
	ikrule lfoot footstep range ..  8 22 ..
	ikrule rfoot footstep range .. 23  7 ..
}
$animation a_WalkNE WalkNE loop LX LY startloop 0 rotateto -45 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 20 ..
	ikrule rfoot footstep range .. 21  7 ..
}
$animation a_WalkN WalkN loop LX LY startloop 0 rotateto 0 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 21 ..
	ikrule rfoot footstep range .. 23  6 ..
}
$animation a_WalkNW WalkNW loop LX LY startloop 0 rotateto 45 {
	alignto idle_subtle
	ikrule lfoot footstep range ..  8 19 ..
	ikrule rfoot footstep range .. 21  7 ..
}
$animation a_WalkW WalkW loop LX LY startloop 0 rotateto 90 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 9 20 ..
	ikrule rfoot footstep range .. 22  9 ..
}
$animation a_WalkSW WalkSW loop LX LY startloop 0 rotateto 135 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 7 20 ..
	ikrule rfoot footstep range .. 22  6 ..
}


// running, no weapon
$animation a_RunS RunS loop LX LY startloop 0 rotateto -180 fps 31 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 7 11 ..
	ikrule rfoot footstep range .. 17 3 ..
}
$animation a_RunSE RunSE loop LX LY startloop 0 rotateto -135 fps 29 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 7 12 ..
	ikrule rfoot footstep range .. 17 1 ..
}
$animation a_RunE RunE loop LX LY startloop 0 rotateto -90 fps 31 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 5 9 ..
	ikrule rfoot footstep range .. 14 17 ..
}
$animation a_RunNE RunNE loop LX LY startloop 0 rotateto -45 fps 29 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 6 9 ..
	ikrule rfoot footstep range .. 16 0 ..
}
$animation a_RunN RunN loop LX LY startloop 0 rotateto 0 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 7 10 ..
	ikrule rfoot footstep range  .. 16 1 ..
}
$animation a_RunNW RunNW loop LX LY startloop 0 rotateto 45 fps 28 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 11 ..
	ikrule rfoot footstep range .. 16 0 ..
}
$animation a_RunW RunW loop LX LY startloop 0 rotateto 90 fps 32 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 5 9 ..
	ikrule rfoot footstep range .. 14 0 ..
}
$animation a_RunSW RunSW loop LX LY startloop 0 rotateto 135 fps 31 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 11 ..
	ikrule rfoot footstep range .. 16 0 ..
}


// crouch walk, no weapon
$sequence layer_crouch_walk_no_weapon "Crouch_walkN" weightlist upperbodyreplace hidden

// crouch run, no weapon
$sequence layer_crouch_run_no_weapon "Crouch_runN" weightlist upperbodyreplace hidden


//=================================================================
//=================Walk_Moderate===================================

$animation a_WalkS_Moderate WalkS_Moderate fps 31 loop LX LY startloop 0 rotateto -180 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 10 25 .. contact 15
	ikrule rfoot footstep range .. 25  7 .. contact 33
}
$animation a_WalkSE_Moderate WalkSE_Moderate loop LX LY startloop 0 rotateto -135 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 7 26 .. contact 13
	ikrule rfoot footstep range .. 25  10 .. contact 31
}
$animation a_WalkE_Moderate WalkE_Moderate fps 33 loop LX LY startloop 0 rotateto -90 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 29 .. contact 12
	ikrule rfoot footstep range .. 26  9 .. contact 29
}
$animation a_WalkNE_Moderate WalkNE_Moderate fps 32 loop LX LY startloop 0 rotateto -45 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 26 .. contact 11
	ikrule rfoot footstep range .. 25  9 .. contact 27
}
$animation a_WalkN_Moderate WalkN_Moderate fps 32 loop LX LY startloop 33 rotateto 0 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 9 26 .. contact 10
	ikrule rfoot footstep range .. 25  9 .. contact 26
}
$animation a_WalkNW_Moderate WalkNW_Moderate fps 32 loop LX LY startloop 0 rotateto 45 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 25 .. contact 10
	ikrule rfoot footstep range .. 25  9 .. contact 27
}
$animation a_WalkW_Moderate WalkW_Moderate fps 33 loop LX LY startloop 0 rotateto 90 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 10 26 .. contact 12
	ikrule rfoot footstep range .. 29  12 .. contact 30
}
$animation a_WalkSW_Moderate WalkSW_Moderate loop LX LY startloop 0 rotateto 135  {
	alignto idle_subtle
	ikrule lfoot footstep range .. 9 25 .. contact 13
	ikrule rfoot footstep range .. 27  9 .. contact 30
}

$sequence walk_all_Moderate {
	a_walkS_Moderate a_walkSE_Moderate a_walkE_Moderate 
	a_walkNE_Moderate a_walkN_Moderate a_walkNW_Moderate 
	a_walkW_Moderate a_walkSW_Moderate a_walkS_Moderate
	blendwidth 9 blend move_yaw -180 180 node "walking"
	{ event 6004 8 "NPC_Citizen" }
	{ event 6005 25 "NPC_Citizen" }
}

//=====================================================================

$sequence walk_all {
	a_walkS a_walkSE a_walkE a_walkNE a_walkN a_walkNW a_walkW a_walkSW a_walkS
	blendwidth 9 blend move_yaw -180 180 ACT_WALK 1 node "walking"
	{ event 6004 8 "NPC_Citizen" }
	{ event 6005 22 "NPC_Citizen" }
}


$sequence run_all {
	a_runS a_runSE a_runE a_runNE a_runN a_runNW a_runW a_runSW a_runS
	blendwidth 9 blend move_yaw -180 180 ACT_RUN 1 node "running"
	{ event 6004 6 "NPC_Citizen" }
	{ event 6005 15 "NPC_Citizen" }
}


//___________________________________________________________________________________________
//--Sprint
 
$animation a_sprint sprint loop LX LY rotateto 0 { 
	alignto idle_subtle
	ikrule lfoot footstep range .. 6 9 ..
	ikrule rfoot footstep range .. 14 1 ..
}
$sequence sprint_all {
	a_runS a_runSE a_runE 
	a_runNE a_sprint a_runNW 
	a_runW a_runSW a_runS
	blendwidth 9 blend move_yaw -180 180 
	node "running"
	{ event 6004 6 "NPC_Citizen" }
	{ event 6005 14 "NPC_Citizen" }
}

//___________________________________________________________________________________________


// crouch walking, no weapon
$animation a_Crouch_walkS Crouch_walkS loop LX LY rotateto -180 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 22 ..
	ikrule rfoot footstep range .. 23 7 ..
}
$animation a_Crouch_walkSE Crouch_walkSE loop LX LY rotateto -135 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 22 ..
	ikrule rfoot footstep range .. 23 7 ..
}
$animation a_Crouch_walkE Crouch_walkE loop LX LY rotateto -90 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 23 ..
	ikrule rfoot footstep range .. 22 8 ..
}
$animation a_Crouch_walkNE Crouch_walkNE loop LX LY rotateto -45 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 23 ..
	ikrule rfoot footstep range .. 22 8 ..
}
$animation a_Crouch_walkN crouch_walkN loop LX LY rotateto 0 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 23 ..
	ikrule rfoot footstep range .. 23 7 ..
}
$animation a_Crouch_walkNW Crouch_walkNW loop LX LY rotateto 45 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 11 ..
	ikrule rfoot footstep range .. 16 0 ..
}
$animation a_Crouch_walkW Crouch_walkW loop LX LY rotateto 90 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 11 ..
	ikrule rfoot footstep range .. 16 0 ..
}
$animation a_Crouch_walkSW Crouch_walkSW loop LX LY rotateto 135 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 11 ..
	ikrule rfoot footstep range .. 16 0 ..
}

$sequence Crouch_walk_all {
	a_Crouch_walkS a_Crouch_walkSE a_Crouch_walkE 
	a_Crouch_walkNE a_Crouch_walkN a_Crouch_walkNW 
	a_Crouch_walkW a_Crouch_walkSW a_Crouch_walkS 
	blendwidth 9 blend move_yaw -180 180 ACT_WALK_CROUCH 1 node "walk_crouching"
}



$animation a_Crouch_runN crouch_runN loop LX LY fps 30 rotateto 0 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 6 10 ..
	ikrule rfoot footstep range .. 15 1 ..
}

$animation a_crouch_runS_delta Crouch_runN frame 0 0 weightlist pelvisonly alignto a_runS subtract a_runS 0
$animation a_crouch_runSE_delta Crouch_runN frame 0 0 weightlist pelvisonly alignto a_runSE subtract a_runSE 0
$animation a_crouch_runE_delta Crouch_runN frame 0 0 weightlist pelvisonly alignto a_runE subtract a_runE 0
$animation a_crouch_runNE_delta Crouch_runN frame 0 0 weightlist pelvisonly alignto a_runNE subtract a_runNE 0
$animation a_crouch_runN_delta Crouch_runN frame 0 0 weightlist pelvisonly alignto a_crouch_runN subtract a_crouch_runN 0
$animation a_crouch_runNW_delta Crouch_runN frame 0 0 weightlist pelvisonly alignto a_runNW subtract a_runNW 0
$animation a_crouch_runW_delta Crouch_runN frame 0 0 weightlist pelvisonly alignto a_runW subtract a_runW 0
$animation a_crouch_runSW_delta Crouch_runN frame 0 0 weightlist pelvisonly alignto a_runSW subtract a_runSW 0

$sequence crouch_run_all_delta {
	a_crouch_runS_delta a_crouch_runSE_delta a_crouch_runE_delta 
	a_crouch_runNE_delta a_crouch_runN_delta a_crouch_runNW_delta 
	a_crouch_runW_delta a_crouch_runSW_delta a_crouch_runS_delta 
	weightlist pelvisonly
	blendwidth 9 blend move_yaw -180 180
	iklock lfoot 1 1 iklock rfoot 1 1
	delta
	hidden
}

$sequence crouchRUNALL1 {
	a_runS a_runSE a_runE
	a_runNE a_crouch_runN a_runNW
	a_runW a_runSW a_runS
	blendwidth 9 blend move_yaw -180 180
	addlayer crouch_run_all_delta 
	addlayer layer_crouch_run_no_weapon
	ACT_RUN_CROUCH 1 
	node "run_crouching"
}


//---------------------------------------------------------------

/*
$sequence Stand_to_run Stand_to_run LX
$sequence Run_to_stand Run_to_stand {
	alignto a_RunN 
	// walkalign 23 idle_subtle LX LY LZR 0 36
}
$sequence Stand_to_walk Stand_to_walk {
	LX
	// transition "standing" "walking"
}
$sequence Walk_to_stand Walk_to_stand {
	alignto a_WalkN
	// walkalignto 24 idle_subtle LX LY LZR 0 35
	// transition "walking" "standing"
}

*/

/*
$sequence Runjump_start Runjump_start
$sequence Runjump_land Runjump_land
$sequence Jumpup_45 Jumpup_45
$sequence Jumpdown_45 Jumpdown_45
$sequence Run_jumpup_32 Run_jumpup_32
$sequence Run_jumpdown_32 Run_jumpdown_32
*/

$sequence Stand_to_crouch Stand_to_crouch transition "standing" "crouching" ACT_TRANSITION 1
$sequence Crouch_to_stand Crouch_to_stand transition "crouching" "standing" ACT_TRANSITION 1
//$sequence Crouch_to_run Crouch_to_run LX
//$sequence Run_to_crouch Run_to_crouch LX

$skiptransition "running" "walking" "walk_crouching" "run_crouching"

//----------------

$sequence Open_door_away "door_open_awayRight"
$sequence Open_door_towards_right "door_open_in_Right"
$sequence Open_door_towards_left "door_open_in_left"

//----------------

$weightlist nobones "ValveBiped.Bip01_pelvis" 0.0

$sequence turnleft "Idle01" FPS 10 frames 0 10 ACT_GESTURE_TURN_LEFT 1 {
	// foot release only rules
	ikrule lfoot unlatch range 0 3 3 5 usesource
	ikrule rfoot unlatch range 5 8 8 0 usesource
	weightlist nobones
}

$sequence turnright "Idle01" FPS 10 frames 0 10 ACT_GESTURE_TURN_RIGHT 1 {
	// foot release only rules
	ikrule lfoot unlatch range 5 8 8 0 usesource
	ikrule rfoot unlatch range 0 3 3 5 usesource
	weightlist nobones
}

// $maketurngesture gesturename filename Angle Apex Accent LastFrame Inner Outer \\

$maketurngesture  gesture_turn_left_45 "turn_left_45" -45 20 28 50 lfoot rfoot fps 60 ACT_GESTURE_TURN_LEFT45 1 
$maketurngesture  gesture_turn_left_90 "turn_left_90" -90 20 34 57 lfoot rfoot fps 60 ACT_GESTURE_TURN_LEFT90 1
$maketurngesture  gesture_turn_right_45 "turn_right_45" 45 20 28 50 rfoot lfoot fps 60 ACT_GESTURE_TURN_RIGHT45 1
$maketurngesture  gesture_turn_right_90 "turn_right_90" 90 20 34 50 rfoot lfoot fps 60 ACT_GESTURE_TURN_RIGHT90 1

$makeflatturngesture  gesture_turn_left_45_flat "turn_left_45" -45 20 28 50 lfoot rfoot fps 60 ACT_GESTURE_TURN_LEFT45_FLAT 1 
$makeflatturngesture  gesture_turn_left_90_flat "turn_left_90" -90 20 34 57 lfoot rfoot fps 60 ACT_GESTURE_TURN_LEFT90_FLAT 1
$makeflatturngesture  gesture_turn_right_45_flat "turn_right_45" 45 20 28 50 rfoot lfoot fps 60 ACT_GESTURE_TURN_RIGHT45_FLAT 1
$makeflatturngesture  gesture_turn_right_90_flat "turn_right_90" 90 20 34 50 rfoot lfoot fps 60 ACT_GESTURE_TURN_RIGHT90_FLAT 1

/*
$sequence stairs_up "Stairs_up" LX LZ ACT_CLIMB_UP 1
$sequence stairs_down "Stairs_down" LX LZ ACT_CLIMB_DOWN 1
$sequence ladder_up "Ladder_climb_up" LZ ACT_CLIMB_UP 1
$sequence ladder_down "Ladder_climb_down" LZ ACT_CLIMB_DOWN 1
$sequence shipladder_up "Borealis_stairs_up" LX LZ ACT_SHIPLADDER_UP 1
$sequence shipladder_down "Borealis_stairs_down" LX LZ ACT_SHIPLADDER_DOWN 1

$sequence Run_turn90_left Run_turn90_left
$sequence Run_turn90_right Run_turn90_right
*/

$sequence Startle_behind Startle_behind

// ---- Reacting to scanners ----

$sequence photo_react_blind blinded activity ACT_CIT_BLINDED 1
$sequence photo_react_startle Startled activity ACT_CIT_STARTLED 1

$sequence ThrowItem "ThrowItem" fps 30 { event 1 32 }
$sequence Heal "Heal" activity ACT_CIT_HEAL 1 fps 30 { event 1 31 }
$sequence Wave "Wave" activity ACT_SIGNAL1 1
$sequence Wave_close "Wave_close" activity ACT_SIGNAL2 1


$sequence DuckUnder "DuckUnder" fps 30 LX frames 0 62

$sequence crouchidlehide "crouchidle_hiding" fps 30 loop node "crouchhide"
$sequence standtocrouchhide "stand_to_crouchhide" fps 30 transition "standing" "crouchhide" ACT_TRANSITION 1
$sequence crouchhidetostand "crouchhide_to_stand" fps 30 transition "crouchhide" "standing" ACT_TRANSITION 1
$sequence scaredidle "Idle_scared" fps 30 loop node "standing"

$sequence preSkewer "preSkewer" fps 30 

$sequence Fear_Reaction "Fear_Reaction" fps 30 
$sequence Fear_Reaction_Idle "fear_Reaction" fps 30 loop frames 20 20
$sequence cower "cower" FPS 30 frames 0 29 ACT_COWER 1 
$sequence cower_Idle "cower" loop fps 30 frames 29 29

$animation a_RunN_protected RunN_protected loop LX LY startloop 0 rotateto 0 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 10 ..
	ikrule rfoot footstep range .. 17 1 ..
}

$sequence layer_run_protected "RunN_Protected" weightlist upperbodyreplace hidden

$sequence run_protected_all {
	a_runS a_runSE a_runE a_runNE a_runN_protected a_runNW a_runW a_runSW a_runS
	blendwidth 9 blend move_yaw -180 180 addlayer layer_run_protected ACT_RUN_PROTECTED 1 node "running"
	{ event 6004 6 "NPC_Citizen" }
	{ event 6005 15 "NPC_Citizen" }
}

//=========================== d1_trainstation_01 ==============================================

$sequence layer_luggage_walk "d1_t01_Luggage_WalkN" weightlist upperbodyreplace hidden
$animation a_luggage_walk d1_t01_Luggage_WalkN loop LX LY rotateto 0 alignto idle_subtle {
	ikrule lfoot footstep range .. 8 21 ..
	ikrule rfoot footstep range .. 23  6 ..
}
$sequence luggage_walk_all {
	a_walkS a_walkSE a_walkE
	a_walkNE a_luggage_walk a_walkNW
	a_walkW a_walkSW a_walkS
	blendwidth 9 blend move_yaw -180 180
	addlayer layer_luggage_walk
	ACT_WALK_SUITCASE 1
	node "walking"
	{ event 6004 8 "NPC_Citizen" }
	{ event 6005 23 "NPC_Citizen" }
}

$sequence layer_pace "d1_t01_BreakRoom_PaceN" weightlist upperbodyreplace hidden
$animation a_pace d1_t01_BreakRoom_PaceN loop LX LY rotateto 0 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 21 ..
	ikrule rfoot footstep range .. 23  6 ..
}
$sequence pace_all {
	a_walkS a_walkSE a_walkE
	a_walkNE a_pace a_walkNW
	a_walkW a_walkSW a_walkS
	blendwidth 9 blend move_yaw -180 180
	addlayer layer_pace
	node "walking"
}

$sequence layer_walk_midspeed "d1_t02_Plaza_WalkN_MidSpeed" weightlist upperbodyreplace hidden
$animation a_walk_midspeed d1_t02_Plaza_WalkN_MidSpeed loop LX LY rotateto 0 {
	alignto idle_subtle
	ikrule lfoot footstep range .. 8 21 ..
	ikrule rfoot footstep range .. 23  6 ..
}
$sequence plaza_walk_all {
	a_walkS a_walkSE a_walkE
	a_walkNE a_walk_midspeed a_walkNW
	a_walkW a_walkSW a_walkS
	blendwidth 9 blend move_yaw -180 180
	addlayer layer_walk_midspeed
	node "walking"
	{ event 6004 10 "NPC_Citizen" }
	{ event 6005 27 "NPC_Citizen" }
}


//==================== DEATH POSES ========================================
$sequence deathpose_front "death_poses_front" fps 1 frame 0 6 activity ACT_DIE_FRONTSIDE 1
$sequence deathpose_back "death_poses_back" fps 1 frame 0 6 activity ACT_DIE_BACKSIDE 1
$sequence deathpose_right "death_poses_right" fps 1 frame 0 6 activity ACT_DIE_RIGHTSIDE 1
$sequence deathpose_left "death_poses_left" fps 1 frame 0 6 activity ACT_DIE_LEFTSIDE 1
