// player init
if (gitsnades<2) then {_intro = player execVM "scripts\intro.sqf"};

_cevents = [] execVM "scripts\EventsC.sqf"; // Common player events
sleep 0.1;

//medic and engineer setup
_playertype = typeOf (vehicle player);
Sleep 0.2;

if (_playertype in EGG_EVO_PlayerMedic)  then 
{
	mymash = objnull;
//old a3 alpha non mash workaround - should be redundant now - explore switching back to old mtent action
	if(player == eng4) then {mymash = MASH1};
	if(player == eng5) then {mymash = MASH2};
	if(player == eng15) then {mymash = MASH3};
	if(player == eng16) then {mymash = MASH4};	
	_med = player execVM "actions\med.sqf";
};
if (_playertype in EGG_EVO_PlayerEng) then
{
	if(player == eng2) then {EGG_EVO_EngZone = reng1};
	if(player == eng3) then {EGG_EVO_EngZone = reng2};
	if(player == eng13) then {EGG_EVO_EngZone = reng3};
	if(player == eng14) then {EGG_EVO_EngZone = reng4};	
};

Sleep 0.1;

/*
_tag = player addaction ["Stop Dancing","actions\disco\pdance.sqf",0,1, true, true,"test2"];
_tag = player addaction ["Kung Fu","actions\disco\pdance.sqf",1,1, true, true,"test2"];
_tag = player addaction ["Boogie","actions\disco\pdance.sqf",2,1, true, true,"test2"];
_tag = player addaction ["Rocky","actions\disco\pdance.sqf",3,1, true, true,"test2"];
_tag = player addaction ["Tricking","actions\disco\pdance.sqf",4,1, true, true,"test2"];
_tag = player addaction ["Madness","actions\disco\pdance.sqf",5,1, true, true,"test2"];
_tag = player addaction ["Russian Crap","actions\disco\pdance.sqf",6,1, true, true,"test2"];
*/

//enable T menu
Mpage =[true,false,false,false,false];
(FindDisplay 46) DisplayAddEventHandler ["keydown","if ((_this select 1) In actionKeys ""TeamSwitch"") then {a = createDialog 'evoUI'}"];

// Event handler to know when a player was attacked by an enemy for healing.
player addEventHandler ["hit", {	if (side (_this select 1) == east) then {EGG_EVO_fattack = true;};}];

_events = [] execVM "scripts\EVO_Vecinit.sqf"; // Player vehicles rank restriction system
_rain = [] execVM "scripts\rain.sqf";
_cthread = [] execVM "scripts\MainThreadC.sqf";
//Ctraffic = [] execVM "scripts\EGG_EVO_CivTraffic.sqf";//temp for alpha
_ambmarker = [] execVM "scripts\transfer\ambmarker.sqf";
_box = [0] call EGG_EVO_AmmoBox;

//////////////////kbbw adding arsenal - uses param 29
if (EGG_arsenal>0) then
{
	_Arbox = [0] execVM "scripts\KBBW_Ammobox.sqf";
};

//added to make markers show up on first spawn
[] call EGG_EVO_AssignTasks;

//waituntil {(EGG_sinit2==1)};

//initial weapon loadout
//strip player
removeheadgear player;
removeGoggles player;
removeVest player;
removeUniform player;
removebackpack player;
removeAllAssignedItems player;

{player removeMagazine _x} forEach magazines player;
_startweps = [(primaryweapon player),(secondaryweapon player), (handgunweapon player)];
sleep 0.1;
{player removeweapon _x} forEach _startweps;
sleep 0.5;

//add default loadout
player addGoggles EGG_EVO_goggles;
player addheadgear EGG_EVO_headgear;
player AddVest EGG_EVO_vest;
player addUniform EGG_EVO_uniform;
player addbackpack EGG_EVO_backpack;
{player addmagazine _x} forEach EGG_EVO_pallammo;
{player additem _x} forEach EGG_EVO_pitems;
{player addweapon _x} forEach EGG_EVO_pweapons;
{player additem _x; player assignItem _x} forEach EGG_EVO_aitems;

//adding starter kit to classes
if ((_playertype in EGG_EVO_PlayerOff) and (perkparam == 1)) then 
{
	player additem (EGG_EVO_playerOffweps select 0);
	player assignitem (EGG_EVO_playerOffweps select 0);
};
if ((_playertype in EGG_EVO_PlayerEng) and (perkparam == 1)) then
{
	player additem (EGG_EVO_CHITEMS select 0);
	player additem (EGG_EVO_CHITEMS select 2);
};
if ((_playertype in EGG_EVO_playerMedic) and (perkparam == 1)) then
{
	player additem (EGG_EVO_CHITEMS select 1);
};
if ((_playertype in EGG_EVO_PlayerAA) and (perkparam == 1)) then 
{
	player addmagazines [(EGG_EVO_playerAAweps select 1),2];
	player addweapon (EGG_EVO_playerAAweps select 0);
};
if ((_playertype in EGG_EVO_PlayerSniper) and (perkparam == 1)) then
{
	player additem (EGG_EVO_playerSniweps select 0);
};

// Save default loadout
sleep 0.12;
if (EWDB_on <1) then 
{
	loadout = [player] call saveLoadout;
};
sleep 0.05;
EGG_pinit = 1;// publicVariable EGG_pinit;
if (EWDB_on == 2) then //editor =1/ experimental
{
//enable me with EWDB parameter setting set to "experimental"
//you and your group will start the game with 1000 points and be able to teleport about
	EGG_EVO_punit = player;
	EGG_EVO_prew  = 1000;
	publicVariable "EGG_EVO_prew";
	publicVariable "EGG_EVO_punit";
	sleep 4;
};


