	**********************************************PLAYER VERSION ********************************************
	** autohide.sqf for TWIRL_Hide (Addon) v1.0 - Twirly 1-Oct-2011
	*********************************************************************************************************

	Thanks to DMarkwick for letting me use his viewblock in order to make this. All credit to him really.
	

	This script is intended for Single Player use. I have no idea what will happen in a Multiplayer game!

	*********************************************************************************************************
	** Executing the script
	*********************************************************************************************************

	The addon can be started on a player by a very simply from your init.sqf like this:-

		nul = [] execVM "TWIRL_Hide\script\autohide.sqf";
		
	The addon can be started on an AI unit by a very simply from your init.sqf like this:-
	
		nul = [_unit] execVM "TWIRL_Hide\script\autohide.sqf";

	Nothing else really needs to be set for it to work. Hard coded default values will be used. Players of any soldier
	type will have the ability to hide.. but I do suggest to turn on debugging until you get the hang of
	what's going on. 
	

	To debug the player and make the viewblock visible place this code in the line before you call the script:-

		TWIRL_Hide_ShowModel = TRUE;
		
	To debug an AI unit place this code in the line before you call the script:-
	
		TWIRL_Hide_ShowModelAI = TRUE;
	
	Tip: For AI unit variables just add "AI" to the end.
	
	NOTE: For AI units there will be no text hints. The viewblock will be visible to aid in tweaking however.


	*********************************************************************************************************
	** To changing the hard coded default values. Create the following variables. These are entirely optional
	** The variables can be now be configured below in the CONFIGURATION section. They are part of the script.
	*********************************************************************************************************

	Place one or more of these in the lines before you call the script.

	TWIRL_Hide_Enabled = true;		//Hiding is ON by default. You can turn it off at anytime by setting
						//this to FALSE. The script will not stop running but will enter a simple
						//loop till it's switched back on. For disabling temporarily if needed.

	TWIRL_Hide_ShowModel = false;	//Turning this on makes the hide (viewblock) visible. Use this for
					//tweaking. FALSE by default.

	TWIRL_Hide_ReportStat = false;	//Turning this on allows text reports about movement and the status
					//of the viewblock. FALSE by default.

	TWIRL_Hide_ReportSurf = false;	//Turning this on allows text reports about what surace you are standing
					//on. FALSE by default.

	TWIRL_Hide_AllSurfaces = true;	//If enabled then hiding is available everywhere. If false then the
					//list of allowed surfaces (see below) comes into play. TRUE by default

	TWIRL_Hide_FreeHead = false;	//If enabled then moving your head around does not affect the viewblock
					//at all. FALSE by default (moving will have an effect)

	TWIRL_Hide_HeadTR = 5;		//The rate of turn in deg/sec before head turning will affect the
					//viewblock. Default value: 5

	TWIRL_Hide_BodyTR = 5;		//The rate of turn in deg/sec before body turning will affect the viewblock.
					//Default value: 5

	TWIRL_Hide_MaxHeight = 0;	//The maximum height the viewblock will rise too.
					//Probably best left alone.

	TWIRL_Hide_PosZRate = 0.01;	//The rate at which the viewblock will rise.
					//Default value: 0.01 (must be positive number)

	TWIRL_Hide_NegZRate = 0.2;	//The rate at which the viewblock will sink.
					//Default value: 0.2 (must be positive number)

	TWIRL_Hide_WeapFactor = 3;	//If you use a weapon the drop rate will be increased by this factor.
					//Default value: 3

	TWIRL_Hide_TimeOut = 30;	//The time between when the viewblock was deleted and another one is
					//allowed to be created. Default value is 30 seconds

					//For random time use something like this:-

					//TWIRL_Hide_TimeOut = 10 + (random 10); //between 10 and 20 secs.


	*********************************************************************************************************
	** To specify which type of units can use the script along with their hide values...create an array
	** like this.
	*********************************************************************************************************


	*********************************************************************************************************
	** To specify which type of units can use the script along with their hide values...create an array
	** like this.
	*********************************************************************************************************

	This array must be defined before you call the script. All parameters are mandatory if you want to
	go this way. If the array is empty or not defined all unit types can use it the script.

	TWIRL_Hide_AllowedUnits = [

		["Ins_Soldier_Sniper",true,true,10,5,0.1,0.5,3,10],
		["RU_Soldier_Sniper",true,true,10,5,0.1,0.5,3,10],
		["RU_Soldier_SniperH",true,true,10,5,0.1,0.5,3,10],
		["RU_Soldier_Spotter",true,true,10,5,0.1,0.5,3,10],
		["MVD_Soldier_Sniper",true,true,10,5,0.1,0.5,3,10],
		["USMC_SoldierS_Sniper",true,true,10,5,0.1,0.5,3,10],
		["USMC_SoldierS_Spotter",true,true,10,5,0.1,0.5,3,10],
		["USMC_SoldierS_SniperH",true,true,10,5,0.1,0.5,3,10],
		["GUE_Soldier_Sniper",true,true,10,5,0.1,0.5,3,10],
		["GUE_Soldier_Scout",true,true,10,5,0.1,0.5,3,10],
		["RU_Farmwife5",true,true,10,5,0.1,0.5,3,10]

	];

	Pay special attention to the format and to the fact that the last line does not have a comma!

	This is the order for each line:-

			1. The soldier type
			2. TWIRL_HideAllSurfaces
			3. TWIRL_HideFreeHead
			4. TWIRL_HideHeadTurnRate
			5. TWIRL_HideBodyTurnRate
			6. TWIRL_HidePosZRate
			7. TWIRL_HideNegZRate
			8. TWIRL_HideWeaponFactor
			9. TWIRL_HideTimeOut

	*********************************************************************************************************
	** This array is used to specify on which surfaces you can hide if TWIRL_HideAllowAllSurfaces = false
	*********************************************************************************************************

	This list has been compiled using several islands and may not be complete even for each island! It's
	probably best to compile your own!

	TWIRL_Hide_AllowedSurfaces = [

		"#tig_trava","#UTGrass","#UTForest","#CRGrass1","#CRForest1","#CRForest2","#GZTrava",
		"#GZforest","#DBPolopoust","#TKPolopoust","#TKTrava","#ZRPolopoust","#ZRTrava","#ZRPole",
		"#DEPolopoust","#DESkalniSterk","#hotze_grass","#hotze_wald","#yap_trava2",
		"AfghanValleyslopeSurface","#AfghanValleysandSurface"
	];

	The above surface types are from the following islands and I imagine would be nowhere near complete, You
	can find new ones by setting TWIRL_HideDebug=TRUE. The surface you are on will be constantly displayed.
	I guess you'll have to write it down!:-
	
	Utes -  		"#UTGrass","#UTForest"
	Chenerus - 		"#CRGrass1","#CRForest1","#CRForest2"
	Proving Grounds - 	"#GZTrava","#GZforest"
	Shapur - 		"#DBPolopoust"
	Takistan = 		"#TKPolopoust","#TKTrava"
	Zargabad - 		"#ZRPolopoust","#ZRTrava","#ZRPole"
	Desert_E - 		"#DEPolopoust","#DESkalniSterk"
	Tigeria - 		"#tig_trava"
	Malden - 		"#hotze_grass","#hotze_wald"
	Nogova - 		"#hotze_grass","#hotze_wald"
	Yapal - 		"#yap_trava2"
	AfghanValley - 		"#AfghanValleyslopeSurface","#AfghanValleysandSurface"

	--------------

	Hope you enjoy it,

	-twirly-
