Advertisement
Guest User

Untitled

a guest
Feb 19th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. private ["_part","_cancel","_color","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints","_damagePercent","_configVeh","_x"];
  2.  
  3.  
  4. _vehicle = cursorTarget;
  5. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  6. dayz_myCursorTarget = _vehicle;
  7.  
  8. _isInvalid = (cursorTarget isKindOf "Old_bike_TK_INS_EP1" || cursorTarget isKindOf "Old_bike_TK_CIV_EP1");
  9.  
  10. if (!_isInvalid) then {
  11. _hitpoints = _vehicle call vehicle_getHitpoints;
  12.  
  13. {
  14. _damage = [_vehicle,_x] call object_getHit;
  15. _part = "PartGeneric";
  16.  
  17. _cmpt = toArray (_x);
  18. _cmpt set [0,20];
  19. _cmpt set [1,toArray ("-") select 0];
  20. _cmpt set [2,20];
  21. _cmpt = toString _cmpt;
  22.  
  23. _skip = true;
  24.  
  25. //restrict what parts can be taken off the vehicle
  26. if( _skip and _x == "HitLFWheel" ) then {
  27. _skip = false; _part = "PartWheel";
  28. };
  29.  
  30. if( _skip and _x == "HitRFWheel" ) then{
  31. _skip = false; _part = "PartWheel";
  32. };
  33.  
  34. if( _skip and _x == "HitLBWheel" ) then {
  35. _skip = false; _part = "PartWheel";
  36. };
  37.  
  38. if( _skip and _x == "HitRBWheel" ) then {
  39. _skip = false; _part = "PartWheel";
  40. };
  41.  
  42. if( _skip and _x == "HitGlass1" ) then {
  43. _skip = false; _part = "PartGlass";
  44. };
  45.  
  46. if( _skip and _x == "HitGlass2" ) then {
  47. _skip = false; _part = "PartGlass";
  48. };
  49.  
  50. if( _skip and _x == "HitGlass3" ) then {
  51. _skip = false; _part = "PartGlass";
  52. };
  53.  
  54. if( _skip and _x == "HitGlass4" ) then {
  55. _skip = false; _part = "PartGlass";
  56. };
  57.  
  58. if( _skip and _x == "HitGlass5" ) then {
  59. _skip = false; _part = "PartGlass";
  60. };
  61.  
  62. if( _skip and _x == "HitGlass6" ) then {
  63. _skip = false; _part = "PartGlass";
  64. };
  65.  
  66. if( _skip and _x == "HitHRotor" ) then {
  67. _skip = false; _part = "PartVRotor";
  68. };
  69.  
  70. if( _skip and _x == "HitEngine" ) then {
  71. _skip = false; _part = "PartEngine";
  72. };
  73.  
  74. if( _skip and _x == "HitFueltank" ) then {
  75. _skip = false; _part = "PartFueltank";
  76. };
  77.  
  78.  
  79. if (!_skip ) then {
  80. //get every damaged part no matter how tiny damage is!
  81. _damagePercent = str(round((1 - _damage) * 100))+"%";
  82. if (_damage < 0.11) then { //allow only parts < 10% damage to be salvaged
  83. _color = "color='#ffff00'"; //yellow
  84. _string = format[localize "str_actions_repair_01",_cmpt,_damagePercent];
  85. _string = format["<t %1>%2</t>",_color,_string,_damage]; //Remove - Part
  86. _handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\salvage.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
  87. s_player_repairActions set [count s_player_repairActions,_handle];
  88. };
  89. };
  90.  
  91. } forEach _hitpoints;
  92.  
  93. if (count _hitpoints > 0 ) then {
  94. _cancel = dayz_myCursorTarget addAction [localize "str_actions_cancel", "\z\addons\dayz_code\actions\salvage_cancel.sqf","salvage", 0, true, false, "",""];
  95. s_player_repairActions set [count s_player_repairActions,_cancel];
  96. s_player_repair_crtl = 1;
  97. };
  98. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement