Skip to content

Instantly share code, notes, and snippets.

@jameslkingsley
Created July 12, 2016 18:23
Show Gist options
  • Save jameslkingsley/ebddcd7315d98780dda9973b64685371 to your computer and use it in GitHub Desktop.
Save jameslkingsley/ebddcd7315d98780dda9973b64685371 to your computer and use it in GitHub Desktop.
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;
_caller addAction ["Detach", {
params ["_target", "_caller", "_id", "_args"];
_args params ["_object", "_pfhHandle"];
_target removeAction _id;
{detach _x} forEach attachedObjects _target;
_target setVariable ["ARC_isDragging", false];
[_pfhHandle] call CBA_fnc_removePerFrameHandler;
_object call ARC_basebuilder_addObjectAction;
}, [_target, _handle]];
}, 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