Advertisement
Guest User

Untitled

a guest
Jun 29th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.75 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["_isStash","_vehicle","_inVehicle","_bag","_classbag","_isWater","_hasAntiB","_hasFuelE","_hasFuel5","_hasbottleitem","_hastinitem","_hasKnife","_hasToolbox","_hasTent","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_canmove","_rawmeat","_hasRawMeat","_allFixed","_hitpoints","_damage","_part","_cmpt","_damagePercent","_color","_string","_handle","_dogHandle","_lieDown","_warn","_dog","_speed"];
  8.  
  9. _vehicle = vehicle player;
  10. _inVehicle = (_vehicle != player);
  11. _bag = unitBackpack player;
  12. _classbag = typeOf _bag;
  13. _isWater = (surfaceIsWater (position player)) or dayz_isSwimming;
  14. _hasAntiB = "ItemAntibiotic" in magazines player;
  15. _hasFuelE20 = "ItemJerrycanEmpty" in magazines player;
  16. _hasFuelE5 = "ItemFuelcanEmpty" in magazines player;
  17. //boiled Water
  18. _hasbottleitem = "ItemWaterbottle" in magazines player;
  19. _hastinitem = false;
  20. {
  21. if (_x in magazines player) then {
  22. _hastinitem = true;
  23. };
  24.  
  25. } forEach boil_tin_cans;
  26.  
  27.  
  28. _hasKnife = "ItemKnife" in items player;
  29. _hasToolbox = "ItemToolbox" in items player;
  30. //_hasTent = "ItemTent" in items player;
  31. _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  32. _nearLight = nearestObject [player,"LitObject"];
  33. _canPickLight = false;
  34.  
  35. if (!isNull _nearLight) then {
  36. if (_nearLight distance player < 4) then {
  37. _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
  38. };
  39. };
  40. _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
  41.  
  42.  
  43.  
  44. // ---------------------------------------Krixes Self Bloodbag Start------------------------------------
  45. _mags = magazines player;
  46.  
  47. // Krixes Self Bloodbag
  48. if ("ItemBloodbag" in _mags) then {
  49. hasBagItem = true;
  50. } else { hasBagItem = false;};
  51. if((speed player <= 1) && hasBagItem && _canDo) then {
  52. if (s_player_selfBloodbag < 0) then {
  53. s_player_selfBloodbag = player addaction[("<t color=""#c70000"">" + ("Self Bloodbag") +"</t>"),"fixes\player_selfbloodbag.sqf","",5,false,true,"", ""];
  54. };
  55. } else {
  56. player removeAction s_player_selfBloodbag;
  57. s_player_selfBloodbag = -1;
  58. };
  59. // ---------------------------------------Krixes Self Bloodbag End------------------------------------
  60.  
  61.  
  62. //##### BASE BUILDING 1.2 Custom Actions (CROSSHAIR IS TARGETING NOTHING) #####
  63. // #### START1 ####
  64. _currentSkin = typeOf(player);
  65. // Get closest camonet since we cannot target with crosshair Base Building Script, got lazy here, didnt fix with array
  66. camoNetB_East = nearestObject [player, "Land_CamoNetB_EAST"];
  67. camoNetVar_East = nearestObject [player, "Land_CamoNetVar_EAST"];
  68. camoNet_East = nearestObject [player, "Land_CamoNet_EAST"];
  69. camoNetB_Nato = nearestObject [player, "Land_CamoNetB_NATO"];
  70. camoNetVar_Nato = nearestObject [player, "Land_CamoNetVar_NATO"];
  71. camoNet_Nato = nearestObject [player, "Land_CamoNet_NATO"];
  72. // Check mags in player inventory to show build recipe menu
  73. _mags = magazines player;
  74. if ("ItemTankTrap" in _mags || "ItemSandbag" in _mags || "ItemWire" in _mags || "PartWoodPile" in _mags || "PartGeneric" in _mags) then {
  75. hasBuildItem = true;
  76. } else { hasBuildItem = false;};
  77. //Build Recipe Menu Action
  78. if((speed player <= 1) && hasBuildItem && _canDo) then {
  79. if (s_player_recipeMenu < 0) then {
  80. s_player_recipeMenu = player addaction [("<t color=""#0074E8"">" + ("Build Recipes") +"</t>"),"buildRecipeBook\build_recipe_dialog.sqf","",5,false,true,"",""];
  81. };
  82. } else {
  83. player removeAction s_player_recipeMenu;
  84. s_player_recipeMenu = -1;
  85. };
  86.  
  87. //Add in custom eventhandlers or whatever on skin change
  88. if (_currentSkin != globalSkin) then {
  89. globalSkin = _currentSkin;
  90. player removeMPEventHandler ["MPHit", 0];
  91. player removeEventHandler ["AnimChanged", 0];
  92. ehWall = player addEventHandler ["AnimChanged", { player call antiWall; } ];
  93. };
  94. // Remove CamoNets, (Not effecient but works)
  95. if((isNull cursorTarget) && _hasToolbox && _canDo && !remProc && !procBuild &&
  96. (camoNetB_East distance player < 10 or
  97. camoNetVar_East distance player < 10 or
  98. camoNet_East distance player < 10 or
  99. camoNetB_Nato distance player < 10 or
  100. camoNetVar_Nato distance player < 10 or
  101. camoNet_Nato distance player < 10)) then {
  102. if (s_player_deleteCamoNet < 0) then {
  103. s_player_deleteCamoNet = player addaction [("<t color=""#F01313"">" + ("Remove Netting") +"</t>"),"dayz_code\actions\player_remove.sqf","",1,true,true,"",""];
  104. s_player_netCodeObject = player addaction [("<t color=""#8E11F5"">" + ("Enter Code of Object to remove Netting") +"</t>"),"dayz_code\external\keypad\fnc_keyPad\enterCode.sqf","",5,false,true,"",""];
  105. };
  106. } else {
  107. player removeAction s_player_deleteCamoNet;
  108. s_player_deleteCamoNet = -1;
  109. player removeAction s_player_netCodeObject;
  110. s_player_netCodeObject = -1;
  111. };
  112.  
  113.  
  114. // Remove CamoNets Owner removal, (Not effecient but works)
  115. if(_canDo && removeObject && !procBuild && !remProc &&
  116. (camoNetB_East distance player < 10 or
  117. camoNetVar_East distance player < 10 or
  118. camoNet_East distance player < 10 or
  119. camoNetB_Nato distance player < 10 or
  120. camoNetVar_Nato distance player < 10 or
  121. camoNet_Nato distance player < 10)) then {
  122. if (s_player_codeRemoveNet < 0) then {
  123. s_player_codeRemoveNet = player addaction [("<t color=""#8E11F5"">" + ("Base Owners Remove Object Netting") +"</t>"),"dayz_code\actions\player_remove.sqf","",5,false,true,"",""];
  124. };
  125. } else {
  126. player removeAction s_player_codeRemoveNet;
  127. s_player_codeRemoveNet = -1;
  128. };
  129.  
  130. //##### BASE BUILDING 1.2 Custom Actions (CROSSHAIR IS TARGETING NOTHING) #####
  131. // #### END1 ####
  132.  
  133. //Grab Flare
  134. if (_canPickLight and !dayz_hasLight) then {
  135. if (s_player_grabflare < 0) then {
  136. _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
  137. s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""];
  138. s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true, "", ""];
  139. };
  140. } else {
  141. player removeAction s_player_grabflare;
  142. player removeAction s_player_removeflare;
  143. s_player_grabflare = -1;
  144. s_player_removeflare = -1;
  145. };
  146.  
  147. if (!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4)) then { //Has some kind of target
  148. _isHarvested = cursorTarget getVariable["meatHarvested",false];
  149. _isVehicle = cursorTarget isKindOf "AllVehicles";
  150. _isVehicletype = typeOf cursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
  151. _isMan = cursorTarget isKindOf "Man";
  152. _ownerID = cursorTarget getVariable ["characterID","0"];
  153. _isAnimal = cursorTarget isKindOf "Animal";
  154. _isDog = (cursorTarget isKindOf "DZ_Pastor" || cursorTarget isKindOf "DZ_Fin");
  155. _isZombie = cursorTarget isKindOf "zZombie_base";
  156. _isDestructable = cursorTarget isKindOf "BuiltItems";
  157. _isTent = cursorTarget isKindOf "TentStorage";
  158. _isStash = cursorTarget isKindOf "StashSmall";
  159. _isMediumStash = cursorTarget isKindOf "StashMedium";
  160. _isFuel = false;
  161. _hasFuel20 = "ItemJerrycan" in magazines player;
  162. _hasFuel5 = "ItemFuelcan" in magazines player;
  163. _isAlive = alive cursorTarget;
  164. _canmove = canmove cursorTarget;
  165. _text = getText (configFile >> "CfgVehicles" >> typeOf cursorTarget >> "displayName");
  166.  
  167. _rawmeat = meatraw;
  168. _hasRawMeat = false;
  169. {
  170. if (_x in magazines player) then {
  171. _hasRawMeat = true;
  172. };
  173. } forEach _rawmeat;
  174.  
  175.  
  176. if (_hasFuelE20 or _hasFuelE5) then {
  177. _isFuel = (cursorTarget isKindOf "Land_Ind_TankSmall") or (cursorTarget isKindOf "Land_fuel_tank_big") or (cursorTarget isKindOf "Land_fuel_tank_stairs") or (cursorTarget isKindOf "Land_wagon_tanker");
  178. };
  179. //diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
  180.  
  181. //Allow player to delete objects
  182. if(_isDestructable and _hasToolbox and _canDo) then {
  183. if (s_player_deleteBuild < 0) then {
  184. s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",cursorTarget, 1, true, true, "", ""];
  185. };
  186. } else {
  187. player removeAction s_player_deleteBuild;
  188. s_player_deleteBuild = -1;
  189. };
  190.  
  191. //##### BASE BUILDING 1.2 Custom Actions (CROSSHAIR HAS A TARGET) #####
  192. // ##### START #####
  193. // Operate Gates
  194. if ((dayz_myCursorTarget != cursorTarget) && (cursorTarget isKindOf "Infostand_2_EP1") && keyValid) then {
  195. _lever = cursorTarget;
  196. {dayz_myCursorTarget removeAction _x} forEach s_player_gateActions;s_player_gateActions = [];
  197. dayz_myCursorTarget = _lever;
  198. _gates = nearestObjects [_lever, ["Concrete_Wall_EP1"], 100];
  199. if (count _gates > 0) then {
  200. _handle = dayz_myCursorTarget addAction ["Operate Gate", "dayz_code\external\keypad\fnc_keyPad\operate_gates.sqf", _lever, 1, false, true, "", ""];
  201. s_player_gateActions set [count s_player_gateActions,_handle];
  202. };
  203. };
  204.  
  205. // Remove Object Custom removal test
  206. if((typeOf(cursortarget) in allremovables) && _hasToolbox && _canDo && !remProc && !procBuild && !removeObject) then {
  207. if (s_player_deleteBuild < 0) then {
  208. s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "dayz_code\actions\player_remove.sqf",cursorTarget, 1, true, true, "", ""];
  209. };
  210. } else {
  211. player removeAction s_player_deleteBuild;
  212. s_player_deleteBuild = -1;
  213. };
  214.  
  215.  
  216. // Enter Code to Operate Gates Action
  217. if((speed player <= 1) && !keyValid && (typeOf(cursortarget) == "Infostand_2_EP1") && cursorTarget distance player < 5 && _canDo) then {
  218. if (s_player_enterCode < 0) then {
  219. s_player_enterCode = player addaction [("<t color=""#4DFF0D"">" + ("Enter Key Code to Operate Gate") +"</t>"),"dayz_code\external\keypad\fnc_keyPad\enterCode.sqf","",5,false,true,"",""];
  220. };
  221. } else {
  222. player removeAction s_player_enterCode;
  223. s_player_enterCode = -1;
  224. };
  225.  
  226. // Enter Code to remove object
  227. if((speed player <= 1) && !removeObject && (typeOf(cursortarget) in allbuildables_class) && cursorTarget distance player < 5 && _canDo) then {
  228. if (s_player_codeObject < 0) then {
  229. s_player_codeObject = player addaction [("<t color=""#8E11F5"">" + ("Enter Code of Object to remove") +"</t>"),"dayz_code\external\keypad\fnc_keyPad\enterCode.sqf","",5,false,true,"",""];
  230. };
  231. } else {
  232. player removeAction s_player_codeObject;
  233. s_player_codeObject = -1;
  234. };
  235.  
  236.  
  237. // Remove Object from code
  238. if((typeOf(cursortarget) in allbuildables_class) && _canDo && removeObject && !procBuild && !remProc) then {
  239. _validObject = cursortarget getVariable ["validObject",false];
  240. if (_validObject) then {
  241. if (s_player_codeRemove < 0) then {
  242. s_player_codeRemove = player addaction [("<t color=""#8E11F5"">" + ("Base Owners Remove Object") +"</t>"),"dayz_code\actions\player_remove.sqf","",5,false,true,"",""];
  243. };
  244. } else {
  245. player removeAction s_player_codeRemove;
  246. s_player_codeRemove = -1;
  247. };
  248. } else {
  249. player removeAction s_player_codeRemove;
  250. s_player_codeRemove = -1;
  251. };
  252. // Disarm Booby Trap Action
  253. if(_hasToolbox && _canDo && !remProc && !procBuild && (cursortarget iskindof "Grave" && cursortarget distance player < 2.5 && !(cursortarget iskindof "Body" || cursortarget iskindof "GraveCross1" || cursortarget iskindof "GraveCross2" || cursortarget iskindof "GraveCrossHelmet" || cursortarget iskindof "Land_Church_tomb_1" || cursortarget iskindof "Land_Church_tomb_2" || cursortarget iskindof "Land_Church_tomb_3" || cursortarget iskindof "Mass_grave"))) then {
  254. if (s_player_disarmBomb < 0) then {
  255. s_player_disarmBomb = player addaction [("<t color=""#F01313"">" + ("Disarm Bomb") +"</t>"),"dayz_code\actions\player_disarmBomb.sqf","",1,true,true,"", ""];
  256. };
  257. } else {
  258. player removeAction s_player_disarmBomb;
  259. s_player_disarmBomb = -1;
  260. };
  261.  
  262. //##### BASE BUILDING 1.2 Custom Actions (CROSSHAIR HAS A TARGET) #####
  263. // ##### END #####
  264.  
  265.  
  266. //Allow player to force save
  267. if((_isVehicle or _isTent or _isStash or _isMediumStash) and _canDo and !_isMan and (damage cursorTarget < 1)) then {
  268. if (s_player_forceSave < 0) then {
  269. s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",cursorTarget, 1, true, true, "", ""];
  270. };
  271. } else {
  272. player removeAction s_player_forceSave;
  273. s_player_forceSave = -1;
  274. };
  275.  
  276. //flip vehicle
  277. if ((_isVehicletype) and !_canmove and _isAlive and (player distance cursorTarget >= 2) and (count (crew cursorTarget))== 0 and ((vectorUp cursorTarget) select 2) < 0.5) then {
  278. if (s_player_flipveh < 0) then {
  279. s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",cursorTarget, 1, true, true, "", ""];
  280. };
  281. } else {
  282. player removeAction s_player_flipveh;
  283. s_player_flipveh = -1;
  284. };
  285.  
  286. //Allow player to fill Fuel can
  287. if((_hasFuelE20 or _hasFuelE5) and _isFuel and _canDo and !a_player_jerryfilling) then {
  288. if (s_player_fillfuel < 0) then {
  289. s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
  290. };
  291. } else {
  292. player removeAction s_player_fillfuel;
  293. s_player_fillfuel = -1;
  294. };
  295.  
  296. //Allow player to fill vehilce 20L
  297. if(_hasFuel20 and _canDo and _isVehicle and (fuel cursorTarget < 1)) then {
  298. if (s_player_fillfuel20 < 0) then {
  299. s_player_fillfuel20 = player addAction [format[localize "str_actions_medical_10"+" with 20L",_text], "\z\addons\dayz_code\actions\refuel.sqf",["ItemJerrycan"], 0, true, true, "", "'ItemJerrycan' in magazines player"];
  300. };
  301. } else {
  302. player removeAction s_player_fillfuel20;
  303. s_player_fillfuel20 = -1;
  304. };
  305.  
  306. //Allow player to fill vehilce 5L
  307. if(_hasFuel5 and _canDo and _isVehicle and (fuel cursorTarget < 1)) then {
  308. if (s_player_fillfuel5 < 0) then {
  309. s_player_fillfuel5 = player addAction [format[localize "str_actions_medical_10"+" with 5L",_text], "\z\addons\dayz_code\actions\refuel.sqf",["ItemFuelcan"], 0, true, true, "", "'ItemFuelcan' in magazines player"];
  310. };
  311. } else {
  312. player removeAction s_player_fillfuel5;
  313. s_player_fillfuel5 = -1;
  314. };
  315.  
  316. //Harvested
  317. if (!alive cursorTarget and _isAnimal and _hasKnife and !_isHarvested and _canDo) then {
  318. if (s_player_butcher < 0) then {
  319. s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",cursorTarget, 3, true, true, "", ""];
  320. };
  321. } else {
  322. player removeAction s_player_butcher;
  323. s_player_butcher = -1;
  324. };
  325.  
  326. //Fireplace Actions check
  327. if (inflamed cursorTarget and _hasRawMeat and _canDo and !a_player_cooking) then {
  328. if (s_player_cook < 0) then {
  329. s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",cursorTarget, 3, true, true, "", ""];
  330. };
  331. } else {
  332. player removeAction s_player_cook;
  333. s_player_cook = -1;
  334. };
  335. if (inflamed cursorTarget and (_hasbottleitem and _hastinitem) and _canDo and !a_player_boil) then {
  336. if (s_player_boil < 0) then {
  337. s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",cursorTarget, 3, true, true, "", ""];
  338. };
  339. } else {
  340. player removeAction s_player_boil;
  341. s_player_boil = -1;
  342. };
  343.  
  344. if(cursorTarget == dayz_hasFire and _canDo) then {
  345. if ((s_player_fireout < 0) and !(inflamed cursorTarget) and (player distance cursorTarget < 3)) then {
  346. s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",cursorTarget, 0, false, true, "",""];
  347. };
  348. } else {
  349. player removeAction s_player_fireout;
  350. s_player_fireout = -1;
  351. };
  352.  
  353. //Packing my tent
  354. if(cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
  355. if ((s_player_packtent < 0) and (player distance cursorTarget < 3)) then {
  356. s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",cursorTarget, 0, false, true, "",""];
  357. };
  358. } else {
  359. player removeAction s_player_packtent;
  360. s_player_packtent = -1;
  361. };
  362.  
  363. //Sleep
  364. if(cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
  365. if ((s_player_sleep < 0) and (player distance cursorTarget < 3)) then {
  366. s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",cursorTarget, 0, false, true, "",""];
  367. };
  368. } else {
  369. player removeAction s_player_sleep;
  370. s_player_sleep = -1;
  371. };
  372.  
  373.  
  374. //Repairing Vehicles
  375. if ((dayz_myCursorTarget != cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage cursorTarget < 1)) then {
  376. _vehicle = cursorTarget;
  377. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  378. dayz_myCursorTarget = _vehicle;
  379. _allFixed = true;
  380. _hitpoints = _vehicle call vehicle_getHitpoints;
  381.  
  382. {
  383. _damage = [_vehicle,_x] call object_getHit;
  384.  
  385. _cmpt = toArray (_x);
  386. _cmpt set [0,20];
  387. _cmpt set [1,toArray ("-") select 0];
  388. _cmpt set [2,20];
  389. _cmpt = toString _cmpt;
  390.  
  391. _configVeh = configFile >> "cfgVehicles" >> "RepairParts" >> _x;
  392. _part = getText(_configVeh >> "part");
  393. if (isnil ("_part")) then { _part = "PartGeneric"; };
  394.  
  395. // get every damaged part no matter how tiny damage is!
  396. _damagePercent = round((1 - _damage) * 100);
  397. if (_damage > 0) then {
  398. _allFixed = false;
  399. _color = "color='#ffff00'"; //yellow
  400. if (_damage >= 0.5) then {_color = "color='#ff8800'";}; //orange
  401. if (_damage >= 0.9) then {_color = "color='#ff0000'";}; //red
  402. _cmpt = format[localize "str_actions_medical_09_status",_cmpt,_damagePercent];
  403.  
  404. _string = format[localize "str_actions_medical_09",_cmpt,_color]; //Repair - Part
  405. _handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\repair.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
  406. s_player_repairActions set [count s_player_repairActions,_handle];
  407. };
  408.  
  409. } forEach _hitpoints;
  410. if (_allFixed) then {
  411. _vehicle setDamage 0;
  412. };
  413. };
  414.  
  415. // Remove Parts from Vehicles - By SilverShot.
  416. if( !_isMan and _canDo and _hasToolbox and (silver_myCursorTarget != cursorTarget) and cursorTarget isKindOf "AllVehicles" and (getDammage cursorTarget < 0.95) ) then {
  417. _vehicle = cursorTarget;
  418. _invalidVehicle = (_vehicle isKindOf "Motorcycle") or (_vehicle isKindOf "Tractor"); //or (_vehicle isKindOf "ATV_US_EP1") or (_vehicle isKindOf "ATV_CZ_EP1");
  419. if( !_invalidVehicle ) then {
  420. {silver_myCursorTarget removeAction _x} forEach s_player_removeActions;
  421. s_player_removeActions = [];
  422. silver_myCursorTarget = _vehicle;
  423.  
  424. _hitpoints = _vehicle call vehicle_getHitpoints;
  425.  
  426. {
  427. _damage = [_vehicle,_x] call object_getHit;
  428.  
  429. if( _damage < 0.15 ) then {
  430.  
  431. //change "HitPart" to " - Part" rather than complicated string replace
  432. _cmpt = toArray (_x);
  433. _cmpt set [0,20];
  434. _cmpt set [1,toArray ("-") select 0];
  435. _cmpt set [2,20];
  436. _cmpt = toString _cmpt;
  437.  
  438. _skip = true;
  439. if( _skip and _x == "HitFuel" ) then { _skip = false; _part = "PartFueltank"; _cmpt = _cmpt + "tank"};
  440. if( _skip and _x == "HitEngine" ) then { _skip = false; _part = "PartEngine"; };
  441. if( _skip and _x == "HitLFWheel" ) then { _skip = false; _part = "PartWheel"; };
  442. if( _skip and _x == "HitRFWheel" ) then { _skip = false; _part = "PartWheel"; };
  443. if( _skip and _x == "HitLBWheel" ) then { _skip = false; _part = "PartWheel"; };
  444. if( _skip and _x == "HitRBWheel" ) then { _skip = false; _part = "PartWheel"; };
  445. if( _skip and _x == "HitGlass1" ) then { _skip = false; _part = "PartGlass"; };
  446. if( _skip and _x == "HitGlass2" ) then { _skip = false; _part = "PartGlass"; };
  447. if( _skip and _x == "HitGlass3" ) then { _skip = false; _part = "PartGlass"; };
  448. if( _skip and _x == "HitGlass4" ) then { _skip = false; _part = "PartGlass"; };
  449. if( _skip and _x == "HitGlass5" ) then { _skip = false; _part = "PartGlass"; };
  450. if( _skip and _x == "HitGlass6" ) then { _skip = false; _part = "PartGlass"; };
  451. if( _skip and _x == "HitHRotor" ) then { _skip = false; _part = "PartVRotor"; };
  452.  
  453. if (!_skip ) then {
  454. _string = format["<t color='#0096ff'>Remove%1</t>",_cmpt,_color]; //Remove - Part
  455. _handle = silver_myCursorTarget addAction [_string, "ss_remove.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
  456. s_player_removeActions set [count s_player_removeActions,_handle];
  457. };
  458. };
  459.  
  460. } forEach _hitpoints;
  461. };
  462. };
  463.  
  464.  
  465. //#### Gut fools ####
  466. if (!_isAlive and !_isZombie and !_isAnimal and !_isHarvested and _isMan and _hasKnife and _canDo) then {
  467. if (s_player_butcher_human < 0) then {
  468. s_player_butcher_human = player addAction [format["<t color='#42426F'>Gut Human%1</t>"], "fixes\gather_meat_human.sqf",cursorTarget, 3, true, true, "", ""];
  469. };
  470. } else {
  471. player removeAction s_player_butcher_human;
  472. s_player_butcher_human = -1;
  473. };
  474.  
  475.  
  476. /*
  477. if (_isMan and !_isAlive) then {
  478. if (s_player_dragbody < 0) then {
  479. s_player_dragbody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\drag_body.sqf",cursorTarget, 0, false, true, "",""];
  480. };
  481. } else {
  482. player removeAction s_player_dragbody;
  483. s_player_dragbody = -1;
  484. };
  485. */
  486. if (_isMan and !_isAlive and !_isZombie) then {
  487. if (s_player_studybody < 0) then {
  488. s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",cursorTarget, 0, false, true, "",""];
  489. };
  490. } else {
  491. player removeAction s_player_studybody;
  492. s_player_studybody = -1;
  493. };
  494.  
  495. //CLOTHES
  496. if (_isMan and !_isAlive and !_isZombie and !_isAnimal) then {
  497. if (s_clothes < 0) then {
  498. s_clothes = player addAction [("<t color=""#FF0000"">" + ("Take Clothes") + "</t>"), "fixes\clothes.sqf",cursorTarget, 1, false, true, "",""];
  499. };
  500. } else {
  501. player removeAction s_clothes;
  502. s_clothes = -1;
  503. };
  504.  
  505.  
  506. /*
  507. //Dog
  508. if (_isDog and _isAlive and (_hasRawMeat) and _canDo and _ownerID == "0" and player getVariable ["dogID", 0] == 0) then {
  509. if (s_player_tamedog < 0) then {
  510. s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", cursorTarget, 1, false, true, "", ""];
  511. };
  512. } else {
  513. player removeAction s_player_tamedog;
  514. s_player_tamedog = -1;
  515. };
  516.  
  517. if (_isDog and _ownerID == dayz_characterID and _isAlive and _canDo) then {
  518. _dogHandle = player getVariable ["dogID", 0];
  519. if (s_player_feeddog < 0 and _hasRawMeat) then {
  520. s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];
  521. };
  522. if (s_player_waterdog < 0 and "ItemWaterbottle" in magazines player) then {
  523. s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];
  524. };
  525. if (s_player_staydog < 0) then {
  526. _lieDown = _dogHandle getFSMVariable "_actionLieDown";
  527. if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
  528. s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];
  529. };
  530. if (s_player_trackdog < 0) then {
  531. s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];
  532. };
  533. if (s_player_barkdog < 0) then {
  534. s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", cursorTarget, 3, false, true,"",""];
  535. };
  536. if (s_player_warndog < 0) then {
  537. _warn = _dogHandle getFSMVariable "_watchDog";
  538. if (_warn) then { _text = "Quiet"; _warn = false; } else { _text = "Alert"; _warn = true; };
  539. s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];
  540. };
  541. if (s_player_followdog < 0) then {
  542. s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];
  543. };
  544. } else {
  545. player removeAction s_player_feeddog;
  546. s_player_feeddog = -1;
  547. player removeAction s_player_waterdog;
  548. s_player_waterdog = -1;
  549. player removeAction s_player_staydog;
  550. s_player_staydog = -1;
  551. player removeAction s_player_trackdog;
  552. s_player_trackdog = -1;
  553. player removeAction s_player_barkdog;
  554. s_player_barkdog = -1;
  555. player removeAction s_player_warndog;
  556. s_player_warndog = -1;
  557. player removeAction s_player_followdog;
  558. s_player_followdog = -1;
  559. };
  560. */
  561. } else {
  562. //Extras
  563. //Remove Parts
  564. {silver_myCursorTarget removeAction _x} forEach s_player_removeActions;s_player_removeActions = [];
  565. silver_myCursorTarget = objNull;
  566. //Gut Human
  567. player removeAction s_player_butcher_human;
  568. s_player_butcher_human = -1;
  569. // ### BASE BUILDING 1.2 ### For gates:
  570. // ### START ###
  571. {dayz_myCursorTarget removeAction _x} forEach s_player_gateActions;s_player_gateActions = [];
  572. dayz_myCursorTarget = objNull;
  573. // ### BASE BUILDING 1.2 ### For gates:
  574. // ### END ###
  575. //Engineering
  576. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  577. dayz_myCursorTarget = objNull;
  578. //Others
  579. player removeAction s_player_forceSave;
  580. s_player_forceSave = -1;
  581. player removeAction s_player_flipveh;
  582. s_player_flipveh = -1;
  583. player removeAction s_player_sleep;
  584. s_player_sleep = -1;
  585. player removeAction s_player_deleteBuild;
  586. s_player_deleteBuild = -1;
  587. // ### BASE BUILDING 1.2 ### Add in these:
  588. // ### START ###
  589. player removeAction s_player_codeRemove;
  590. s_player_codeRemove = -1;
  591. player removeAction s_player_forceSave;
  592. s_player_forceSave = -1;
  593. player removeAction s_player_disarmBomb;
  594. s_player_disarmBomb = -1;
  595. player removeAction s_player_codeObject;
  596. s_player_codeObject = -1;
  597. player removeAction s_player_enterCode;
  598. s_player_enterCode = -1;
  599. player removeAction s_player_smeltRecipes;
  600. s_player_smeltRecipes = -1;
  601. player removeAction s_player_smeltItems;
  602. s_player_smeltItems = -1;
  603. // ### BASE BUILDING 1.2 ### Add in these:
  604. // ### END ###
  605. player removeAction s_player_butcher;
  606. s_player_butcher = -1;
  607. player removeAction s_player_cook;
  608. s_player_cook = -1;
  609. player removeAction s_player_boil;
  610. s_player_boil = -1;
  611. player removeAction s_player_fireout;
  612. s_player_fireout = -1;
  613. player removeAction s_player_packtent;
  614. s_player_packtent = -1;
  615. player removeAction s_player_fillfuel;
  616. s_player_fillfuel = -1;
  617. player removeAction s_player_studybody;
  618. s_player_studybody = -1;
  619. player removeAction s_clothes;
  620. s_clothes = -1;
  621. /*
  622. //Drag Body
  623. player removeAction s_player_dragbody;
  624. s_player_dragbody = -1;
  625. */
  626. //fuel
  627. player removeAction s_player_fillfuel20;
  628. s_player_fillfuel20 = -1;
  629. player removeAction s_player_fillfuel5;
  630. s_player_fillfuel5 = -1;
  631.  
  632. //Dog
  633. //player removeAction s_player_tamedog;
  634. //s_player_tamedog = -1;
  635. player removeAction s_player_feeddog;
  636. s_player_feeddog = -1;
  637. player removeAction s_player_waterdog;
  638. s_player_waterdog = -1;
  639. player removeAction s_player_staydog;
  640. s_player_staydog = -1;
  641. player removeAction s_player_trackdog;
  642. s_player_trackdog = -1;
  643. player removeAction s_player_barkdog;
  644. s_player_barkdog = -1;
  645. player removeAction s_player_warndog;
  646. s_player_warndog = -1;
  647. player removeAction s_player_followdog;
  648. s_player_followdog = -1;
  649. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement