mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
#1785 - Handle option for all "deploy" actions
This commit is contained in:
parent
c5a371e9b6
commit
5bcc867bac
@ -51,8 +51,12 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
||||
|
||||
[_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus);
|
||||
|
||||
[{[localize LSTRING(PlaceAction), ""] call EFUNC(interaction,showMouseHint)}, []] call EFUNC(common,execNextFrame);
|
||||
_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)];
|
||||
[{ //wait a frame to handle "Do When releasing action menu key"
|
||||
PARAMS_1(_unit);
|
||||
if (GVAR(placeAction) != PLACE_WAITING) exitWith {};
|
||||
[localize LSTRING(PlaceAction), ""] call EFUNC(interaction,showMouseHint);
|
||||
_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)];
|
||||
}, [_unit]] call EFUNC(common,execNextFrame);
|
||||
|
||||
_actionID = _unit addAction [format ["<t color='#FF0000'>%1</t>", localize LSTRING(CancelAction)], {GVAR(placeAction) = PLACE_CANCEL}];
|
||||
|
||||
@ -71,7 +75,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
||||
private["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL", "_lineInterection"];
|
||||
|
||||
PARAMS_2(_args,_pfID);
|
||||
EXPLODE_7_PVT(_args,_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAtachText,_actionID,_startDiagTime);
|
||||
EXPLODE_6_PVT(_args,_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAtachText,_actionID);
|
||||
|
||||
_virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]);
|
||||
if (cameraView == "EXTERNAL") then {
|
||||
@ -80,10 +84,8 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
||||
_virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition);
|
||||
_lineInterection = lineIntersects [eyePos ACE_player, _virtualPosASL, ACE_player];
|
||||
|
||||
//Don't allow placing in a bad position or placing right away (click to interact option)
|
||||
if ((GVAR(placeAction) == PLACE_APPROVE) && {_lineInterection || {ACE_diagTime < (_startDiagTime + 0.333)}}) then {
|
||||
GVAR(placeAction) = PLACE_WAITING;
|
||||
};
|
||||
//Don't allow placing in a bad position:
|
||||
if (_lineInterection && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;};
|
||||
|
||||
if ((GVAR(placeAction) != PLACE_WAITING) ||
|
||||
{_unit != ACE_player} ||
|
||||
@ -120,5 +122,5 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
||||
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModelDirAndUp [[1,0,0], _up];
|
||||
};
|
||||
};
|
||||
}, 0, [_unit, _attachToVehicle, _itemClassname, _itemVehClass, _onAtachText, _actionID, ACE_diagTime]] call CBA_fnc_addPerFrameHandler;
|
||||
}, 0, [_unit, _attachToVehicle, _itemClassname, _itemVehClass, _onAtachText, _actionID]] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
@ -37,7 +37,7 @@ deleteVehicle _wirecoil;
|
||||
_unit setVariable [QGVAR(wireDeployed), false];
|
||||
|
||||
GVAR(deployPFH) = [{
|
||||
EXPLODE_4_PVT(_this select 0,_wireNoGeo,_wireNoGeoPos,_unit,_action);
|
||||
EXPLODE_3_PVT(_this select 0,_wireNoGeo,_wireNoGeoPos,_unit);
|
||||
|
||||
private ["_range", "_posStart", "_posEnd", "_dirVect", "_dir", "_anim", "_wire"];
|
||||
_posStart = (_wireNoGeo modelToWorldVisual (_wireNoGeo selectionPosition "start")) call EFUNC(common,positionToASL);
|
||||
@ -73,12 +73,13 @@ GVAR(deployPFH) = [{
|
||||
{
|
||||
_wireNoGeo animate [_x, _anim];
|
||||
} foreach WIRE_FAST;
|
||||
}, 0, [_wireNoGeo, _wireNoGeoPos, _unit, _action]] call CBA_fnc_addPerFrameHandler;
|
||||
}, 0, [_wireNoGeo, _wireNoGeoPos, _unit]] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
[localize "STR_ACE_ROLLWIRE", "", ""] call EFUNC(interaction,showMouseHint);
|
||||
|
||||
GVAR(placer) setVariable [QGVAR(Deploy),
|
||||
[GVAR(placer), "DefaultAction",
|
||||
{GVAR(deployPFH) != -1},
|
||||
{GVAR(placer) setVariable [QGVAR(wireDeployed), true]}
|
||||
] call EFUNC(common,AddActionEventHandler)];
|
||||
[{ //wait a frame to handle "Do When releasing action menu key" option
|
||||
GVAR(placer) setVariable [QGVAR(Deploy),
|
||||
[GVAR(placer), "DefaultAction",
|
||||
{GVAR(deployPFH) != -1},
|
||||
{GVAR(placer) setVariable [QGVAR(wireDeployed), true]}
|
||||
] call EFUNC(common,AddActionEventHandler)];
|
||||
}, _this] call EFUNC(common,execNextFrame);
|
||||
|
@ -34,14 +34,17 @@ GVAR(deployPFH) = [{
|
||||
|
||||
[localize LSTRING(ConfirmDeployment), localize LSTRING(CancelDeployment), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint);
|
||||
|
||||
GVAR(placer) setVariable [QGVAR(Deploy),
|
||||
[GVAR(placer), "DefaultAction",
|
||||
{GVAR(deployPFH) != -1 && !isNull (GVAR(sandBag))},
|
||||
{call FUNC(deployConfirm);}
|
||||
] call EFUNC(common,AddActionEventHandler)];
|
||||
[{ //wait a frame to handle "Do When releasing action menu key" option
|
||||
GVAR(placer) setVariable [QGVAR(Deploy),
|
||||
[GVAR(placer), "DefaultAction",
|
||||
{GVAR(deployPFH) != -1 && !isNull (GVAR(sandBag))},
|
||||
{call FUNC(deployConfirm);}
|
||||
] call EFUNC(common,AddActionEventHandler)];
|
||||
|
||||
GVAR(placer) setVariable [QGVAR(Cancel),
|
||||
[GVAR(placer), "zoomtemp",
|
||||
{GVAR(deployPFH) != -1 && !isNull (GVAR(sandBag))},
|
||||
{call FUNC(deployCancel);}
|
||||
] call EFUNC(common,AddActionEventHandler)];
|
||||
GVAR(placer) setVariable [QGVAR(Cancel),
|
||||
[GVAR(placer), "zoomtemp",
|
||||
{GVAR(deployPFH) != -1 && !isNull (GVAR(sandBag))},
|
||||
{call FUNC(deployCancel);}
|
||||
] call EFUNC(common,AddActionEventHandler)];
|
||||
|
||||
}, _this] call EFUNC(common,execNextFrame);
|
||||
|
@ -39,14 +39,17 @@ GVAR(currentAngle) = 0;
|
||||
|
||||
[localize LSTRING(Deploy), localize LSTRING(Drop), localize LSTRING(Adjust)] call EFUNC(interaction,showMouseHint);
|
||||
|
||||
ACE_player setVariable [QGVAR(Deploy),
|
||||
[ACE_player, "DefaultAction",
|
||||
{!isNull GVAR(ladder)},
|
||||
{GVAR(ladder) call FUNC(confirmTLdeploy);}
|
||||
] call EFUNC(common,AddActionEventHandler)];
|
||||
[{ //wait a frame to handle "Do When releasing action menu key" option
|
||||
ACE_player setVariable [QGVAR(Deploy),
|
||||
[ACE_player, "DefaultAction",
|
||||
{!isNull GVAR(ladder)},
|
||||
{GVAR(ladder) call FUNC(confirmTLdeploy);}
|
||||
] call EFUNC(common,AddActionEventHandler)];
|
||||
|
||||
ACE_player setVariable [QGVAR(Cancel),
|
||||
[ACE_player, "zoomtemp",
|
||||
{!isNull GVAR(ladder)},
|
||||
{GVAR(ladder) call FUNC(cancelTLdeploy);}
|
||||
] call EFUNC(common,AddActionEventHandler)];
|
||||
ACE_player setVariable [QGVAR(Cancel),
|
||||
[ACE_player, "zoomtemp",
|
||||
{!isNull GVAR(ladder)},
|
||||
{GVAR(ladder) call FUNC(cancelTLdeploy);}
|
||||
] call EFUNC(common,AddActionEventHandler)];
|
||||
|
||||
}, _this] call EFUNC(common,execNextFrame);
|
||||
|
@ -36,8 +36,11 @@ GVAR(adjustPFH) = [{
|
||||
|
||||
[localize "STR_ACE_Tripod_Done", "", localize "STR_ACE_Tripod_ScrollAction"] call EFUNC(interaction,showMouseHint);
|
||||
|
||||
ACE_player setVariable [QGVAR(Adjust),
|
||||
[ACE_player, "DefaultAction",
|
||||
{GVAR(adjustPFH) != -1 && GVAR(adjusting)},
|
||||
{GVAR(adjusting) = false;}
|
||||
] call EFUNC(common,AddActionEventHandler)];
|
||||
[{ //wait a frame to handle "Do When releasing action menu key" option
|
||||
if (!GVAR(adjusting)) exitWith {ERROR("Not Adjusting");};
|
||||
ACE_player setVariable [QGVAR(Adjust),
|
||||
[ACE_player, "DefaultAction",
|
||||
{GVAR(adjustPFH) != -1 && GVAR(adjusting)},
|
||||
{GVAR(adjusting) = false;}
|
||||
] call EFUNC(common,AddActionEventHandler)];
|
||||
}, _this] call EFUNC(common,execNextFrame);
|
||||
|
Loading…
Reference in New Issue
Block a user