Advertisement
Guest User

Untitled

a guest
Dec 26th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 62.40 KB | None | 0 0
  1. scriptName "Functions\misc\fn_selfActions.sqf";
  2. /***********************************************************
  3. ADD ACTIONS FOR SELF
  4. - Function
  5. - [] call fnc_usec_selfActions;
  6. ************************************************************/
  7. if (dayz_actionInProgress) exitWith {};
  8. private ["_canPickLight","_text","_dir","_canDoThis","_w2m","_bb","_waterHoles","_unlock","_lock","_totalKeys","_temp_keys","_temp_keys_names",
  9. "_hasKey","_oldOwner","_hasAttached","_isZombie","_isHarvested","_isMan","_isFuel","_hasRawMeat","_hastinitem","_player_deleteBuild",
  10. "_player_lockUnlock_crtl","_displayName","_hasIgnators","_menu","_menu1","_allowTow","_liftHeli","_found","_posL","_posC","_height","_attached",
  11. "_combi","_findNearestGen","_humanity_logic","_low_high","_cancel","_buy","_buyV","_humanity","_traderMenu","_warn","_typeOfCursorTarget",
  12. "_isVehicle","_isBicycle","_isDestructable","_isGenerator","_ownerID","_isVehicletype","_hasBarrel","_hasFuel20","_hasFuel5","_hasEmptyFuelCan",
  13. "_itemsPlayer","_hasToolbox","_hasbottleitem","_isAlive","_isPlant","_istypeTent","_upgradeItems","_isDisallowRefuel","_isDog",
  14. "_isModular","_isModularDoor","_isHouse","_isGate","_isFence","_isLockableGate","_isUnlocked","_isOpen","_isClosed","_ownerArray","_ownerBuildLock",
  15. "_ownerPID","_speed","_dog","_vehicle","_inVehicle","_cursorTarget","_primaryWeapon","_currentWeapon","_magazinesPlayer","_onLadder","_canDo",
  16. "_nearLight","_vehicleOwnerID","_hasHotwireKit","_isPZombie","_dogHandle","_allowedDistance","_id","_upgrade","_weaponsPlayer","_hasCrowbar",
  17. "_allowed","_hasAccess","_uid"];
  18.  
  19. _vehicle = vehicle player;
  20. _inVehicle = (_vehicle != player);
  21. _cursorTarget = cursorTarget;
  22. _primaryWeapon = primaryWeapon player;
  23. _currentWeapon = currentWeapon player;
  24. _magazinesPlayer = magazines player;
  25. _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  26. _canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);
  27. //_canDrink = count nearestObjects [getPosATL player, ["Land_pumpa","Land_water_tank"], 2] > 0;
  28. _uid = getPlayerUID player;
  29. _nearLight = nearestObject [player,"LitObject"];
  30. _canPickLight = false;
  31. _vehicleOwnerID = _vehicle getVariable ["CharacterID","0"];
  32. _hasHotwireKit = "ItemHotwireKit" in _magazinesPlayer;
  33. _isPZombie = player isKindOf "PZombie_VB";
  34. _dogHandle = player getVariable ["dogID",0];
  35.  
  36. if (!isNull _nearLight) then {
  37. if (_nearLight distance player < 4) then {
  38. _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
  39. };
  40. };
  41.  
  42. //Grab Flare
  43. if (_canPickLight && !dayz_hasLight && !_isPZombie) then {
  44. if (s_player_grabflare < 0) then {
  45. _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
  46. s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true];
  47. s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true];
  48. };
  49. } else {
  50. player removeAction s_player_grabflare;
  51. player removeAction s_player_removeflare;
  52. s_player_grabflare = -1;
  53. s_player_removeflare = -1;
  54. };
  55.  
  56. if (s_player_equip_carry < 0) then {
  57. if (dayz_onBack != "" && { !_inVehicle && { !_onLadder && { !r_player_unconscious } } }) then {
  58. dz_plr_carryActionItem = dayz_onBack;
  59. _text = getText (configFile >> "CfgWeapons" >> dz_plr_carryActionItem >> "displayName");
  60. s_player_equip_carry = player addAction [
  61. format [localize "STR_ACTIONS_WEAPON", _text],
  62. "\z\addons\dayz_code\actions\player_switchWeapon_action.sqf",
  63. nil, 0.5, false, true];
  64. };
  65. } else {
  66. if (dayz_onBack != dz_plr_carryActionItem || { _inVehicle || { _onLadder || { r_player_unconscious } } } ) then {
  67. player removeAction s_player_equip_carry;
  68. s_player_equip_carry = -1;
  69. };
  70. };
  71.  
  72. /*if (dayz_onBack != "" /*&& !dayz_onBackActive && !_inVehicle && !_onLadder && !r_player_unconscious) then {
  73. if (s_player_equip_carry < 0) then {
  74. _text = getText (configFile >> "CfgWeapons" >> dayz_onBack >> "displayName");
  75. s_player_equip_carry = player addAction [format[localize "STR_ACTIONS_WEAPON", _text], "\z\addons\dayz_code\actions\player_switchWeapon_action.sqf", nil, 0.5, false, true];
  76. };
  77. } else {
  78. player removeAction s_player_equip_carry;
  79. s_player_equip_carry = -1;
  80. };*/
  81.  
  82. //fishing
  83. if ((_currentWeapon in Dayz_fishingItems) && {!dayz_fishingInprogress} && {!_inVehicle} && {!dayz_isSwimming}) then {
  84. if (s_player_fishing < 0) then {
  85. s_player_fishing = player addAction [localize "STR_ACTION_CAST", "\z\addons\dayz_code\actions\player_goFishing.sqf",player, 0.5, false, true];
  86. };
  87. } else {
  88. player removeAction s_player_fishing;
  89. s_player_fishing = -1;
  90. };
  91. if ((_primaryWeapon in Dayz_fishingItems) && {!dayz_fishingInprogress} && {_inVehicle && (driver _vehicle != player)}) then {
  92. if (s_player_fishing_veh < 0) then {
  93. s_player_fishing_veh = _vehicle addAction [localize "STR_ACTION_CAST", "\z\addons\dayz_code\actions\player_goFishing.sqf",_vehicle, 0.5, false, true];
  94. };
  95. } else {
  96. _vehicle removeAction s_player_fishing_veh;
  97. s_player_fishing_veh = -1;
  98. };
  99.  
  100. _canDoThis=false;
  101. if (_canDo && !_inVehicle && !dayz_isSwimming) then {
  102. {
  103. _waterHoles = if (typeOf _x == "waterHoleProxy") then {nearestObjects [_x, [], 1];} else {[_x];};
  104. {
  105. _w2m = _x worldToModel (getPosATL player);
  106. _bb = (boundingbox _x) select 1;
  107. _dir = [player, _x] call BIS_fnc_relativeDirTo; if (_dir > 180) then {_dir = _dir - 360};
  108. if (((abs _dir < 45) && {(_x distance player < 2.22)}) // wells, kasna, pumpa
  109. or {((("" == typeOf _x) && ((_w2m select 2) < 0.05)) && {((abs(_w2m select 0) < (_bb select 0)) && (abs(_w2m select 1) < (_bb select 1)))})}) exitWith { // ponds
  110. _canDoThis = true;
  111. };
  112. } count _waterHoles;
  113. if (_canDoThis) exitWith {
  114. if (s_player_Drinkfromhands < 0) then {
  115. s_player_Drinkfromhands = player addAction [localize "STR_ACTIONS_DRINK2", "\z\addons\dayz_code\actions\player_drinkWater.sqf",player, 0.5, false, true];
  116. };
  117. };
  118. } foreach nearestObjects [player, ["waterHoleProxy", "Land_pumpa"], 50];
  119. };
  120. if (!_canDoThis && s_player_Drinkfromhands >= 0) then {
  121. player removeAction s_player_Drinkfromhands;
  122. s_player_Drinkfromhands = -1;
  123. };
  124.  
  125. if (_inVehicle) then {
  126. DZE_myVehicle = _vehicle;
  127. if (_vehicleOwnerID != "0" && _canDo) then {
  128. if (s_player_lockUnlockInside_ctrl < 0) then {
  129. _totalKeys = call epoch_tempKeys;
  130. _temp_keys = _totalKeys select 0;
  131. _temp_keys_names = _totalKeys select 1;
  132. _hasKey = _vehicleOwnerID in _temp_keys;
  133. _oldOwner = (_vehicleOwnerID == _uid);
  134. _text = getText (configFile >> "CfgVehicles" >> (typeOf DZE_myVehicle) >> "displayName");
  135. if (locked DZE_myVehicle) then {
  136. if (_hasKey || _oldOwner) then {
  137. _unlock = DZE_myVehicle addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[DZE_myVehicle,(_temp_keys_names select (parseNumber _vehicleOwnerID))], 2, false, true];
  138. s_player_lockUnlockInside set [count s_player_lockUnlockInside,_unlock];
  139. s_player_lockUnlockInside_ctrl = 1;
  140. } else {
  141. if (_hasHotwireKit) then {
  142. _unlock = DZE_myVehicle addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",DZE_myVehicle, 2, true, true];
  143. } else {
  144. _unlock = DZE_myVehicle addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_VEHLOCKED"], "",DZE_myVehicle, 2, true, true];
  145. };
  146. s_player_lockUnlockInside set [count s_player_lockUnlockInside,_unlock];
  147. s_player_lockUnlockInside_ctrl = 1;
  148. };
  149. } else {
  150. if (_hasKey || _oldOwner) then {
  151. _lock = DZE_myVehicle addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",DZE_myVehicle, 1, false, true];
  152. s_player_lockUnlockInside set [count s_player_lockUnlockInside,_lock];
  153. s_player_lockUnlockInside_ctrl = 1;
  154. };
  155. };
  156. };
  157. } else {
  158. {DZE_myVehicle removeAction _x} count s_player_lockUnlockInside;s_player_lockUnlockInside = [];
  159. s_player_lockUnlockInside_ctrl = -1;
  160. };
  161. } else {
  162. {DZE_myVehicle removeAction _x} count s_player_lockUnlockInside;s_player_lockUnlockInside = [];
  163. s_player_lockUnlockInside_ctrl = -1;
  164. };
  165.  
  166. if (DZE_HeliLift) then {
  167. _hasAttached = _vehicle getVariable["hasAttached",false];
  168. if (_inVehicle && {_vehicle isKindOf "Air"} && {(([_vehicle] call FNC_getPos) select 2) < 30} && {speed _vehicle < 5} && {typeName _hasAttached == "OBJECT"}) then {
  169. if (s_player_heli_detach < 0) then {
  170. dayz_myLiftVehicle = _vehicle;
  171. s_player_heli_detach = dayz_myLiftVehicle addAction [localize "STR_EPOCH_ACTIONS_DETACHVEHICLE","\z\addons\dayz_code\actions\player_heliDetach.sqf",[dayz_myLiftVehicle,_hasAttached],2,false,true];
  172. };
  173. } else {
  174. dayz_myLiftVehicle removeAction s_player_heli_detach;
  175. s_player_heli_detach = -1;
  176. };
  177. };
  178.  
  179. if (DZE_HaloJump) then {
  180. if (_inVehicle && {_vehicle isKindOf "Air"} && {(([_vehicle] call FNC_getPos) select 2) > 400}) then {
  181. if (s_halo_action < 0) then {
  182. DZE_myHaloVehicle = _vehicle;
  183. s_halo_action = DZE_myHaloVehicle addAction [localize "STR_EPOCH_ACTIONS_HALO","\z\addons\dayz_code\actions\halo_jump.sqf",[],2,false,true];
  184. };
  185. } else {
  186. DZE_myHaloVehicle removeAction s_halo_action;
  187. s_halo_action = -1;
  188. };
  189. };
  190.  
  191. if (DZE_NameTags > 0) then {
  192. if (s_player_showname < 0 && !_isPZombie) then {
  193. if (DZE_NameTags < 2) then {
  194. s_player_showname = 1;
  195. player setVariable["DZE_display_name",true,true];
  196. } else {
  197. s_player_showname = player addAction [localize "STR_EPOCH_ACTIONS_NAMEYES", "\z\addons\dayz_code\actions\display_name.sqf",true, 0, true, false];
  198. s_player_showname1 = player addAction [localize "STR_EPOCH_ACTIONS_NAMENO", "\z\addons\dayz_code\actions\display_name.sqf",false, 0, true, false];
  199. };
  200. };
  201. };
  202.  
  203. if (_isPZombie) then {
  204. if (s_player_attack < 0) then {
  205. s_player_attack = player addAction [localize "STR_EPOCH_ACTIONS_ATTACK", "\z\addons\dayz_code\actions\pzombie\pz_attack.sqf", _cursorTarget, 6, false, true];
  206. };
  207. if (s_player_callzombies < 0) then {
  208. s_player_callzombies = player addAction [localize "STR_EPOCH_ACTIONS_RAISEHORDE", "\z\addons\dayz_code\actions\pzombie\call_zombies.sqf",player, 5, true, false];
  209. };
  210. if (s_player_pzombiesvision < 0) then {
  211. s_player_pzombiesvision = player addAction [localize "STR_EPOCH_ACTIONS_NIGHTVIS", "\z\addons\dayz_code\actions\pzombie\pz_vision.sqf", [], 4, false, true, "nightVision", "_this == _target"];
  212. };
  213. if (!isNull _cursorTarget && (player distance _cursorTarget < 3)) then {
  214. _isZombie = _cursorTarget isKindOf "zZombie_base";
  215. _isHarvested = _cursorTarget getVariable["meatHarvested",false];
  216. _isMan = _cursorTarget isKindOf "Man"; //includes animals and zombies
  217. if (!alive _cursorTarget && _isMan && !_isZombie && !_isHarvested) then {
  218. if (s_player_pzombiesfeed < 0) then {
  219. s_player_pzombiesfeed = player addAction [localize "STR_EPOCH_ACTIONS_FEED", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",_cursorTarget, 3, true, false];
  220. };
  221. } else {
  222. player removeAction s_player_pzombiesfeed;
  223. s_player_pzombiesfeed = -1;
  224. };
  225. } else {
  226. player removeAction s_player_pzombiesfeed;
  227. s_player_pzombiesfeed = -1;
  228. };
  229. };
  230.  
  231. // Increase distance only if AIR or SHIP
  232. _allowedDistance = if ((_cursorTarget isKindOf "Air") or (_cursorTarget isKindOf "Ship")) then {8} else {4};
  233.  
  234. if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cursorTarget < _allowedDistance) && _canDo) then {
  235. //Has some kind of target
  236. _typeOfCursorTarget = typeOf _cursorTarget;
  237. _isVehicle = _cursorTarget isKindOf "AllVehicles";
  238. _isBicycle = _cursorTarget isKindOf "Bicycle";
  239. _isMan = _cursorTarget isKindOf "Man"; //includes animals and zombies
  240. _isDestructable = _cursorTarget isKindOf "BuiltItems";
  241. _isGenerator = _cursorTarget isKindOf "Generator_DZ";
  242. //_isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"]; //Checked in player_flipvehicle
  243. _isFuel = false;
  244. _hasBarrel = "ItemFuelBarrel" in _magazinesPlayer;
  245. _hasFuel20 = "ItemJerrycan" in _magazinesPlayer;
  246. _hasFuel5 = "ItemFuelcan" in _magazinesPlayer;
  247. _hasEmptyFuelCan = (("ItemJerrycanEmpty" in _magazinesPlayer) || ("ItemFuelcanEmpty" in _magazinesPlayer) || ("ItemFuelBarrelEmpty" in _magazinesPlayer));
  248. _itemsPlayer = items player;
  249. _weaponsPlayer = weapons player;
  250. _hasCrowbar = "ItemCrowbar" in _itemsPlayer or "MeleeCrowbar" in _weaponsPlayer or dayz_onBack == "MeleeCrowbar";
  251. _hasToolbox = "ItemToolbox" in _itemsPlayer;
  252. _hasbottleitem = (("ItemWaterBottle" in _magazinesPlayer) || ("ItemWaterBottleInfected" in _magazinesPlayer) || ("ItemWaterBottleSafe" in _magazinesPlayer));
  253. _isAlive = alive _cursorTarget;
  254. _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
  255. _isPlant = _typeOfCursorTarget in Dayz_plants;
  256. _istypeTent = (_cursorTarget isKindOf "TentStorage_base") or (_cursorTarget isKindOf "IC_Tent");
  257. _upgradeItems = ["TentStorage","TentStorage0","TentStorage1","TentStorage2","TentStorage3","StashSmall","StashSmall1","StashSmall2","StashSmall3","StashSmall4","StashMedium","StashMedium1","StashMedium2","StashMedium3","DomeTentStorage","DomeTentStorage0","DomeTentStorage1","DomeTentStorage2","DomeTentStorage3","DomeTentStorage4"];
  258. _characterID = _cursorTarget getVariable ["CharacterID","0"];
  259.  
  260. if (DZE_permanentPlot) then {
  261. _id = _uid;
  262. _ownerID = _cursorTarget getVariable ["ownerPUID","0"];
  263. } else {
  264. _id = dayz_characterID;
  265. _ownerID = _characterID;
  266. };
  267.  
  268. _isDisallowRefuel = _typeOfCursorTarget in ["M240Nest_DZ","MMT_Civ","MMT_USMC","Old_bike_TK_CIV_EP1","Old_bike_TK_INS_EP1"];
  269. _isDog = (_cursorTarget isKindOf "Pastor" || _cursorTarget isKindOf "Fin");
  270. _isModular = _cursorTarget isKindOf "ModularItems";
  271. _isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ"];
  272. _player_deleteBuild = false;
  273. _player_lockUnlock_crtl = false;
  274.  
  275. //fuel tanks
  276. if (_hasEmptyFuelCan) then {
  277. {
  278. if (_cursorTarget isKindOf _x) exitWith {_isFuel = true;};
  279. } count dayz_fuelsources;
  280. };
  281.  
  282. //remove gathered plant if empty
  283. if (_isPlant) then {
  284. _cursorTarget call player_gather;
  285. };
  286.  
  287. //flip vehicle
  288. if (_isVehicle && {!_isMan} && {!(canMove _cursorTarget)} && {_isAlive} && {player distance _cursorTarget >= 2} && {(count (crew _cursorTarget))== 0} && {((vectorUp _cursorTarget) select 2) < 0.5}) then {
  289. if (s_player_flipveh < 0) then {
  290. s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true];
  291. };
  292. } else {
  293. player removeAction s_player_flipveh;
  294. s_player_flipveh = -1;
  295. };
  296.  
  297. //Allow player to fill Fuel can
  298. if (_hasEmptyFuelCan && {_isFuel} && {!a_player_jerryfilling} && {_isAlive}) then {
  299. if (s_player_fillfuel < 0) then {
  300. s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",_cursorTarget, 1, false, true];
  301. };
  302. } else {
  303. player removeAction s_player_fillfuel;
  304. s_player_fillfuel = -1;
  305. };
  306.  
  307. if (damage _cursorTarget < 1) then {
  308. //Allow player to fill vehicle 210L
  309. if (_hasBarrel && {!_isMan} && {_isVehicle} && {fuel _cursorTarget < 1} && {!a_player_jerryfilling} && {!_isDisallowRefuel}) then {
  310. if (s_player_fillfuel210 < 0) then {
  311. s_player_fillfuel210 = player addAction [format[localize "str_actions_medical_10",_text,"210"], "\z\addons\dayz_code\actions\refuel.sqf",["ItemFuelBarrel",_cursorTarget], 0, true, true, "", "'ItemFuelBarrel' in magazines player"];
  312. };
  313. } else {
  314. player removeAction s_player_fillfuel210;
  315. s_player_fillfuel210 = -1;
  316. };
  317.  
  318. //Allow player to fill vehicle 20L
  319. if (_hasFuel20 && {!_isMan} && {_isVehicle} && {fuel _cursorTarget < 1} && {!a_player_jerryfilling} && {!_isDisallowRefuel}) then {
  320. if (s_player_fillfuel20 < 0) then {
  321. s_player_fillfuel20 = player addAction [format[localize "str_actions_medical_10",_text,"20"], "\z\addons\dayz_code\actions\refuel.sqf",["ItemJerrycan",_cursorTarget], 0, true, true, "", "'ItemJerrycan' in magazines player"];
  322. };
  323. } else {
  324. player removeAction s_player_fillfuel20;
  325. s_player_fillfuel20 = -1;
  326. };
  327.  
  328. //Allow player to fill vehicle 5L
  329. if (_hasFuel5 && {!_isMan} && {_isVehicle} && {fuel _cursorTarget < 1} && {!a_player_jerryfilling} && {!_isDisallowRefuel}) then {
  330. if (s_player_fillfuel5 < 0) then {
  331. s_player_fillfuel5 = player addAction [format[localize "str_actions_medical_10",_text,"5"], "\z\addons\dayz_code\actions\refuel.sqf",["ItemFuelcan",_cursorTarget], 0, true, true, "", "'ItemFuelcan' in magazines player"];
  332. };
  333. } else {
  334. player removeAction s_player_fillfuel5;
  335. s_player_fillfuel5 = -1;
  336. };
  337. /*
  338. Vanilla generator is currently not functional.
  339. Vanilla generator refuel actions removed for now.
  340. Epoch generator fill action is below.
  341. */
  342. //Allow player to siphon vehicles
  343. if (_hasEmptyFuelCan && {!_isMan} && {_isVehicle} && {!_isBicycle} && {!a_player_jerryfilling} && {fuel _cursorTarget > 0}) then {
  344. if (s_player_siphonfuel < 0) then {
  345. s_player_siphonfuel = player addAction [format[localize "str_siphon_start"], "\z\addons\dayz_code\actions\siphonFuel.sqf",_cursorTarget, 0, true, true];
  346. };
  347. } else {
  348. player removeAction s_player_siphonfuel;
  349. s_player_siphonfuel = -1;
  350. };
  351. } else {
  352. player removeAction s_player_fillfuel210;
  353. s_player_fillfuel210 = -1;
  354. player removeAction s_player_fillfuel20;
  355. s_player_fillfuel20 = -1;
  356. player removeAction s_player_fillfuel5;
  357. s_player_fillfuel5 = -1;
  358. player removeAction s_player_siphonfuel;
  359. s_player_siphonfuel = -1;
  360. };
  361.  
  362. //Fireplace Actions check
  363. if ((_cursorTarget call isInflamed) or (inflamed _cursorTarget)) then {
  364. _hasRawMeat = {_x in Dayz_meatraw} count _magazinesPlayer > 0;
  365. _hastinitem = {_x in boil_tin_cans} count _magazinesPlayer > 0;
  366.  
  367. //Cook Meat
  368. if (_hasRawMeat && !a_player_cooking) then {
  369. if (s_player_cook < 0) then {
  370. s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true];
  371. };
  372. };
  373. //Boil Water
  374. if (_hastinitem && _hasbottleitem && !a_player_boil) then {
  375. if (s_player_boil < 0) then {
  376. s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true];
  377. };
  378. };
  379. } else {
  380. if (a_player_cooking) then {
  381. player removeAction s_player_cook;
  382. s_player_cook = -1;
  383. };
  384. if (a_player_boil) then {
  385. player removeAction s_player_boil;
  386. s_player_boil = -1;
  387. };
  388. };
  389.  
  390. // Not needed.
  391. /*
  392. if(_cursorTarget == dayz_hasFire) then {
  393. if ((s_player_fireout < 0) && !(_cursorTarget call isInflamed) && (player distance _cursorTarget < 3)) then {
  394. s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true];
  395. };
  396. } else {
  397. player removeAction s_player_fireout;
  398. s_player_fireout = -1;
  399. };
  400. */
  401. if (_isAlive) then {
  402. //Allow player to delete objects
  403. if (_isDestructable || {((_typeOfCursorTarget in DZE_isWreck) or (_typeOfCursorTarget in DZE_isWreckBuilding))} || {(_typeOfCursorTarget in DZE_isRemovable)}) then {
  404. if (_hasToolbox && _hasCrowbar) then {
  405. _player_deleteBuild = true;
  406. };
  407. };
  408.  
  409. if (_isModular || _isModularDoor || _isGenerator || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then {
  410. if (_hasToolbox && _hasCrowbar) then {
  411. _hasAccess = [player, _cursorTarget] call FNC_check_access;
  412. if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3)) then {
  413. _player_deleteBuild = true;
  414. };
  415. };
  416. };
  417.  
  418. if (_isVehicle) then {
  419. if ((_characterID != "0") && {!_isMan}) then {
  420. _player_lockUnlock_crtl = true;
  421. };
  422. };
  423. };
  424.  
  425. if (_player_deleteBuild) then {
  426. if (s_player_deleteBuild < 0) then {
  427. s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, false, true];
  428. };
  429. } else {
  430. player removeAction s_player_deleteBuild;
  431. s_player_deleteBuild = -1;
  432. };
  433.  
  434. //remove Own objects
  435. if (_ownerID == _id) then {
  436. //upgrade items
  437. if (_typeOfCursorTarget in _upgradeItems) then {
  438. if (s_player_upgradestorage < 0) then {
  439. if (isText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "Upgrade" >> "create")) then {
  440. _displayName = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
  441. s_player_upgradestorage = player addAction [format[localize "str_upgrade",_displayName], "\z\addons\dayz_code\actions\object_upgradeStorage.sqf",_cursorTarget, 0, false, true];
  442. };
  443. };
  444. } else {
  445. player removeAction s_player_upgradestorage;
  446. s_player_upgradestorage = -1
  447. };
  448. if (_istypeTent) then {
  449. //Packing my tent
  450. if (s_player_packtent < 0) then {
  451. s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true];
  452. };
  453. } else {
  454. player removeAction s_player_packtent;
  455. s_player_packtent = -1;
  456. };
  457. } else {
  458. player removeAction s_player_upgradestorage;
  459. s_player_upgradestorage = -1;
  460. player removeAction s_player_packtent;
  461. s_player_packtent = -1;
  462. };
  463. //other tents
  464. if (_istypeTent) then {
  465. //destroy tents
  466. //Located in variables Dayz_Ignators = ["ItemMatchbox","Item5Matchbox","Item4Matchbox","Item3Matchbox","Item2Matchbox","Item1Matchbox"];
  467. _hasIgnators = {_x in Dayz_Ignators} count _itemsPlayer > 0;
  468. if ((_hasFuel20 or _hasFuel5 or _hasBarrel) && _hasIgnators) then {
  469. if (s_player_destorytent < 0) then {
  470. s_player_destorytent = player addAction [localize "str_actions_self_destorytent", "\z\addons\dayz_code\actions\player_destroyTent.sqf",_cursorTarget, 0, false, true];
  471. };
  472. } else {
  473. player removeAction s_player_destorytent;
  474. s_player_destorytent = -1;
  475. };
  476. if (_typeOfCursorTarget in ["IC_DomeTent","IC_Tent"]) then {
  477. if (s_player_packtentinfected < 0) then {
  478. s_player_packtentinfected = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true];
  479. };
  480. } else {
  481. player removeAction s_player_packtentinfected;
  482. s_player_packtentinfected = -1;
  483. };
  484. //sleep
  485. if (s_player_sleep < 0) then {
  486. s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true];
  487. };
  488. } else {
  489. player removeAction s_player_sleep;
  490. s_player_sleep = -1;
  491. };
  492. /*
  493. //Carbomb
  494. _hasCarBomb = "ItemCarBomb" in _magazinesPlayer;
  495. if (((_cursorTarget isKindOf "Car") || (_cursorTarget isKindOf "Air") || (_cursorTarget isKindOf "Motorcycle")) && _hasCarBomb) then {
  496. if (s_player_attach_bomb < 0) then {
  497. s_player_attach_bomb = player addAction [localize "str_bombAttach", "\z\addons\dayz_code\actions\player_attach_bomb.sqf",_cursorTarget, 3, true, true];
  498. };
  499. } else {
  500. player removeAction s_player_attach_bomb;
  501. s_player_attach_bomb = -1;
  502. };
  503. */
  504. //Repairing Vehicles
  505. if (_isVehicle && {!_isMan} && {dayz_myCursorTarget != _cursorTarget} && {_hasToolbox} && {damage _cursorTarget < 1} && {_typeOfCursorTarget != "M240Nest_DZ"}) then {
  506. if (s_player_repair_crtl < 0) then {
  507. dayz_myCursorTarget = _cursorTarget;
  508. _menu = dayz_myCursorTarget addAction [localize "str_actions_repairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false];
  509. if (!_isBicycle) then { //Bike wheels should not give full size tires. Also model does not update to show removed wheels.
  510. if (!DZE_salvageLocked) then {
  511. if (!locked _cursorTarget) then {
  512. _menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false];
  513. s_player_repairActions set [count s_player_repairActions,_menu1];
  514. };
  515. } else {
  516. _menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false];
  517. s_player_repairActions set [count s_player_repairActions,_menu1];
  518. };
  519. };
  520. s_player_repairActions set [count s_player_repairActions,_menu];
  521. s_player_repair_crtl = 1;
  522. } else {
  523. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;
  524. s_player_repairActions = [];
  525. s_player_repair_crtl = -1;
  526. };
  527. };
  528. /* //Vanilla base building currently not used in Epoch
  529. // House locking and unlocking
  530. _isHouse = _typeOfCursorTarget in ["SurvivorWorkshopAStage5", "SurvivorWorkshopBStage5", "SurvivorWorkshopCStage5"];
  531. _isGate = _typeOfCursorTarget in ["WoodenGate_1","WoodenGate_2","WoodenGate_3","WoodenGate_4","MetalGate_1","MetalGate_2","MetalGate_3","MetalGate_4"];
  532. _isFence = _typeOfCursorTarget in ["WoodenFence_1","WoodenFence_2","WoodenFence_3","WoodenFence_4","WoodenFence_5","WoodenFence_6","MetalFence_1","MetalFence_2","MetalFence_3","MetalFence_4","MetalFence_5","MetalFence_6","MetalFence_7"];
  533.  
  534. //Only the owners can lock the gates
  535. _isLockableGate = _typeOfCursorTarget in ["WoodenGate_2","WoodenGate_3","WoodenGate_4","MetalGate_2","MetalGate_3","MetalGate_4"];
  536. _isUnlocked = _cursorTarget getVariable ["isOpen","0"] == "1";
  537.  
  538. //Allow the gates to be opened when not locked by anyone
  539. _isOpen = ((_cursorTarget animationPhase "DoorL") == 1) || ((_cursorTarget animationPhase "DoorR") == 1);
  540. _isClosed = ((_cursorTarget animationPhase "DoorL") == 0) || ((_cursorTarget animationPhase "DoorR") == 0);
  541.  
  542. //[["ownerArray",["PID"]]]
  543. _ownerArray = _cursorTarget getVariable ["ownerArray",["0"]];
  544. _ownerBuildLock = _cursorTarget getVariable ["BuildLock",false];
  545. _ownerPID = (_ownerArray select 0);
  546.  
  547. // open Gate
  548. if (_isGate && _isClosed && _isUnlocked) then {
  549. if (s_player_openGate < 0) then {
  550. s_player_openGate = player addAction [localize "STR_DN_OUT_O_GATE", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"Open"], 1, true, true];
  551. };
  552. } else {
  553. player removeAction s_player_openGate;
  554. s_player_openGate = -1;
  555. };
  556. // Close Gate
  557. if (_isGate && _isOpen && _isUnlocked) then {
  558. if (s_player_CloseGate < 0) then {
  559. s_player_CloseGate = player addAction [localize "STR_DN_OUT_C_GATE", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"Close"], 1, true, true];
  560. };
  561. } else {
  562. player removeAction s_player_CloseGate;
  563. s_player_CloseGate = -1;
  564. };
  565. // Set
  566. if ((_isHouse or _isLockableGate) && (_ownerPID == _uid) && !_isUnlocked && _isClosed) then {
  567. if (s_player_setCode < 0) then {
  568. s_player_setCode = player addAction [localize "STR_BLD_ACTIONS_SETLOCKCODE", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"Set"], 1, true, true];
  569. };
  570. } else {
  571. player removeAction s_player_setCode;
  572. s_player_setCode = -1;
  573. };
  574. //Lock Build point
  575. if ((_isFence or _isGate) && (_ownerPID == _uid) && !_ownerBuildLock) then {
  576. if (s_player_BuildLock < 0) then {
  577. s_player_BuildLock = player addAction [localize "STR_BLD_ACTIONS_LOCKBUILD", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"BuildLock"], 1, true, true];
  578. };
  579. } else {
  580. player removeAction s_player_BuildLock;
  581. s_player_BuildLock = -1;
  582. };
  583. //UnLock Build point
  584. if ((_isFence or _isGate) && (_ownerPID == _uid) && _ownerBuildLock) then {
  585. if (s_player_BuildUnLock < 0) then {
  586. s_player_BuildUnLock = player addAction [localize "STR_BLD_ACTIONS_UNLOCKBUILD", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"BuildUnLock"], 1, true, true];
  587. };
  588. } else {
  589. player removeAction s_player_BuildUnLock;
  590. s_player_BuildUnLock = -1;
  591. };
  592. // Unlock Gate/House
  593. if ((_isHouse or _isLockableGate) && !_isUnlocked && _isClosed) then {
  594. if (s_player_unlockhouse < 0) then {
  595. s_player_unlockhouse = player addAction [localize "STR_BLD_ACTIONS_UNLOCKGATE", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"Unlock"], 1, true, true];
  596. };
  597. } else {
  598. player removeAction s_player_unlockhouse;
  599. s_player_unlockhouse = -1;
  600. };
  601. // Lock Gate/House
  602. if ((_isHouse or _isLockableGate) && _isUnlocked && _isClosed) then {
  603. if (s_player_lockhouse < 0) then {
  604. s_player_lockhouse = player addAction [localize "STR_BLD_ACTIONS_LOCKGATE", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"Lock"], 1, true, true];
  605. };
  606. } else {
  607. player removeAction s_player_lockhouse;
  608. s_player_lockhouse = -1;
  609. };
  610. //Break In
  611. if ((_isHouse or _isLockableGate) && (_ownerPID != _uid) && !_isUnlocked) then {
  612. if (s_player_breakinhouse < 0) then {
  613. s_player_breakinhouse = player addAction [localize "STR_BLD_ACTIONS_BREAKIN", "\z\addons\dayz_code\actions\player_breakin.sqf",_cursorTarget, 1, true, true];
  614. };
  615. } else {
  616. player removeAction s_player_breakinhouse;
  617. s_player_breakinhouse = -1;
  618. };*/
  619.  
  620. // garage
  621. if (_typeOfCursorTarget in DZE_Garage && {speed player <= 1}) then {
  622. _hasAccess = [player, _cursorTarget] call FNC_check_access;
  623. _allowed = ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4));
  624. if ((s_player_garage < 0) && (_allowed or (_hasAccess select 1))) then {
  625. s_player_garage = player addAction ["<t color='#FFAA00'>Garage Menu</t>", "custom\Garage\player_virtualgarage.sqf", _cursorTarget, 2, false];
  626. } else {
  627. s_player_garage = player addAction ["<t color='#FF0000'>Garage Locked</t>", "",_cursorTarget, 2, true, true, "", ""];
  628. };
  629. } else {
  630. player removeAction s_player_garage;
  631. s_player_garage = -1;
  632. };
  633.  
  634.  
  635. if ((_cursorTarget isKindOf "Plastic_Pole_EP1_DZ") && {speed player <= 1}) then {
  636. _hasAccess = [player, _cursorTarget] call FNC_check_access;
  637. _allowed = ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4));
  638. if (DZE_permanentPlot) then {
  639. if (s_player_plotManagement < 0 && _allowed) then {
  640. s_player_plotManagement = player addAction [format["<t color='#0059FF'>%1</t>",localize "STR_EPOCH_ACTIONS_MANAGEPLOT"], "\z\addons\dayz_code\actions\plotManagement\initPlotManagement.sqf", [], 5, false];
  641. };
  642. } else {
  643. if (s_player_maintain_area < 0) then {
  644. s_player_maintain_area = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "\z\addons\dayz_code\actions\maintain_area.sqf", "maintain", 5, false];
  645. s_player_maintain_area_force = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_FORCE_MAINTAREA"], "\z\addons\dayz_code\actions\maintain_area.sqf", "force", 5, false];
  646. s_player_maintain_area_preview = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "\z\addons\dayz_code\actions\maintain_area.sqf", "preview", 5, false];
  647. };
  648. };
  649. if (s_player_plot_boundary < 0 && (_allowed or (_hasAccess select 1))) then {
  650. s_player_plot_boundary = player addAction [localize "STR_EPOCH_PLOTMANAGEMENT_SHOW_BOUNDARY", "\z\addons\dayz_code\actions\plotManagement\plotToggleMarkers.sqf", "", 1, false];
  651. };
  652. if (DZE_permanentPlot && DZE_PlotOwnership) then {
  653. if (s_player_plot_take_ownership < 0 && (_hasAccess select 0)) then {
  654. s_player_plot_take_ownership = player addAction [localize "STR_EPOCH_APLOTFORLIFE_TAKE_PLOT_OWNERSHIP", "\z\addons\dayz_code\actions\plot_take_ownership.sqf", "", 1, false];
  655. };
  656. };
  657. } else {
  658. player removeAction s_player_plotManagement;
  659. s_player_plotManagement = -1;
  660. player removeAction s_player_maintain_area;
  661. s_player_maintain_area = -1;
  662. player removeAction s_player_maintain_area_force;
  663. s_player_maintain_area_force = -1;
  664. player removeAction s_player_maintain_area_preview;
  665. s_player_maintain_area_preview = -1;
  666. player removeAction s_player_plot_boundary;
  667. s_player_plot_boundary = -1;
  668. player removeAction s_player_plot_take_ownership;
  669. s_player_plot_take_ownership = -1;
  670. };
  671.  
  672. if (DZE_HeliLift) then {
  673. _liftHeli = objNull;
  674. _found = false;
  675. _allowTow = false;
  676. if ((count (crew _cursorTarget)) == 0) then {
  677. {
  678. if (!_allowTow) then {
  679. _allowTow = _cursorTarget isKindOf _x;
  680. };
  681. } count DZE_HeliAllowToTow;
  682. };
  683.  
  684. if (_allowTow) then {
  685. {
  686. if (!_found) then {
  687. _posL = [_x] call FNC_getPos;
  688. _posC = [_cursorTarget] call FNC_getPos;
  689. _height = (_posL select 2) - (_posC select 2);
  690. _hasAttached = _x getVariable["hasAttached",false];
  691. if ((_height < 15) && {_height > 5} && {typeName _hasAttached != "OBJECT"}) then {
  692. if (((abs((_posL select 0) - (_posC select 0))) < 10) && {(abs((_posL select 1) - (_posC select 1))) < 10}) then {
  693. _liftHeli = _x;
  694. _found = true;
  695. };
  696. };
  697. };
  698. } count (player nearEntities [DZE_HeliAllowTowFrom,15]);
  699. };
  700.  
  701. _attached = _cursorTarget getVariable["attached",false];
  702. if (_found && {_allowTow} && {!locked _cursorTarget} && {!_isPZombie} && {typeName _attached != "OBJECT"}) then {
  703. if (s_player_heli_lift < 0) then {
  704. s_player_heli_lift = player addAction [localize "STR_EPOCH_ACTIONS_ATTACHTOHELI", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true];
  705. };
  706. } else {
  707. player removeAction s_player_heli_lift;
  708. s_player_heli_lift = -1;
  709. };
  710. };
  711.  
  712. // Allow Owner to lock and unlock vehicle
  713. if (_player_lockUnlock_crtl) then {
  714. if (s_player_lockUnlock_crtl < 0) then {
  715. _totalKeys = call epoch_tempKeys;
  716. _temp_keys = _totalKeys select 0;
  717. _temp_keys_names = _totalKeys select 1;
  718. _hasKey = _characterID in _temp_keys;
  719. _oldOwner = (_characterID == _uid);
  720. if (locked _cursorTarget) then {
  721. if (_hasKey || _oldOwner) then {
  722. _unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _characterID))], 2, true, true];
  723. s_player_lockunlock set [count s_player_lockunlock,_unlock];
  724. s_player_lockUnlock_crtl = 1;
  725. } else {
  726. if (_hasHotwireKit) then {
  727. _unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",_cursorTarget, 2, true, true];
  728. } else {
  729. _unlock = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_VEHLOCKED"], "",_cursorTarget, 2, false, true];
  730. };
  731. s_player_lockunlock set [count s_player_lockunlock,_unlock];
  732. s_player_lockUnlock_crtl = 1;
  733. };
  734. } else {
  735. if (_hasKey || _oldOwner) then {
  736. _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true];
  737. s_player_lockunlock set [count s_player_lockunlock,_lock];
  738. s_player_lockUnlock_crtl = 1;
  739. };
  740. };
  741. };
  742. } else {
  743. {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
  744. s_player_lockUnlock_crtl = -1;
  745. };
  746.  
  747. // gear access on surrendered player
  748. if (isPlayer _cursorTarget && {_isAlive} && {_cursorTarget getVariable ["DZE_Surrendered",false]}) then {
  749. if (s_player_SurrenderedGear < 0) then {
  750. s_player_SurrenderedGear = player addAction [localize "STR_UI_GEAR", "\z\addons\dayz_code\actions\surrender_gear.sqf",_cursorTarget, 1, true, true];
  751. };
  752. } else {
  753. player removeAction s_player_SurrenderedGear;
  754. s_player_SurrenderedGear = -1;
  755. };
  756.  
  757. // Allow manage door
  758. if (DZE_doorManagement && (_typeOfCursorTarget in DZE_DoorsLocked)) then {
  759. // Check player access
  760. _hasAccess = [player, _cursorTarget] call FNC_check_access;
  761. if (s_player_manageDoor < 0 && ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4) or (_hasAccess select 5) or (_hasAccess select 6))) then {
  762. s_player_manageDoor = player addAction [format["<t color='#0059FF'>%1</t>", localize "STR_EPOCH_ACTIONS_MANAGEDOOR"], "\z\addons\dayz_code\actions\doorManagement\initDoorManagement.sqf", _cursorTarget, 5, false];
  763. };
  764. } else {
  765. player removeAction s_player_manageDoor;
  766. s_player_manageDoor = -1;
  767. };
  768.  
  769. //Allow owner to unlock vault
  770. if ((_typeOfCursorTarget in DZE_LockableStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3} && {!keypadCancel}) then {
  771. if (s_player_unlockvault < 0) then {
  772. if (_typeOfCursorTarget in DZE_LockedStorage) then {
  773. if (_characterID == dayz_combination || _ownerID == _uid) then {
  774. _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true];
  775. s_player_combi set [count s_player_combi,_combi];
  776. } else {
  777. _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true];
  778. s_player_combi set [count s_player_combi,_combi];
  779. };
  780. s_player_unlockvault = 1;
  781. } else {
  782. if (_characterID != dayz_combination && _ownerID != _uid) then {
  783. _combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true];
  784. s_player_combi set [count s_player_combi,_combi];
  785. s_player_unlockvault = 1;
  786. };
  787. };
  788. };
  789. } else {
  790. {player removeAction _x} count s_player_combi;s_player_combi = [];
  791. s_player_unlockvault = -1;
  792. };
  793.  
  794. //Allow owner to pack vault
  795. if ((_typeOfCursorTarget in DZE_UnLockedStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3} && {!keypadCancel}) then {
  796. if (s_player_lockvault < 0) then {
  797. if (_characterID == dayz_combination || _ownerID == _uid) then {
  798. s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true];
  799. };
  800. };
  801. if (s_player_packvault < 0 && (_characterID == dayz_combination || _ownerID == _uid)) then {
  802. s_player_packvault = player addAction [format["<t color='#ff0000'>%1</t>",(format[localize "STR_EPOCH_ACTIONS_PACK",_text])], "\z\addons\dayz_code\actions\vault_pack.sqf",_cursorTarget, 0, false, true];
  803. };
  804. } else {
  805. player removeAction s_player_packvault;
  806. s_player_packvault = -1;
  807. player removeAction s_player_lockvault;
  808. s_player_lockvault = -1;
  809. };
  810.  
  811. //Player Deaths
  812. if (_typeOfCursorTarget == "Info_Board_EP1") then {
  813. if (s_player_information < 0) then {
  814. s_player_information = player addAction [localize "STR_EPOCH_ACTIONS_MURDERS", "\z\addons\dayz_code\actions\list_playerDeaths.sqf",[], 7, false, true];
  815. };
  816. } else {
  817. player removeAction s_player_information;
  818. s_player_information = -1;
  819. };
  820.  
  821. //Fuel Pump
  822. if (_typeOfCursorTarget in dayz_fuelpumparray) then {
  823. if (s_player_fuelauto < 0) then {
  824. // check if Generator_DZ is running within 30 meters
  825. _findNearestGen = [];
  826. {
  827. if ((alive _x) && (_x getVariable ["GeneratorRunning", false])) then {
  828. _findNearestGen set [count _findNearestGen,_x];
  829. };
  830. } count (nearestObjects [([player] call FNC_getPos), ["Generator_DZ"], 30]);
  831.  
  832. // show that pump needs power if no generator nearby.
  833. if ((count _findNearestGen) > 0) then {
  834. s_player_fuelauto = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true];
  835. } else {
  836. s_player_fuelauto = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true];
  837. };
  838. };
  839. } else {
  840. player removeAction s_player_fuelauto;
  841. s_player_fuelauto = -1;
  842. };
  843.  
  844. //Fuel Pump on truck
  845. if (_typeOfCursorTarget in DZE_fueltruckarray && _isAlive) then {
  846. if (s_player_fuelauto2 < 0) then {
  847. // show that fuel truck pump needs power.
  848. if (isEngineOn _cursorTarget) then {
  849. s_player_fuelauto2 = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",_cursorTarget, 0, false, true];
  850. } else {
  851. s_player_fuelauto2 = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true];
  852. };
  853. };
  854. } else {
  855. player removeAction s_player_fuelauto2;
  856. s_player_fuelauto2 = -1;
  857. };
  858.  
  859. // inplace upgrade tool
  860. if ((_cursorTarget isKindOf "ModularItems") || (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") || (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {
  861. if ((s_player_lastTarget select 0) != _cursorTarget) then {
  862. if (s_player_upgrade_build > 0) then {
  863. player removeAction s_player_upgrade_build;
  864. s_player_upgrade_build = -1;
  865. };
  866. };
  867. if (s_player_upgrade_build < 0) then {
  868. _hasAccess = [player, _cursorTarget] call FNC_check_access;
  869. _upgrade = getArray (configFile >> "CfgVehicles" >> (typeOf _cursorTarget) >> "upgradeBuilding");
  870. if (((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3)) && (count _upgrade) > 0) then {
  871. s_player_lastTarget set [0,_cursorTarget];
  872. s_player_upgrade_build = player addAction [format[localize "str_upgrade",_text], "\z\addons\dayz_code\actions\player_upgrade.sqf",_cursorTarget, -1, false, true];
  873. };
  874. };
  875. } else {
  876. player removeAction s_player_upgrade_build;
  877. s_player_upgrade_build = -1;
  878. };
  879.  
  880. // downgrade system
  881. if ((DZE_Lock_Door == _characterID) && {!keypadCancel} && {_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base"}) then {
  882. if ((s_player_lastTarget select 1) != _cursorTarget) then {
  883. if (s_player_downgrade_build > 0) then {
  884. player removeAction s_player_downgrade_build;
  885. s_player_downgrade_build = -1;
  886. };
  887. };
  888. if (s_player_downgrade_build < 0) then {
  889. _hasAccess = [player, _cursorTarget] call FNC_check_access;
  890. if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3)) then {
  891. s_player_lastTarget set [1,_cursorTarget];
  892. s_player_downgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_REMLOCK",_text], "\z\addons\dayz_code\actions\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true];
  893. };
  894. };
  895. } else {
  896. player removeAction s_player_downgrade_build;
  897. s_player_downgrade_build = -1;
  898. };
  899.  
  900. // inplace maintenance tool
  901. if ((damage _cursorTarget >= DZE_DamageBeforeMaint) && {_cursorTarget isKindOf "ModularItems" || _cursorTarget isKindOf "DZE_Housebase" || _typeOfCursorTarget == "LightPole_DZ"}) then {
  902. if ((s_player_lastTarget select 2) != _cursorTarget) then {
  903. if (s_player_maint_build > 0) then {
  904. player removeAction s_player_maint_build;
  905. s_player_maint_build = -1;
  906. };
  907. };
  908. if (s_player_maint_build < 0) then {
  909. _hasAccess = [player, _cursorTarget] call FNC_check_access;
  910. if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3)) then {
  911. _text2 = _text + " (" + str(round ((damage _cursorTarget) * 100)) + "% damaged)";
  912. s_player_lastTarget set [2,_cursorTarget];
  913. s_player_maint_build = player addAction [format["%1 %2",localize "STR_EPOCH_ACTIONS_MAINTAIN",_text2], "\z\addons\dayz_code\actions\player_buildingMaint.sqf",_cursorTarget, -2, false, true];
  914. };
  915. };
  916. } else {
  917. player removeAction s_player_maint_build;
  918. s_player_maint_build = -1;
  919. };
  920.  
  921. //Start Generator
  922. if (_isGenerator) then {
  923. if (s_player_fillgen < 0) then {
  924. // check if not running
  925. if (_cursorTarget getVariable ["GeneratorRunning", false]) then {
  926. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR1", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true];
  927. } else {
  928. // check if not filled and player has jerry.
  929. if (_cursorTarget getVariable ["GeneratorFilled", false]) then {
  930. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR2", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true];
  931. } else {
  932. if (_hasFuel20 or _hasFuel5 or _hasBarrel) then {
  933. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR3", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true];
  934. };
  935. };
  936. };
  937. };
  938. } else {
  939. player removeAction s_player_fillgen;
  940. s_player_fillgen = -1;
  941. };
  942.  
  943. //Towing with tow truck
  944. /*
  945. if(_typeOfCursorTarget == "TOW_DZE") then {
  946. if (s_player_towing < 0) then {
  947. if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
  948. s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true];
  949. } else {
  950. s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true];
  951. };
  952. };
  953. } else {
  954. player removeAction s_player_towing;
  955. s_player_towing = -1;
  956. };
  957. */
  958.  
  959. // All Traders
  960. if (_isMan && {!(isPlayer _cursorTarget)} && {_typeOfCursorTarget in serverTraders} && {!_isPZombie}) then {
  961. if (s_player_parts_crtl < 0) then {
  962. _humanity = player getVariable ["humanity",0];
  963. _traderMenu = call compile format["menu_%1;",_typeOfCursorTarget];
  964. _low_high = localize "STR_EPOCH_ACTIONS_HUMANITY_LOW";
  965. _humanity_logic = false;
  966. if ((_traderMenu select 2) == "friendly") then {
  967. _humanity_logic = (_humanity < -5000);
  968. };
  969. if ((_traderMenu select 2) == "hostile") then {
  970. _low_high = localize "STR_EPOCH_ACTIONS_HUMANITY_HIGH";
  971. _humanity_logic = (_humanity > -5000);
  972. };
  973. if ((_traderMenu select 2) == "hero") then {
  974. _humanity_logic = (_humanity < 5000);
  975. };
  976. if (_humanity_logic) then {
  977. _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false];
  978. s_player_parts set [count s_player_parts,_cancel];
  979. } else {
  980. // Static Menu
  981. {
  982. _buy = player addAction [format["Trade %1 %2 for %3 %4",(_x select 3),(_x select 5),(_x select 2),(_x select 6)], "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4),(_x select 5),(_x select 6)], (_x select 7), true, true];
  983. s_player_parts set [count s_player_parts,_buy];
  984. } count (_traderMenu select 1);
  985. if (DZE_ConfigTrader) then {
  986. _buyV = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\AdvancedTrading\init.sqf",(_traderMenu select 0), 999, true, false];
  987. s_player_parts set [count s_player_parts,_buyV];
  988. } else {
  989. // Database menu
  990. _buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 999, true, false];
  991. s_player_parts set [count s_player_parts,_buy];
  992. };
  993. };
  994. s_player_parts_crtl = 1;
  995. };
  996. } else {
  997. {player removeAction _x} count s_player_parts;s_player_parts = [];
  998. s_player_parts_crtl = -1;
  999. };
  1000.  
  1001. if (dayz_tameDogs) then {
  1002. //Dog
  1003. _hasRawMeat = {_x in Dayz_meatraw} count _magazinesPlayer > 0;
  1004. if (_isDog && {_hasRawMeat} && {_isAlive} && {_ownerID == "0"} && {player getVariable ["dogID",0] == 0}) then {
  1005. if (s_player_tamedog < 0) then {
  1006. s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\dog\tame_dog.sqf", _cursorTarget, 1, false, true];
  1007. };
  1008. } else {
  1009. player removeAction s_player_tamedog;
  1010. s_player_tamedog = -1;
  1011. };
  1012. if (_isDog && {_ownerID == _id} && {_isAlive}) then {
  1013. if (s_player_feeddog < 0 && _hasRawMeat) then {
  1014. s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true];
  1015. };
  1016. if (s_player_waterdog < 0 && _hasbottleitem) then {
  1017. s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true];
  1018. };
  1019. if (s_player_staydog < 0) then {
  1020. if (_dogHandle getFSMVariable "_actionLieDown") then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
  1021. s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true];
  1022. };
  1023. if (s_player_trackdog < 0) then {
  1024. s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true];
  1025. };
  1026. if (s_player_barkdog < 0) then {
  1027. s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", _cursorTarget, 3, false, true];
  1028. };
  1029. if (s_player_warndog < 0) then {
  1030. _warn = _dogHandle getFSMVariable "_watchDog";
  1031. if (_warn) then { _text = localize "str_epoch_player_247"; _warn = false; } else { _text = localize "str_epoch_player_248"; _warn = true; };
  1032. s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true];
  1033. };
  1034. if (s_player_followdog < 0) then {
  1035. s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true];
  1036. };
  1037. } else {
  1038. player removeAction s_player_feeddog;
  1039. s_player_feeddog = -1;
  1040. player removeAction s_player_waterdog;
  1041. s_player_waterdog = -1;
  1042. player removeAction s_player_staydog;
  1043. s_player_staydog = -1;
  1044. player removeAction s_player_trackdog;
  1045. s_player_trackdog = -1;
  1046. player removeAction s_player_barkdog;
  1047. s_player_barkdog = -1;
  1048. player removeAction s_player_warndog;
  1049. s_player_warndog = -1;
  1050. player removeAction s_player_followdog;
  1051. s_player_followdog = -1;
  1052. };
  1053. };
  1054. } else {
  1055. //Engineering
  1056. player removeAction s_player_plot_boundary;
  1057. s_player_plot_boundary = -1;
  1058. player removeAction s_player_plot_take_ownership;
  1059. s_player_plot_take_ownership = -1;
  1060. player removeAction s_player_plotManagement;
  1061. s_player_plotManagement = -1;
  1062. {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
  1063. player removeAction s_player_repair_crtl;
  1064. s_player_repair_crtl = -1;
  1065. dayz_myCursorTarget = objNull;
  1066. player removeAction s_player_flipveh;
  1067. s_player_flipveh = -1;
  1068. player removeAction s_player_sleep;
  1069. s_player_sleep = -1;
  1070. player removeAction s_player_deleteBuild;
  1071. s_player_deleteBuild = -1;
  1072. player removeAction s_player_cook;
  1073. s_player_cook = -1;
  1074. player removeAction s_player_boil;
  1075. s_player_boil = -1;
  1076. player removeAction s_player_fireout;
  1077. s_player_fireout = -1;
  1078. player removeAction s_player_packtent;
  1079. s_player_packtent = -1;
  1080. player removeAction s_player_packtentinfected;
  1081. s_player_packtentinfected = -1;
  1082. player removeAction s_player_fillfuel;
  1083. s_player_fillfuel = -1;
  1084. //fuel
  1085. player removeAction s_player_fillfuel210;
  1086. s_player_fillfuel210 = -1;
  1087. player removeAction s_player_fillfuel20;
  1088. s_player_fillfuel20 = -1;
  1089. player removeAction s_player_fillfuel5;
  1090. s_player_fillfuel5 = -1;
  1091. //Allow player to siphon vehicle fuel
  1092. player removeAction s_player_siphonfuel;
  1093. s_player_siphonfuel = -1;
  1094. //Allow player to gather
  1095. player removeAction s_player_gather;
  1096. s_player_gather = -1;
  1097. player removeAction s_player_destorytent;
  1098. s_player_destorytent = -1;
  1099. // player removeAction s_player_attach_bomb;
  1100. // s_player_attach_bomb = -1;
  1101. //debug
  1102. //player removeAction s_player_debugCheck;
  1103. //s_player_debugCheck = -1;
  1104. player removeAction s_player_upgradestorage;
  1105. s_player_upgradestorage = -1;
  1106. /* //Unlock,Lock // Vanilla base building currently not used in Epoch
  1107. player removeAction s_player_setCode;
  1108. s_player_setCode = -1;
  1109. player removeAction s_player_lockhouse;
  1110. s_player_lockhouse = -1;
  1111. player removeAction s_player_unlockhouse;
  1112. s_player_unlockhouse = -1;
  1113. player removeAction s_player_openGate;
  1114. s_player_openGate = -1;
  1115. player removeAction s_player_CloseGate;
  1116. s_player_CloseGate = -1;
  1117. player removeAction s_player_breakinhouse;
  1118. s_player_breakinhouse = -1;
  1119. player removeAction s_player_BuildUnLock;
  1120. s_player_BuildUnLock = -1;
  1121. player removeAction s_player_BuildLock;
  1122. s_player_BuildLock = -1;*/
  1123. {player removeAction _x} count s_player_combi;s_player_combi = [];
  1124. s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];
  1125. {player removeAction _x} count s_player_parts;s_player_parts = [];
  1126. s_player_parts_crtl = -1;
  1127. {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
  1128. s_player_lockUnlock_crtl = -1;
  1129. player removeAction s_player_SurrenderedGear;
  1130. s_player_SurrenderedGear = -1;
  1131. player removeAction s_player_maintain_area;
  1132. s_player_maintain_area = -1;
  1133. player removeAction s_player_maintain_area_force;
  1134. s_player_maintain_area_force = -1;
  1135. player removeAction s_player_maintain_area_preview;
  1136. s_player_maintain_area_preview = -1;
  1137. player removeAction s_player_tamedog;
  1138. s_player_tamedog = -1;
  1139. player removeAction s_player_feeddog;
  1140. s_player_feeddog = -1;
  1141. player removeAction s_player_waterdog;
  1142. s_player_waterdog = -1;
  1143. player removeAction s_player_staydog;
  1144. s_player_staydog = -1;
  1145. player removeAction s_player_trackdog;
  1146. s_player_trackdog = -1;
  1147. player removeAction s_player_barkdog;
  1148. s_player_barkdog = -1;
  1149. player removeAction s_player_warndog;
  1150. s_player_warndog = -1;
  1151. player removeAction s_player_followdog;
  1152. s_player_followdog = -1;
  1153. player removeAction s_player_unlockvault;
  1154. s_player_unlockvault = -1;
  1155. player removeAction s_player_packvault;
  1156. s_player_packvault = -1;
  1157. player removeAction s_player_lockvault;
  1158. s_player_lockvault = -1;
  1159. player removeAction s_player_information;
  1160. s_player_information = -1;
  1161. player removeAction s_player_fillgen;
  1162. s_player_fillgen = -1;
  1163. player removeAction s_player_upgrade_build;
  1164. s_player_upgrade_build = -1;
  1165. player removeAction s_player_maint_build;
  1166. s_player_maint_build = -1;
  1167. player removeAction s_player_downgrade_build;
  1168. s_player_downgrade_build = -1;
  1169. player removeAction s_player_towing;
  1170. s_player_towing = -1;
  1171. player removeAction s_player_fuelauto;
  1172. s_player_fuelauto = -1;
  1173. player removeAction s_player_fuelauto2;
  1174. s_player_fuelauto2 = -1;
  1175. player removeAction s_player_manageDoor;
  1176. s_player_manageDoor = -1;
  1177. player removeAction s_player_garage;
  1178. s_player_garage = -1;
  1179. };
  1180.  
  1181. //Dog actions on player self
  1182. if (_dogHandle > 0) then {
  1183. _dog = _dogHandle getFSMVariable "_dog";
  1184. if (isNil "_dog") exitWith {};
  1185. if (isNil "_ownerID") then {_ownerID = "0"};
  1186. if (_canDo && !_inVehicle && alive _dog && !(_ownerID in [dayz_characterID,_uid])) then {
  1187. if (s_player_movedog < 0) then {
  1188. s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID",0], 1, false, true];
  1189. };
  1190. if (s_player_speeddog < 0) then {
  1191. _text = localize "str_epoch_player_249";
  1192. _speed = 0;
  1193. if (_dog getVariable ["currentSpeed",1] == 0) then { _speed = 1; _text = localize "str_epoch_player_250"; };
  1194. s_player_speeddog = player addAction [format[localize "str_actions_speeddog", _text], "\z\addons\dayz_code\actions\dog\speed.sqf",[player getVariable ["dogID",0],_speed], 0, false, true];
  1195. };
  1196. if (s_player_calldog < 0) then {
  1197. s_player_calldog = player addAction [localize "str_actions_calldog", "\z\addons\dayz_code\actions\dog\follow.sqf", [player getVariable ["dogID",0], true], 2, false, true];
  1198. };
  1199. };
  1200. } else {
  1201. player removeAction s_player_movedog;
  1202. s_player_movedog = -1;
  1203. player removeAction s_player_speeddog;
  1204. s_player_speeddog = -1;
  1205. player removeAction s_player_calldog;
  1206. s_player_calldog = -1;
  1207. };
  1208.  
  1209. //Monitor
  1210. player setVariable ["selfActions", diag_ticktime, false];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement