Advertisement
Guest User

Untitled

a guest
Aug 31st, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. private _objects = [
  2. "Land_fort_bagfence_round",
  3. "Land_fort_rampart",
  4. "Land_fort_rampart_EP1",
  5. "Land_fortified_nest_small",
  6. "Land_fortified_nest_small_EP1",
  7. "Land_Fort_Watchtower",
  8. "Land_Fort_Watchtower_EP1",
  9. "Land_fortified_nest_big_EP1",
  10. "Land_fortified_nest_big",
  11. "Land_HBarrier_5_F",
  12. "Land_HBarrier_3_F",
  13. "Land_HBarrier_1_F",
  14. "Land_BagBunker_01_small_green_F",
  15. "Land_BagBunker_Large_F",
  16. "Land_BagBunker_Small_F",
  17. "Land_BagBunker_Tower_F",
  18. "Land_HBarrier_01_line_5_green_F",
  19. "Land_HBarrier_01_line_3_green_F",
  20. "Land_HBarrier_01_line_1_green_F",
  21. "Fort_Razorwire",
  22. "Land_CncBlock",
  23. "Land_fort_bagfence_corner",
  24. "Land_BagFenceShort",
  25. "Land_BagFenceLong",
  26. "Land_BagFenceRound",
  27. "Land_CncBlock_stripes",
  28. "Land_CncBlock_stripes_f"
  29. ];
  30.  
  31. ARC_basebuilder_addObjectAction = {
  32. _this addAction ["Pick up", {
  33. params ["_target", "_caller", "_id"];
  34.  
  35. _target removeAction _id;
  36.  
  37. private _handle = [{
  38. params ["_args", "_handle"];
  39. _args params ["_target", "_caller"];
  40.  
  41. private _start = positionCameraToWorld [0,0,0];
  42. private _end = (_start vectorAdd (getCameraViewDirection _caller vectorMultiply 8));
  43. player setVariable ["ARC_isDragging", true];
  44.  
  45. _target attachTo [_caller, _caller worldToModel _end, "Pelvis"];
  46. }, 0, _this] call CBA_fnc_addPerFrameHandler;
  47.  
  48. player setVariable ["ARC_objectBeingDragged", _target];
  49.  
  50. private _directionHandler = ["KeyDown", {
  51. params ["_display", "_dik", "_shift", "_ctrl", "_alt"];
  52.  
  53. // Q = 16, E = 18
  54.  
  55. if !(_dik in [16, 18]) exitWith {};
  56.  
  57. private _object = player getVariable ["ARC_objectBeingDragged", objNull];
  58.  
  59. if (!isNull _object) then {
  60. private _direction = getDir _object;
  61. private _modifier = 0.1 * ([1, -1] select (_dik == 16));
  62. private _newDir = _direction + _modifier;
  63.  
  64. _object setDir _newDir;
  65. };
  66.  
  67. true
  68. }] call CBA_fnc_addDisplayHandler;
  69.  
  70. _caller addAction ["Detach", {
  71. params ["_target", "_caller", "_id", "_args"];
  72. _args params ["_object", "_pfhHandle", "_directionHandler"];
  73.  
  74. _target removeAction _id;
  75.  
  76. {detach _x} forEach attachedObjects _target;
  77.  
  78. _target setVariable ["ARC_isDragging", false];
  79.  
  80. [_pfhHandle] call CBA_fnc_removePerFrameHandler;
  81. ["KeyDown", _directionHandler] call CBA_fnc_removeDisplayHandler;
  82.  
  83. _object call ARC_basebuilder_addObjectAction;
  84. }, [_target, _handle, _directionHandler]];
  85. }, nil, 1.5, true, true, "", "!(player getVariable ['ARC_isDragging', false])"];
  86. };
  87.  
  88. {
  89. {
  90. _x call ARC_basebuilder_addObjectAction;
  91. } forEach (allMissionObjects _x);
  92. } forEach _objects;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement