"precache" {
	"entity"	"item_suit"
	"entity"	"npc_citizen"
	"entity"	"npc_combine_s"
	"entity"	"npc_combine_c"	
	"entity"	"npc_metropolice"
	"entity" 	"item_item_crate"	
	"entity" 	"weapon_custom24"
	"entity" 	"weapon_custom16"	
	"entity" 	"weapon_custom5"
	"entity" 	"weapon_mp5"	
	"entity" 	"weapon_psp"
	"entity" 	"weapon_svd"	
	"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*"
	}

	"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"
    }
 }

//controls dynamic crate contents -- should focus on giving player rare ammos and batteries 
	"item_dynamic_resupply" {
		"origin" "4736 -2080 56"
		"angles" "0 0 0"		
		"keyvalues" {
			"targetname" "resupply_master"
			"spawnflags" "2"
			"DesiredAmmoCrossbow" ".75"
			"DesiredAmmo357" ".75"
			"DesiredAmmoGrenade" "0.5"
			"DesiredAmmoRPG_Round" "0.5"
			"DesiredAmmoBuckshot" "0.75"
			"DesiredAmmoAR2" "0.1"
			"DesiredAmmoSMG1_Grenade" "0.75"
			"DesiredAmmoSMG1" "0.1"
			"DesiredAmmoPistol" "0.75"
			"DesiredArmor" "0.75"
			"DesiredHealth" "1"
		}		
	}

//force enemies to constantly persue the player	
	"aiscripted_schedule" {
		"origin" "4736 -1080 56"
		"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"
	}

	"item_item_crate"
	{
		"origin"	"105.44 -2542.54 1856"
		"angle"		"0 0 0"
		"KeyValues"
		{
			"ItemClass"		"item_dynamic_resupply"
			"ItemCount"		"4"
		}
	}

	"item_item_crate"
	{
		"origin"	"-46.04 779.42 2128"
		"angle"		"0 0 0"
		"KeyValues"
		{
			"ItemClass"		"item_dynamic_resupply"
			"ItemCount"		"4"
		}
	}	

	"item_item_crate"
	{
		"origin"	"166.26 488.65 1792"
		"angle"		"0 0 0"
		"KeyValues"
		{
			"ItemClass"		"item_dynamic_resupply"
			"ItemCount"		"4"
		}
	}	

	"item_item_crate"
	{
		"origin"	"60.50 1749.15 1696"
		"angle"		"0 0 0"
		"KeyValues"
		{
			"ItemClass"		"item_dynamic_resupply"
			"ItemCount"		"4"
		}
	}	

	"item_item_crate"
	{
		"origin"	"423.07 1749.15 1696"
		"angle"		"0 0 0"
		"KeyValues"
		{
			"ItemClass"		"item_dynamic_resupply"
			"ItemCount"		"4"
		}
	}

	"item_item_crate"
	{
		"origin"	"423.07 1867.15 1696"
		"angle"		"0 0 0"
		"KeyValues"
		{
			"ItemClass"		"item_dynamic_resupply"
			"ItemCount"		"4"
		}
	}

	"item_item_crate"
	{
		"origin"	"338.30 3078.69 1600"
		"angle"		"0 0 0"
		"KeyValues"
		{
			"ItemClass"		"item_dynamic_resupply"
			"ItemCount"		"4"
		}
	}	

	"item_item_crate"
	{
		"origin"	"572.94 1852.80 2127"
		"angle"		"0 0 0"
		"KeyValues"
		{
			"ItemClass"		"item_dynamic_resupply"
			"ItemCount"		"4"
		}
	}	

//prevents excess weapons from lagging the game	
	"game_weapon_manager" {
		"origin" "5720 6043 60"
  			"keyvalues" {
  						"targetname"	"cleaner"
  						"weaponname"	"weapon_*"
  						"maxpieces"	"15"
  			}
	}
}

//this is constantly triggered in LUA for refresh player location for enemies to hunt them
"entities:search" {

	"event" {
		"targetname" "playersearch"
		"action" "StartSchedule"
		//"value" "5"
	}	
}

//spawn items
"entities:starting_equipment" {

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

//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_custom24"
    }
}

"entities:reward_6mins" {

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

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

"entities:reward_4mins" {

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

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

"entities:reward_2mins" {

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

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

"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"
	}
}