"precache" {
	"entity"	"item_suit"
	"entity"	"npc_antlion"
	"entity"	"npc_fastzombie"
	"entity"	"npc_headcrab"	
	"entity"	"npc_zombie"
	"entity"	"npc_zombie2"
	"entity"	"npc_houndeye"
	"entity"	"npc_bullsquid"		
	"entity" 	"item_item_crate"	
	"entity" 	"weapon_mp5"
	"entity" 	"weapon_ak47"
	"entity" 	"weapon_custom15"
	"entity" 	"weapon_scissor"	
	"entity" 	"weapon_lasergun"	
	"sound"		"Player.GetBattery" //<---THIS IS NEEDED!		
	"sound"		"Player.Reward" //<---THIS IS NEEDED!	
	"sound"		"Player.Tick" //<---THIS IS NEEDED!	
	"sound"		"Player.2MinWarning" //<---THIS IS NEEDED!		
}


"entities" {

//removes survivor sprite hints
	"removeentity" {
		"targetname" "wboxassist*"
	}

	"removeentity" {
		"targetname" "item_box_assist*"
	}	
	
	"instant_trig" {
		"keyvalues" {
			"timer"	"0.1"
			"label"	"Init"
		}
	}

	"point_servercommand" {
		"keyvalues" {
			"targetname" "game_s_cmd"
		}
	}	
	
    "point_servercommand" {
    "keyvalues" {
    "targetname" "player_equipment"
    }
 }

    "instant_trig" {
    "keyvalues" {
    "timer" "0.1"
    "label" "starting_equipment"
    }
 }
 
//force enemies to constantly persue the player	
	"aiscripted_schedule" {
		"origin" "0 -0 0"
		"angles" "0 0 0"		
		"keyvalues" {
			"targetname" "playersearch"
			"goalent" "!player"
			"m_iszEntity" "enemy"
			"schedule" "6"
			"forcestate" "3"
			"interruptability" "0"			
			"m_flRadius" "0"
			"graball" "1"			
			"spawnflags" "4"			
		}		
	}		
}

"entities:Init" {

	"player" {
		//"message"	"Survive"
		"music"		"survival"
	}

	"env_message" {
		"keyvalues" {
		"targetname" "battle_intro"
		"message" "battlemode"
		}
	}	

	"event" {
		"targetname" "battle_intro"
		"action" "showmessage"
		"delaytime" "1.5"
	}

	"lua" {
		"callfunc" "Initialize"
	}

//ensure that aliens will be pals in the cause of killing the freeman	
	"ai_relationship" {
		"keyvalues" {
			"targetname" "relationship2"
			"subject"	"npc_antlion"
			"target"	"npc_zombie"
			"disposition" "3"
			"rank" "1"
			"StartActive" "1"
			"Reciprocal" "1"
		}
	}	

	"ai_relationship" {
		"keyvalues" {
			"targetname" "relationship3"
			"subject"	"npc_antlion"
			"target"	"npc_fastzombie"
			"disposition" "3"
			"rank" "1"
			"StartActive" "1"
			"Reciprocal" "1"
		}
	}

	"ai_relationship" {
		"keyvalues" {
			"targetname" "relationship3"
			"subject"	"npc_antlion"
			"target"	"npc_zombie2"
			"disposition" "3"
			"rank" "1"
			"StartActive" "1"
			"Reciprocal" "1"
		}
	}	

	"ai_relationship" {
		"keyvalues" {
			"targetname" "relationship3"
			"subject"	"npc_antlion"
			"target"	"npc_headcrab"
			"disposition" "3"
			"rank" "1"
			"StartActive" "1"
			"Reciprocal" "1"
		}
	}

	"ai_relationship" {
		"keyvalues" {
			"targetname" "relationship3"
			"subject"	"npc_antlion"
			"target"	"npc_headcrab_fast"
			"disposition" "3"
			"rank" "1"
			"StartActive" "1"
			"Reciprocal" "1"
		}
	}	
	
	"ai_relationship" {
		"keyvalues" {
			"targetname" "relationship3"
			"subject"	"npc_antlion"
			"target"	"npc_houndeye"
			"disposition" "3"
			"rank" "1"
			"StartActive" "1"
			"Reciprocal" "1"
		}
	}

	"ai_relationship" {
		"keyvalues" {
			"targetname" "relationship3"
			"subject"	"npc_antlion"
			"target"	"npc_bullsquid"
			"disposition" "3"
			"rank" "1"
			"StartActive" "1"
			"Reciprocal" "1"
		}
	}
	
//prevents excess weapons from lagging the game	
	"game_weapon_manager" {
		"origin" "5720 6043 60"
  			"keyvalues" {
  						"targetname"	"cleaner"
  						"weaponname"	"weapon_*"
  						"maxpieces"	"15"
  			}
	}
}

//spawn items
"entities:starting_equipment" {

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "exec survivor_loadout"
    }
}

"entities:search" {

	"event" {
		"targetname" "playersearch"
		"action" "StartSchedule"
	}	
}

"entities:relations" {

	"event" {
		"targetname" "relationship2"
		"action" "applyrelationship"
	}

	"event" {
		"targetname" "relationship3"
		"action" "applyrelationship"
	}
}
	
//rewards
"entities:killitems" {

    "sound"
    {
        "targetname" "!player"
        "soundname" "Player.GetBattery"
    }

    "event" {
		"targetname" "player_equipment"
		"action" "command"
		"value" "give item_battery"
    }
}

"entities:reward_8mins" {

    "sound"
    {
        "targetname" "!player"
        "soundname" "Player.Reward"
    }

    "event" {
		"targetname" "player_equipment"
		"action" "command"
		"value" "give weapon_ak47"
    }
}

"entities:reward_6mins" {

    "sound"
    {
        "targetname" "!player"
        "soundname" "Player.Reward"
    }

    "event" {
		"targetname" "player_equipment"
		"action" "command"
		"value" "give weapon_scissor"
    }
}

"entities:reward_4mins" {

    "sound"
    {
        "targetname" "!player"
        "soundname" "Player.Reward"
    }

    "event" {
		"targetname" "player_equipment"
		"action" "command"
		"value" "give weapon_lasergun"
    }
}

"entities:reward_2mins" {

    "sound"
    {
        "targetname" "!player"
        "soundname" "Player.Reward"
    }

    "event" {
		"targetname" "player_equipment"
		"action" "command"
		"value" "give weapon_custom15"
    }
}

"entities:tick" {

    "sound"
    {
        "targetname" "!player"
        "soundname" "Player.Tick"
    }
}

"entities:warning" {

    "sound"
    {
        "targetname" "!player"
        "soundname" "Player.2MinWarning"
    }
}

//good gameover
"entities:GameEnd" {

	"removeentity" {
		"targetname" "enemy"
	}
	
	"player" {
		"fadeout"	"4"
		"message"	"#HL2_GameOver_Survival_Complete"
		"music"		"survival_win"
	}

	"instant_trig" {
		"keyvalues" {
			"label"	"disconnect"
			"timer"	"8"
		}
	}		
	
}

//bad gameover
"entities:GameOver" {

	"player" {
		"fadeout"	"4"
		"message"	"#HL2_GameOver_Survival"
		"music"		"survival_loss"
	}
	
}


"entities:disconnect" {
		"event" {
		"targetname" "game_s_cmd"
		"action" "command"
		"value" "disconnect"
	}
}