player2_dz

Untitled

Aug 3rd, 2014
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. private ["_vehicle","_part","_hitpoint","_type","_selection","_array"];
  2. disableSerialization;
  3.  
  4. _array = _this select 3;
  5. _vehicle = _array select 0;
  6. _hitpoints = _array select 1;
  7. _damage = damage _vehicle;
  8.  
  9. _type = typeOf _vehicle;
  10. _text = getText (missionConfigFile >> "CfgVehicles" >> _type >> "displayName");
  11.  
  12. //Engineering
  13. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  14. dayz_myCursorTarget = objNull;
  15.  
  16. createDialog "RscDisplayInspectVehicle";
  17.  
  18. _ctrlTitle = ((uiNamespace getVariable 'ZombZ_vehicleInspect') displayCtrl 6661);
  19. if (P2DZE_deugVehIns) then {
  20. diag_log(format["P2DEBUG: ctrl 6661: %2 VehInspect: Vehicle Inspection: %1", _text, _ctrlTitle]);
  21. diag_log(format["P2DEBUG: ctrl 6665: %3 General Vehicle Health: %1%2", _damageOverallPercent, '%',_ctrlOverall]);
  22. diag_log(format["P2DEBUG: ctrl 6663: %1 img\inspection_skoda_outer.paa",_ctrlVehicleOut]);
  23. diag_log(format["P2DEBUG: ctrl 6664: %1 img\inspection_skoda_inner.paa",_ctrlVehicleIn]);
  24. diag_log(format["P2DEBUG: ctrl 6662: ",_ctrlText]);
  25. };
  26.  
  27. _ctrlTitle ctrlSetText format["Vehicle Inspection: %1", _text];
  28.  
  29. _damageOverallPercent = round((1 - _damage) * 100);
  30. _ctrlOverall = ((uiNamespace getVariable 'ZombZ_vehicleInspect') displayCtrl 6665);
  31. _ctrlOverall ctrlSetText format["General Vehicle Health: %1%2", _damageOverallPercent, '%'];
  32.  
  33. _ctrlVehicleOut = ((uiNamespace getVariable 'ZombZ_vehicleInspect') displayCtrl 6663);
  34. _ctrlVehicleOut ctrlSetText "img\inspection_skoda_outer.paa";
  35.  
  36. _ctrlVehicleIn = ((uiNamespace getVariable 'ZombZ_vehicleInspect') displayCtrl 6664);
  37. _ctrlVehicleIn ctrlSetText "img\inspection_skoda_inner.paa";
  38.  
  39. if (_damage > 0.6) then {
  40. _ctrlVehicleIn ctrlSetTextColor [0.565, 0.000, 0.000, 1]; // Red
  41. } else {
  42. if (_damage > 0.3) then {
  43. _ctrlVehicleIn ctrlSetTextColor [0.654, 0.557, 0.169, 1]; // Yellow
  44. } else {
  45. _ctrlVehicleIn ctrlSetTextColor [0.254, 0.635, 0.121, 1]; // Green
  46. };
  47. };
  48.  
  49. _ctrlText = ((uiNamespace getVariable 'ZombZ_vehicleInspect') displayCtrl 6662);
  50.  
  51. //diag_log(format["PARTS FOR: %1", _text]);
  52.  
  53. _repairText = "";
  54. {
  55. _damage = [_vehicle,_x] call object_getHit;
  56. _damagePercent = round((1 - _damage) * 100);
  57.  
  58. _fullPartName = toArray _x;
  59. _humanPartName = [];
  60. for "_i" from 3 to ((count _fullPartName) - 1) do {_humanPartName set [count _humanPartName,(_fullPartName select _i)]};
  61.  
  62. _humanPartNameString = toString _humanPartName;
  63.  
  64. if (["HRotor",_x,false] call fnc_inString) then {
  65. _humanPartNameString = "Main Rotor Assembly";
  66. };
  67.  
  68. if (["VRotor",_x,false] call fnc_inString) then {
  69. _humanPartNameString = "Rear Rotor Assembly";
  70. };
  71.  
  72. if (["Wheel",_x,false] call fnc_inString) then {
  73. _partNoWheel = [];
  74. for "_i" from 0 to ((count _humanPartName) - 6) do {_partNoWheel set [count _partNoWheel,(_humanPartName select _i)]};
  75. _partNoWheelString = toString _partNoWheel;
  76.  
  77. _partNoWheelString = switch (_partNoWheelString) do {
  78. default {_partNoWheelString};
  79. case "LF": {"Left Front"};
  80. case "RF": {"Right Front"};
  81. case "LF2": {"Left Front 2nd"};
  82. case "RF2": {"Right Front 2nd"};
  83. case "LB": {"Left Back"};
  84. case "RB": {"Right Back"};
  85. case "LM": {"Left Middle"};
  86. case "RM": {"Right Middle"};
  87. case "F": {"Front"};
  88. case "B": {"Back"};
  89. };
  90.  
  91. _humanPartNameString = format["%1 Wheel", _partNoWheelString];
  92. };
  93.  
  94. if ( _damagePercent < 100 ) then {
  95. _tmpText = format["%1%2%3 %4\n", _repairText, _damagePercent, '%', _humanPartNameString];
  96. _repairText = _tmpText;
  97. };
  98. //diag_log(format["PART: %1", _x]);
  99.  
  100. } forEach _hitpoints;
  101.  
  102. _ctrlText ctrlSetText _repairText;
Advertisement
Add Comment
Please, Sign In to add comment