Guest User

Untitled

a guest
Jan 24th, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. private ["_menuDef", "_target", "_params", "_menuName", "_menuRsc", "_menus"];
  2. private ["_vehicle", "_displayNameVehicle","_exit"];
  3. private ["_canDrag"];
  4. // _this==[_target, _menuNameOrParams]
  5. _target = _this select 0;
  6. _params = _this select 1;
  7.  
  8. _menuName = "";
  9. _menuRsc = "popup";
  10.  
  11. if (typeName _params == typeName []) then {
  12. if (count _params < 1) exitWith {diag_log format["Error: Invalid params: %1, %2", _this, __FILE__];};
  13. _menuName = _params select 0;
  14. _menuRsc = if (count _params > 1) then {_params select 1} else {_menuRsc};
  15. } else {
  16. _menuName = _params;
  17. };
  18.  
  19. _pickedup = _target getVariable "sam_suav_pickedup";
  20. if (isnil ("_pickedup")) then {_target setVariable ["sam_suav_pickedup",0, false];};
  21. _upfalse = (_target getVariable "sam_suav_pickedup") == 0;
  22. _uptrue = (_target getVariable "sam_suav_pickedup") != 0;
  23.  
  24. _battery = "Laserbatteries" in (magazines player);
  25. _camera = ("sam_falken_ti_camera" in (magazines player)) and ((typeOf _target) == "sam_falken_ccd") or ("sam_falken_ccd_camera" in (magazines player)) and ((typeOf _target) == "sam_falken_ti");
  26.  
  27. _array = _target getVariable "sam_suav";
  28.  
  29. _batterystatus = (_array select 0) != 0;
  30.  
  31. _recovertrue = (_array select 1) != 0;
  32.  
  33. _connected = !(isNull (_array select 2));
  34.  
  35. _backpack = [player] call ACE_fnc_FindRuck;
  36.  
  37. //----------------------------------------------------------------------------------------
  38. _menus = [
  39. [
  40. ["main", "", _menuRsc],
  41. [
  42. ["Pick up",
  43. {null execVM 'test_move.sqf'},
  44. "", "", "", -1, 1, _upfalse],
  45. ["Drop",
  46. {null execVM 'test_drop.sqf'},
  47. "", "", "", -1, 1, _uptrue],
  48. ["Launch",
  49. {null execVM 'test_launch.sqf'},
  50. "", "", "", -1, 1, _uptrue && _batterystatus && !_recovertrue && _connected],
  51. ["Change Battery",
  52. {null execVM 'test_battery.sqf'},
  53. "", "", "", -1, 1, _battery && _upfalse],
  54. ["Change Camera",
  55. {null execVM 'test_camera.sqf'},
  56. "", "", "", -1, 1, _camera && _upfalse],
  57. ["Recover",
  58. {null execVM 'test_reset.sqf'},
  59. "", "", "", -1, 1, _recovertrue && _upfalse],
  60. ["Put in backpack",
  61. {null execVM 'test_pack.sqf'},
  62. "", "", "", -1, 1, !_recovertrue && _upfalse && _backpack == "ACE_Backpack_US"]
  63. ]
  64. ]
  65. ];
  66.  
  67. //-----------------------------------------------------------------------------
  68. _menuDef = [];
  69. {
  70. if (_x select 0 select 0 == _menuName) exitWith {_menuDef = _x};
  71. } forEach _menus;
  72.  
  73. if (count _menuDef == 0) then {
  74. hintC format ["Error: Menu not found: %1\n%2\n%3", str _menuName, if (_menuName == "") then {_this} else {""}, __FILE__];
  75. diag_log format ["Error: Menu not found: %1, %2, %3", str _menuName, _this, __FILE__];
  76. };
  77.  
  78. _menuDef // return value
Add Comment
Please, Sign In to add comment