Advertisement
Guest User

Untitled

a guest
Dec 8th, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.60 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. private ["_isWreckBuilding","_temp_keys","_magazinesPlayer","_isPZombie","_vehicle","_inVehicle","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_Unlock","_lock","_buy","_dogHandle","_lieDown","_warn","_hastinitem","_allowedDistance","_menu","_menu1","_humanity_logic","_low_high","_cancel","_metals_trader","_traderMenu","_isWreck","_isRemovable","_isDisallowRepair","_rawmeat","_humanity","_speed","_dog","_hasbottleitem","_isAir","_isShip","_playersNear","_findNearestGens","_findNearestGen","_IsNearRunningGen","_cursorTarget","_isnewstorage","_itemsPlayer","_ownerKeyId","_typeOfCursorTarget","_hasKey","_oldOwner","_combi","_key_colors","_player_deleteBuild","_player_flipveh","_player_lockUnlock_crtl","_player_butcher","_player_studybody","_player_cook","_player_boil","_hasFuelBarrelE","_hasHotwireKit","_player_SurrenderedGear","_isSurrendered","_isModular","_ownerKeyName","_temp_keys_names"];
  8.  
  9. if (DZE_ActionInProgress) exitWith {}; // Do not allow if any script is running.
  10.  
  11. _vehicle = vehicle player;
  12. _isPZombie = player isKindOf "PZombie_VB";
  13. _inVehicle = (_vehicle != player);
  14.  
  15. _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  16. _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
  17.  
  18. // ---------------------------------------Maintain Area Start------------------------------------
  19. if (_canDo && (speed player <= 1) && (cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {
  20. if (s_player_maintain_area < 0) then {
  21. s_player_maintain_area = player addAction ["<t color=""#4059FF"">Maintain Area</t>", "fixes\maintain_area.sqf", "maintain", 5, false];
  22. s_player_maintain_area_preview = player addAction ["<t color=""#4059FF"">Maintain Area Summary</t>", "fixes\maintain_area.sqf", "preview", 5, false];
  23. };
  24. } else {
  25. player removeAction s_player_maintain_area;
  26. s_player_maintain_area = -1;
  27. player removeAction s_player_maintain_area_preview;
  28. s_player_maintain_area_preview = -1;
  29. };
  30. // ---------------------------------------Maintain Area End------------------------------------
  31.  
  32. _nearLight = nearestObject [player,"LitObject"];
  33. _canPickLight = false;
  34. if (!isNull _nearLight) then {
  35. if (_nearLight distance player < 4) then {
  36. _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
  37. };
  38. };
  39.  
  40. //Grab Flare
  41. if (_canPickLight and !dayz_hasLight and !_isPZombie) then {
  42. if (s_player_grabflare < 0) then {
  43. _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
  44. s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""];
  45. s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true, "", ""];
  46. };
  47. } else {
  48. player removeAction s_player_grabflare;
  49. player removeAction s_player_removeflare;
  50. s_player_grabflare = -1;
  51. s_player_removeflare = -1;
  52. };
  53.  
  54. if(DZE_HaloJump) then {
  55. if(_inVehicle and (_vehicle isKindOf "Air") and ((getPos _vehicle select 2) > 400)) then {
  56. if (s_halo_action < 0) then {
  57. DZE_myHaloVehicle = _vehicle;
  58. s_halo_action = DZE_myHaloVehicle addAction ["HALO Jump","\z\addons\dayz_code\actions\halo_jump.sqf",[],2,false,true,"",""];
  59. };
  60. } else {
  61. DZE_myHaloVehicle removeAction s_halo_action;
  62. s_halo_action = -1;
  63. };
  64. };
  65.  
  66. if (!DZE_ForceNameTagsOff) then {
  67. if (s_player_showname < 0 and !_isPZombie) then {
  68. if (DZE_ForceNameTags) then {
  69. s_player_showname = 1;
  70. player setVariable["DZE_display_name",true,true];
  71. } else {
  72. s_player_showname = player addAction ["Display Name (Yes)", "\z\addons\dayz_code\actions\display_name.sqf",true, 0, true, false, "",""];
  73. s_player_showname1 = player addAction ["Display Name (No)", "\z\addons\dayz_code\actions\display_name.sqf",false, 0, true, false, "",""];
  74. };
  75. };
  76. };
  77.  
  78. if(_isPZombie) then {
  79. if (s_player_callzombies < 0) then {
  80. s_player_callzombies = player addAction ["Raise Horde", "\z\addons\dayz_code\actions\call_zombies.sqf",player, 5, true, false, "",""];
  81. };
  82. if (DZE_PZATTACK) then {
  83. call pz_attack;
  84. DZE_PZATTACK = false;
  85. };
  86. if (s_player_pzombiesvision < 0) then {
  87. s_player_pzombiesvision = player addAction ["Night Vision", "\z\addons\dayz_code\actions\pzombie\pz_vision.sqf", [], 4, false, true, "nightVision", "_this == _target"];
  88. };
  89. if (!isNull cursorTarget and (player distance cursorTarget < 3)) then { //Has some kind of target
  90. _isAnimal = cursorTarget isKindOf "Animal";
  91. _isZombie = cursorTarget isKindOf "zZombie_base";
  92. _isHarvested = cursorTarget getVariable["meatHarvested",false];
  93. _isMan = cursorTarget isKindOf "Man";
  94. // Pzombie Gut human corpse or animal
  95. if (!alive cursorTarget and (_isAnimal or _isMan) and !_isZombie and !_isHarvested) then {
  96. if (s_player_pzombiesfeed < 0) then {
  97. s_player_pzombiesfeed = player addAction ["Feed", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",cursorTarget, 3, true, false, "",""];
  98. };
  99. } else {
  100. player removeAction s_player_pzombiesfeed;
  101. s_player_pzombiesfeed = -1;
  102. };
  103. } else {
  104. player removeAction s_player_pzombiesfeed;
  105. s_player_pzombiesfeed = -1;
  106. };
  107. };
  108.  
  109. // Increase distance only if AIR OR SHIP
  110. _allowedDistance = 4;
  111. _isAir = cursorTarget isKindOf "Air";
  112. _isShip = cursorTarget isKindOf "Ship";
  113. if(_isAir or _isShip) then {
  114. _allowedDistance = 6;
  115. };
  116.  
  117. if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cursorTarget < _allowedDistance) and _canDo) then { //Has some kind of target
  118.  
  119. // set cursortarget to variable
  120. _cursorTarget = cursorTarget;
  121.  
  122. // get typeof cursortarget once
  123. _typeOfCursorTarget = typeOf _cursorTarget;
  124.  
  125. // hintsilent _typeOfCursorTarget;
  126.  
  127. _isVehicle = _cursorTarget isKindOf "AllVehicles";
  128. _isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
  129. _isnewstorage = _typeOfCursorTarget in DZE_isNewStorage;
  130.  
  131. // get items and magazines only once
  132. _magazinesPlayer = magazines player;
  133.  
  134. //boiled Water
  135. _hasbottleitem = "ItemWaterbottle" in _magazinesPlayer;
  136. _hastinitem = false;
  137. {
  138. if (_x in _magazinesPlayer) then {
  139. _hastinitem = true;
  140. };
  141. } forEach boil_tin_cans;
  142. _hasFuelE = "ItemJerrycanEmpty" in _magazinesPlayer;
  143. _hasFuelBarrelE = "ItemFuelBarrelEmpty" in _magazinesPlayer;
  144. _hasHotwireKit = "ItemHotwireKit" in _magazinesPlayer;
  145.  
  146. _itemsPlayer = items player;
  147.  
  148. _temp_keys = [];
  149. _temp_keys_names = [];
  150. // find available keys
  151. _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
  152. {
  153. if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
  154. _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
  155. _ownerKeyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
  156. _temp_keys_names set [_ownerKeyId,_ownerKeyName];
  157. _temp_keys set [count _temp_keys,str(_ownerKeyId)];
  158. };
  159. } forEach _itemsPlayer;
  160.  
  161. _hasKnife = "ItemKnife" in _itemsPlayer;
  162. _hasToolbox = "ItemToolbox" in _itemsPlayer;
  163.  
  164. _isMan = _cursorTarget isKindOf "Man";
  165. _traderType = _typeOfCursorTarget;
  166. _ownerID = _cursorTarget getVariable ["CharacterID","0"];
  167. _isAnimal = _cursorTarget isKindOf "Animal";
  168. _isDog = (_cursorTarget isKindOf "DZ_Pastor" || _cursorTarget isKindOf "DZ_Fin");
  169. _isZombie = _cursorTarget isKindOf "zZombie_base";
  170. _isDestructable = _cursorTarget isKindOf "BuiltItems";
  171. _isWreck = _typeOfCursorTarget in DZE_isWreck;
  172. _isWreckBuilding = _typeOfCursorTarget in DZE_isWreckBuilding;
  173. _isModular = _cursorTarget isKindOf "ModularItems";
  174.  
  175. _isRemovable = _typeOfCursorTarget in DZE_isRemovable;
  176. _isDisallowRepair = _typeOfCursorTarget in ["M240Nest_DZ"];
  177.  
  178. _isTent = _cursorTarget isKindOf "TentStorage";
  179.  
  180. _isAlive = alive _cursorTarget;
  181.  
  182. _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
  183.  
  184. _rawmeat = meatraw;
  185. _hasRawMeat = false;
  186. {
  187. if (_x in _magazinesPlayer) then {
  188. _hasRawMeat = true;
  189. };
  190. } forEach _rawmeat;
  191.  
  192. _isFuel = false;
  193. if (_hasFuelE or _hasFuelBarrelE) then {
  194. {
  195. if(_cursorTarget isKindOf _x) exitWith {_isFuel = true;};
  196. } forEach dayz_fuelsources;
  197. };
  198.  
  199. // diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
  200.  
  201. // logic vars
  202. _player_flipveh = false;
  203. _player_deleteBuild = false;
  204. _player_lockUnlock_crtl = false;
  205.  
  206. // CURSOR TARGET ALIVE
  207. if(_isAlive) then {
  208.  
  209. //Allow player to delete objects
  210. if(_isDestructable or _isWreck or _isRemovable or _isWreckBuilding) then {
  211. if(_hasToolbox and "ItemCrowbar" in _itemsPlayer) then {
  212. _player_deleteBuild = true;
  213. };
  214. };
  215.  
  216. //Allow owners to delete modulars
  217. if(_isModular and (dayz_characterID == _ownerID)) then {
  218. if(_hasToolbox and "ItemCrowbar" in _itemsPlayer) then {
  219. _player_deleteBuild = true;
  220. };
  221. };
  222.  
  223. // CURSOR TARGET VEHICLE
  224. if(_isVehicle) then {
  225.  
  226. //flip vehicle small vehicles by your self and all other vehicles with help nearby
  227. if (!(canmove _cursorTarget) and (player distance _cursorTarget >= 2) and (count (crew _cursorTarget))== 0 and ((vectorUp _cursorTarget) select 2) < 0.5) then {
  228. _playersNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]);
  229. if(_isVehicletype or (_playersNear >= 2)) then {
  230. _player_flipveh = true;
  231. };
  232. };
  233.  
  234.  
  235. if(!_isMan and _ownerID != "0" and !(_cursorTarget isKindOf "Bicycle")) then {
  236. _player_lockUnlock_crtl = true;
  237. };
  238.  
  239. };
  240.  
  241. };
  242.  
  243. if(_player_deleteBuild) then {
  244. if (s_player_deleteBuild < 0) then {
  245. s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
  246. };
  247. } else {
  248. player removeAction s_player_deleteBuild;
  249. s_player_deleteBuild = -1;
  250. };
  251.  
  252.  
  253. // Allow Owner to lock and unlock vehicle
  254. if(_player_lockUnlock_crtl) then {
  255. if (s_player_lockUnlock_crtl < 0) then {
  256. _hasKey = _ownerID in _temp_keys;
  257. _oldOwner = (_ownerID == dayz_playerUID);
  258. if(locked _cursorTarget) then {
  259. if(_hasKey or _oldOwner) then {
  260. _Unlock = player addAction [format["Unlock %1",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _ownerID))], 2, true, true, "", ""];
  261. s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  262. s_player_lockUnlock_crtl = 1;
  263. } else {
  264. if(_hasHotwireKit) then {
  265. _Unlock = player addAction [format["Hotwire %1",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",_cursorTarget, 2, true, true, "", ""];
  266. } else {
  267. _Unlock = player addAction ["<t color='#ff0000'>Vehicle Locked</t>", "",_cursorTarget, 2, true, true, "", ""];
  268. };
  269. s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  270. s_player_lockUnlock_crtl = 1;
  271. };
  272. } else {
  273. if(_hasKey or _oldOwner) then {
  274. _lock = player addAction [format["Lock %1",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""];
  275. s_player_lockunlock set [count s_player_lockunlock,_lock];
  276. s_player_lockUnlock_crtl = 1;
  277. };
  278. };
  279. };
  280.  
  281. } else {
  282. {player removeAction _x} forEach s_player_lockunlock;s_player_lockunlock = [];
  283. s_player_lockUnlock_crtl = -1;
  284. };
  285.  
  286. if(DZE_AllowForceSave) then {
  287. //Allow player to force save
  288. if((_isVehicle or _isTent) and !_isMan) then {
  289. if (s_player_forceSave < 0) then {
  290. s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];
  291. };
  292. } else {
  293. player removeAction s_player_forceSave;
  294. s_player_forceSave = -1;
  295. };
  296. };
  297.  
  298.  
  299.  
  300. If(DZE_AllowCargoCheck) then {
  301. if((_isVehicle or _isTent or _isnewstorage) and _isAlive and !_isMan and !locked _cursorTarget) then {
  302. if (s_player_checkGear < 0) then {
  303. s_player_checkGear = player addAction [localize "STR_EPOCH_PLAYER_CARGO", "\z\addons\dayz_code\actions\cargocheck.sqf",_cursorTarget, 1, true, true, "", ""];
  304. };
  305. } else {
  306. player removeAction s_player_checkGear;
  307. s_player_checkGear = -1;
  308. };
  309. };
  310.  
  311.  
  312. //flip vehicle small vehicles by your self and all other vehicles with help nearby
  313. if(_player_flipveh) then {
  314. if (s_player_flipveh < 0) then {
  315. s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true, "", ""];
  316. };
  317. } else {
  318. player removeAction s_player_flipveh;
  319. s_player_flipveh = -1;
  320. };
  321.  
  322. //Allow player to fill jerrycan
  323. if((_hasFuelE or _hasFuelBarrelE) and _isFuel) then {
  324. if (s_player_fillfuel < 0) then {
  325. s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
  326. };
  327. } else {
  328. player removeAction s_player_fillfuel;
  329. s_player_fillfuel = -1;
  330. };
  331.  
  332. // logic vars for addactions
  333. _player_butcher = false;
  334. _player_studybody = false;
  335. _player_SurrenderedGear = false;
  336.  
  337. // CURSOR TARGET NOT ALIVE
  338. if (!_isAlive) then {
  339.  
  340. // Gut animal/zed
  341. if((_isAnimal or _isZombie) and _hasKnife) then {
  342. _isHarvested = _cursorTarget getVariable["meatHarvested",false];
  343. if (!_isHarvested) then {
  344. _player_butcher = true;
  345. };
  346. };
  347.  
  348. // Study body
  349. if (_isMan and !_isZombie and !_isAnimal) then {
  350. _player_studybody = true;
  351. }
  352. } else {
  353. // unit alive
  354.  
  355. // gear access on surrendered player
  356. if(_isMan and !_isZombie and !_isAnimal) then {
  357. _isSurrendered = _cursorTarget getVariable ["DZE_Surrendered",false];
  358. if (_isSurrendered) then {
  359. _player_SurrenderedGear = true;
  360. };
  361. };
  362. };
  363.  
  364.  
  365. // Human Gut animal or zombie
  366. if (_player_butcher) then {
  367. if (s_player_butcher < 0) then {
  368. if(_isZombie) then {
  369. s_player_butcher = player addAction ["Gut Zombie", "\z\addons\dayz_code\actions\gather_zparts.sqf",_cursorTarget, 0, true, true, "", ""];
  370. } else {
  371. s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",_cursorTarget, 3, true, true, "", ""];
  372. };
  373. };
  374. } else {
  375. player removeAction s_player_butcher;
  376. s_player_butcher = -1;
  377. };
  378.  
  379. // Study Body
  380. if (_player_studybody) then {
  381. if (s_player_studybody < 0) then {
  382. s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",_cursorTarget, 0, false, true, "",""];
  383. };
  384. } else {
  385. player removeAction s_player_studybody;
  386. s_player_studybody = -1;
  387. };
  388.  
  389. // logic vars
  390. _player_cook = false;
  391. _player_boil = false;
  392.  
  393. // CURSOR TARGET IS FIRE
  394. if (inflamed _cursorTarget) then {
  395.  
  396. //Fireplace Actions check
  397. if (_hasRawMeat) then {
  398. _player_cook = true;
  399. };
  400.  
  401. // Boil water
  402. if (_hasbottleitem and _hastinitem) then {
  403. _player_boil = true;
  404. };
  405. };
  406.  
  407. if (_player_SurrenderedGear) then {
  408. if (s_player_SurrenderedGear < 0) then {
  409. s_player_SurrenderedGear = player addAction ["Gear", "\z\addons\dayz_code\actions\surrender_gear.sqf",_cursorTarget, 1, true, true, "", ""];
  410. };
  411. } else {
  412. player removeAction s_player_SurrenderedGear;
  413. s_player_SurrenderedGear = -1;
  414. };
  415.  
  416. //Fireplace Actions check
  417. if (_player_cook) then {
  418. if (s_player_cook < 0) then {
  419. s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true, "", ""];
  420. };
  421. } else {
  422. player removeAction s_player_cook;
  423. s_player_cook = -1;
  424. };
  425.  
  426. // Boil water
  427. if (_player_boil) then {
  428. if (s_player_boil < 0) then {
  429. s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true, "", ""];
  430. };
  431. } else {
  432. player removeAction s_player_boil;
  433. s_player_boil = -1;
  434. };
  435.  
  436. if(_cursorTarget == dayz_hasFire) then {
  437. if ((s_player_fireout < 0) and !(inflamed _cursorTarget) and (player distance _cursorTarget < 3)) then {
  438. s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true, "",""];
  439. };
  440. } else {
  441. player removeAction s_player_fireout;
  442. s_player_fireout = -1;
  443. };
  444.  
  445. //Packing my tent
  446. if(_isTent and (player distance _cursorTarget < 3)) then {
  447. if (_ownerID == dayz_characterID) then {
  448. if (s_player_packtent < 0) then {
  449. s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true, "",""];
  450. };
  451. } else {
  452. if(("ItemJerrycan" in _magazinesPlayer) and ("ItemMatchbox_DZE" in weapons player)) then {
  453. if (s_player_packtent < 0) then {
  454. s_player_packtent = player addAction ["Destroy Tent", "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
  455. };
  456. };
  457. };
  458. } else {
  459. player removeAction s_player_packtent;
  460. s_player_packtent = -1;
  461. };
  462.  
  463. //Allow owner to unlock vault
  464. if((_typeOfCursorTarget in DZE_LockableStorage) and _ownerID != "0" and (player distance _cursorTarget < 3)) then {
  465. if (s_player_unlockvault < 0) then {
  466. if(_typeOfCursorTarget in DZE_LockedStorage) then {
  467. if(_ownerID == dayz_combination or _ownerID == dayz_playerUID) then {
  468. _combi = player addAction [format["Open %1",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true, "",""];
  469. s_player_combi set [count s_player_combi,_combi];
  470. } else {
  471. _combi = player addAction [format["Unlock %1",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  472. s_player_combi set [count s_player_combi,_combi];
  473. };
  474. s_player_unlockvault = 1;
  475. } else {
  476. if(_ownerID != dayz_combination and _ownerID != dayz_playerUID) then {
  477. _combi = player addAction ["Re-Enter Combination", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  478. s_player_combi set [count s_player_combi,_combi];
  479. s_player_unlockvault = 1;
  480. };
  481. };
  482. };
  483. } else {
  484. {player removeAction _x} forEach s_player_combi;s_player_combi = [];
  485. s_player_unlockvault = -1;
  486. };
  487.  
  488. //Allow owner to pack vault
  489. if(_typeOfCursorTarget in DZE_UnLockedStorage and _ownerID != "0" and (player distance _cursorTarget < 3)) then {
  490.  
  491. if (s_player_lockvault < 0) then {
  492. if(_ownerID == dayz_combination or _ownerID == dayz_playerUID) then {
  493. s_player_lockvault = player addAction [format["Lock %1",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true, "",""];
  494. };
  495. };
  496. if (s_player_packvault < 0 and (_ownerID == dayz_combination or _ownerID == dayz_playerUID)) then {
  497. s_player_packvault = player addAction [format["<t color='#ff0000'>Pack %1</t>",_text], "\z\addons\dayz_code\actions\vault_pack.sqf",_cursorTarget, 0, false, true, "",""];
  498. };
  499. } else {
  500. player removeAction s_player_packvault;
  501. s_player_packvault = -1;
  502. player removeAction s_player_lockvault;
  503. s_player_lockvault = -1;
  504. };
  505.  
  506.  
  507.  
  508. //Player Deaths
  509. if(_typeOfCursorTarget == "Info_Board_EP1") then {
  510. if (s_player_information < 0) then {
  511. s_player_information = player addAction ["Recent Murders", "\z\addons\dayz_code\actions\list_playerDeaths.sqf",[], 7, false, true, "",""];
  512. };
  513. } else {
  514. player removeAction s_player_information;
  515. s_player_information = -1;
  516. };
  517.  
  518. //Fuel Pump
  519. if(_typeOfCursorTarget in dayz_fuelpumparray) then {
  520. if (s_player_fuelauto < 0) then {
  521.  
  522. // check if Generator_DZ is running within 30 meters
  523. _findNearestGens = nearestObjects [player, ["Generator_DZ"], 30];
  524. _findNearestGen = [];
  525. {
  526. if (alive _x and (_x getVariable ["GeneratorRunning", false])) then {
  527. _findNearestGen set [(count _findNearestGen),_x];
  528. };
  529. } foreach _findNearestGens;
  530. _IsNearRunningGen = count (_findNearestGen);
  531.  
  532. // show that pump needs power if no generator nearby.
  533. if(_IsNearRunningGen > 0) then {
  534. s_player_fuelauto = player addAction ["Fill Vehicle", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true, "",""];
  535. } else {
  536. s_player_fuelauto = player addAction ["<t color='#ff0000'>Needs Power</t>", "",[], 0, false, true, "",""];
  537. };
  538. };
  539. } else {
  540. player removeAction s_player_fuelauto;
  541. s_player_fuelauto = -1;
  542. };
  543.  
  544. //Fuel Pump on truck
  545. if(_typeOfCursorTarget in DZE_fueltruckarray and alive _cursorTarget) then {
  546. if (s_player_fuelauto2 < 0) then {
  547. // show that fuel truck pump needs power.
  548. if(isEngineOn _cursorTarget) then {
  549. s_player_fuelauto2 = player addAction ["Fill Vehicle", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",_cursorTarget, 0, false, true, "",""];
  550. } else {
  551. s_player_fuelauto2 = player addAction ["<t color='#ff0000'>Needs Power</t>", "",[], 0, false, true, "",""];
  552. };
  553. };
  554. } else {
  555. player removeAction s_player_fuelauto2;
  556. s_player_fuelauto2 = -1;
  557. };
  558.  
  559. // inplace upgrade tool
  560. if ((_cursorTarget isKindOf "ModularItems") or (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") or (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {
  561. if ((s_player_lastTarget select 0) != _cursorTarget) then {
  562. if (s_player_upgrade_build > 0) then {
  563. player removeAction s_player_upgrade_build;
  564. s_player_upgrade_build = -1;
  565. };
  566. };
  567. if (s_player_upgrade_build < 0) then {
  568. // s_player_lastTarget = _cursorTarget;
  569. s_player_lastTarget set [0,_cursorTarget];
  570. s_player_upgrade_build = player addAction [format["Upgrade %1",_text], "fixes\player_upgrade.sqf",_cursorTarget, -1, false, true, "",""];
  571. };
  572. } else {
  573. player removeAction s_player_upgrade_build;
  574. s_player_upgrade_build = -1;
  575. };
  576.  
  577. // downgrade system
  578. if((_isDestructable or _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" or _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") and (DZE_Lock_Door == _ownerID)) then {
  579. if ((s_player_lastTarget select 1) != _cursorTarget) then {
  580. if (s_player_downgrade_build > 0) then {
  581. player removeAction s_player_downgrade_build;
  582. s_player_downgrade_build = -1;
  583. };
  584. };
  585.  
  586. if (s_player_downgrade_build < 0) then {
  587. s_player_lastTarget set [1,_cursorTarget];
  588. s_player_downgrade_build = player addAction [format["Remove Lock from %1",_text], "\z\addons\dayz_code\actions\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true, "",""];
  589. };
  590. } else {
  591. player removeAction s_player_downgrade_build;
  592. s_player_downgrade_build = -1;
  593. };
  594.  
  595. // inplace maintenance tool
  596. if((_cursorTarget isKindOf "ModularItems" or _cursorTarget isKindOf "DZE_Housebase" or _typeOfCursorTarget in DZE_ExtraMaintain) and (damage _cursorTarget >= 0.1)) then {
  597. if ((s_player_lastTarget select 2) != _cursorTarget) then {
  598. if (s_player_maint_build > 0) then {
  599. player removeAction s_player_maint_build;
  600. s_player_maint_build = -1;
  601. };
  602. };
  603.  
  604. if (s_player_maint_build < 0) then {
  605. s_player_lastTarget set [2,_cursorTarget];
  606. s_player_maint_build = player addAction [format["Maintain %1",_text], "\z\addons\dayz_code\actions\player_buildingMaint.sqf",_cursorTarget, -2, false, true, "",""];
  607. };
  608. } else {
  609. player removeAction s_player_maint_build;
  610. s_player_maint_build = -1;
  611. };
  612.  
  613.  
  614. //Start Generator
  615. if(_cursorTarget isKindOf "Generator_DZ") then {
  616. if (s_player_fillgen < 0) then {
  617.  
  618. // check if not running
  619. if((_cursorTarget getVariable ["GeneratorRunning", false])) then {
  620. s_player_fillgen = player addAction ["Stop Generator", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  621. } else {
  622. // check if not filled and player has jerry.
  623. if((_cursorTarget getVariable ["GeneratorFilled", false])) then {
  624. s_player_fillgen = player addAction ["Start Generator", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  625. } else {
  626. if("ItemJerrycan" in _magazinesPlayer) then {
  627. s_player_fillgen = player addAction ["Fill and Start Generator", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  628. };
  629. };
  630. };
  631. };
  632. } else {
  633. player removeAction s_player_fillgen;
  634. s_player_fillgen = -1;
  635. };
  636.  
  637. //Towing with tow truck
  638. /*
  639. if(_typeOfCursorTarget == "TOW_DZE") then {
  640. if (s_player_towing < 0) then {
  641. if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
  642. s_player_towing = player addAction ["Attach Straps", "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""];
  643. } else {
  644. s_player_towing = player addAction ["Detach Straps", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""];
  645. };
  646. };
  647. } else {
  648. player removeAction s_player_towing;
  649. s_player_towing = -1;
  650. };
  651. */
  652.  
  653.  
  654. //Sleep
  655. if(_isTent and _ownerID == dayz_characterID) then {
  656. if ((s_player_sleep < 0) and (player distance _cursorTarget < 3)) then {
  657. s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];
  658. };
  659. } else {
  660. player removeAction s_player_sleep;
  661. s_player_sleep = -1;
  662. };
  663.  
  664. //Repairing Vehicles
  665. if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1) and !_isDisallowRepair) then {
  666. if (s_player_repair_crtl < 0) then {
  667. dayz_myCursorTarget = _cursorTarget;
  668. _menu = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_REPAIRV", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  669. _menu1 = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_SALVAGEV", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  670. s_player_repairActions set [count s_player_repairActions,_menu];
  671. s_player_repairActions set [count s_player_repairActions,_menu1];
  672. s_player_repair_crtl = 1;
  673. } else {
  674. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  675. s_player_repair_crtl = -1;
  676. };
  677. };
  678.  
  679. // All Traders
  680. if (_isMan and !_isPZombie and _traderType in serverTraders) then {
  681.  
  682. if (s_player_parts_crtl < 0) then {
  683.  
  684. // get humanity
  685. _humanity = player getVariable ["humanity",0];
  686. _traderMenu = call compile format["menu_%1;",_traderType];
  687.  
  688. // diag_log ("TRADER = " + str(_traderMenu));
  689.  
  690. _low_high = "low";
  691. _humanity_logic = false;
  692. if((_traderMenu select 2) == "friendly") then {
  693. _humanity_logic = (_humanity < -5000);
  694. };
  695. if((_traderMenu select 2) == "hostile") then {
  696. _low_high = "high";
  697. _humanity_logic = (_humanity > -5000);
  698. };
  699. if((_traderMenu select 2) == "hero") then {
  700. _humanity_logic = (_humanity < 5000);
  701. };
  702. if(_humanity_logic) then {
  703. _cancel = player addAction [format["Your humanity is too %1 this trader refuses to talk to you.",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
  704. s_player_parts set [count s_player_parts,_cancel];
  705. } else {
  706.  
  707. // Static Menu
  708. {
  709. //diag_log format["DEBUG TRADER: %1", _x];
  710. _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, "",""];
  711. s_player_parts set [count s_player_parts,_buy];
  712.  
  713. } forEach (_traderMenu select 1);
  714. // Database menu
  715. _buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 99, true, false, "",""];
  716. s_player_parts set [count s_player_parts,_buy];
  717.  
  718. // Add static metals trader options under sub menu
  719. _metals_trader = player addAction [localize "STR_EPOCH_PLAYER_301", "\z\addons\dayz_code\actions\trade_metals.sqf",["na"], 0, true, false, "",""];
  720. s_player_parts set [count s_player_parts,_metals_trader];
  721.  
  722. };
  723. s_player_parts_crtl = 1;
  724.  
  725. };
  726. } else {
  727. {player removeAction _x} forEach s_player_parts;s_player_parts = [];
  728. s_player_parts_crtl = -1;
  729. };
  730.  
  731.  
  732. if(dayz_tameDogs) then {
  733.  
  734. //Dog
  735. if (_isDog and _isAlive and (_hasRawMeat) and _ownerID == "0" and player getVariable ["dogID", 0] == 0) then {
  736. if (s_player_tamedog < 0) then {
  737. s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", _cursorTarget, 1, false, true, "", ""];
  738. };
  739. } else {
  740. player removeAction s_player_tamedog;
  741. s_player_tamedog = -1;
  742. };
  743. if (_isDog and _ownerID == dayz_characterID and _isAlive) then {
  744. _dogHandle = player getVariable ["dogID", 0];
  745. if (s_player_feeddog < 0 and _hasRawMeat) then {
  746. s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];
  747. };
  748. if (s_player_waterdog < 0 and "ItemWaterbottle" in _magazinesPlayer) then {
  749. s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];
  750. };
  751. if (s_player_staydog < 0) then {
  752. _lieDown = _dogHandle getFSMVariable "_actionLieDown";
  753. if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
  754. s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];
  755. };
  756. if (s_player_trackdog < 0) then {
  757. s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];
  758. };
  759. if (s_player_barkdog < 0) then {
  760. s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", _cursorTarget, 3, false, true,"",""];
  761. };
  762. if (s_player_warndog < 0) then {
  763. _warn = _dogHandle getFSMVariable "_watchDog";
  764. if (_warn) then { _text = (localize "str_epoch_player_247"); _warn = false; } else { _text = (localize "str_epoch_player_248"); _warn = true; };
  765. s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];
  766. };
  767. if (s_player_followdog < 0) then {
  768. s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];
  769. };
  770. } else {
  771. player removeAction s_player_feeddog;
  772. s_player_feeddog = -1;
  773. player removeAction s_player_waterdog;
  774. s_player_waterdog = -1;
  775. player removeAction s_player_staydog;
  776. s_player_staydog = -1;
  777. player removeAction s_player_trackdog;
  778. s_player_trackdog = -1;
  779. player removeAction s_player_barkdog;
  780. s_player_barkdog = -1;
  781. player removeAction s_player_warndog;
  782. s_player_warndog = -1;
  783. player removeAction s_player_followdog;
  784. s_player_followdog = -1;
  785. };
  786. };
  787.  
  788. } else {
  789. //Engineering
  790. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  791. s_player_repair_crtl = -1;
  792.  
  793. {player removeAction _x} forEach s_player_combi;s_player_combi = [];
  794.  
  795. dayz_myCursorTarget = objNull;
  796. s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];
  797.  
  798. {player removeAction _x} forEach s_player_parts;s_player_parts = [];
  799. s_player_parts_crtl = -1;
  800.  
  801. {player removeAction _x} forEach s_player_lockunlock;s_player_lockunlock = [];
  802. s_player_lockUnlock_crtl = -1;
  803.  
  804. player removeAction s_player_checkGear;
  805. s_player_checkGear = -1;
  806.  
  807. player removeAction s_player_SurrenderedGear;
  808. s_player_SurrenderedGear = -1;
  809.  
  810. //Others
  811. player removeAction s_player_forceSave;
  812. s_player_forceSave = -1;
  813. player removeAction s_player_flipveh;
  814. s_player_flipveh = -1;
  815. player removeAction s_player_sleep;
  816. s_player_sleep = -1;
  817. player removeAction s_player_deleteBuild;
  818. s_player_deleteBuild = -1;
  819. player removeAction s_player_butcher;
  820. s_player_butcher = -1;
  821. player removeAction s_player_cook;
  822. s_player_cook = -1;
  823. player removeAction s_player_boil;
  824. s_player_boil = -1;
  825. player removeAction s_player_fireout;
  826. s_player_fireout = -1;
  827. player removeAction s_player_packtent;
  828. s_player_packtent = -1;
  829. player removeAction s_player_fillfuel;
  830. s_player_fillfuel = -1;
  831. player removeAction s_player_studybody;
  832. s_player_studybody = -1;
  833. //Dog
  834. player removeAction s_player_tamedog;
  835. s_player_tamedog = -1;
  836. player removeAction s_player_feeddog;
  837. s_player_feeddog = -1;
  838. player removeAction s_player_waterdog;
  839. s_player_waterdog = -1;
  840. player removeAction s_player_staydog;
  841. s_player_staydog = -1;
  842. player removeAction s_player_trackdog;
  843. s_player_trackdog = -1;
  844. player removeAction s_player_barkdog;
  845. s_player_barkdog = -1;
  846. player removeAction s_player_warndog;
  847. s_player_warndog = -1;
  848. player removeAction s_player_followdog;
  849. s_player_followdog = -1;
  850.  
  851. // vault
  852. player removeAction s_player_unlockvault;
  853. s_player_unlockvault = -1;
  854. player removeAction s_player_packvault;
  855. s_player_packvault = -1;
  856. player removeAction s_player_lockvault;
  857. s_player_lockvault = -1;
  858.  
  859. player removeAction s_player_information;
  860. s_player_information = -1;
  861. player removeAction s_player_fillgen;
  862. s_player_fillgen = -1;
  863. player removeAction s_player_upgrade_build;
  864. s_player_upgrade_build = -1;
  865. player removeAction s_player_maint_build;
  866. s_player_maint_build = -1;
  867. player removeAction s_player_downgrade_build;
  868. s_player_downgrade_build = -1;
  869. player removeAction s_player_towing;
  870. s_player_towing = -1;
  871. player removeAction s_player_fuelauto;
  872. s_player_fuelauto = -1;
  873. player removeAction s_player_fuelauto2;
  874. s_player_fuelauto2 = -1;
  875. };
  876.  
  877.  
  878.  
  879. //Dog actions on player self
  880. _dogHandle = player getVariable ["dogID", 0];
  881. if (_dogHandle > 0) then {
  882. _dog = _dogHandle getFSMVariable "_dog";
  883. _ownerID = "0";
  884. if (!isNull cursorTarget) then { _ownerID = cursorTarget getVariable ["CharacterID","0"]; };
  885. if (_canDo and !_inVehicle and alive _dog and _ownerID != dayz_characterID) then {
  886. if (s_player_movedog < 0) then {
  887. s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID", 0], 1, false, true, "", ""];
  888. };
  889. if (s_player_speeddog < 0) then {
  890. _text = (localize "str_epoch_player_249");
  891. _speed = 0;
  892. if (_dog getVariable ["currentSpeed",1] == 0) then { _speed = 1; _text = (localize "str_epoch_player_250"); };
  893. 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, "", ""];
  894. };
  895. if (s_player_calldog < 0) then {
  896. 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, "", ""];
  897. };
  898. };
  899. } else {
  900. player removeAction s_player_movedog;
  901. s_player_movedog = -1;
  902. player removeAction s_player_speeddog;
  903. s_player_speeddog = -1;
  904. player removeAction s_player_calldog;
  905. s_player_calldog = -1;
  906. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement