Created
July 12, 2016 19:06
-
-
Save jameslkingsley/61812977d7cec5e09414bd89fbb97002 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private _objects = ["Land_PillboxBunker_01_rectangle_F", "Land_PillboxBunker_01_big_F", "Land_PillboxBunker_01_hex_F"]; | |
ARC_basebuilder_addObjectAction = { | |
_this addAction ["Pick up fort", { | |
params ["_target", "_caller", "_id"]; | |
_target removeAction _id; | |
private _handle = [{ | |
params ["_args", "_handle"]; | |
_args params ["_target", "_caller"]; | |
private _start = positionCameraToWorld [0,0,0]; | |
private _end = (_start vectorAdd (getCameraViewDirection _caller vectorMultiply 10)); | |
player setVariable ["ARC_isDragging", true]; | |
_target attachTo [_caller, _caller worldToModel _end, "Pelvis"]; | |
}, 0, _this] call CBA_fnc_addPerFrameHandler; | |
player setVariable ["ARC_objectBeingDragged", _target]; | |
private _directionHandler = ["KeyDown", { | |
params ["_display", "_dik", "_shift", "_ctrl", "_alt"]; | |
// Q = 16, E = 18 | |
if !(_dik in [16, 18]) exitWith {}; | |
private _object = player getVariable ["ARC_objectBeingDragged", objNull]; | |
if (!isNull _object) then { | |
private _direction = getDir _object; | |
private _modifier = 0.1 * ([1, -1] select (_dik == 16)); | |
private _newDir = _direction + _modifier; | |
_object setDir _newDir; | |
}; | |
true | |
}] call CBA_fnc_addDisplayHandler; | |
_caller addAction ["Detach", { | |
params ["_target", "_caller", "_id", "_args"]; | |
_args params ["_object", "_pfhHandle", "_directionHandler"]; | |
_target removeAction _id; | |
{detach _x} forEach attachedObjects _target; | |
_target setVariable ["ARC_isDragging", false]; | |
[_pfhHandle] call CBA_fnc_removePerFrameHandler; | |
["KeyDown", _directionHandler] call CBA_fnc_removeDisplayHandler; | |
_object call ARC_basebuilder_addObjectAction; | |
}, [_target, _handle, _directionHandler]]; | |
}, nil, 1.5, true, true, "", "!(player getVariable ['ARC_isDragging', false])"]; | |
}; | |
{ | |
{ | |
_x call ARC_basebuilder_addObjectAction; | |
} forEach (allMissionObjects _x); | |
} forEach _objects; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment