From 2fe142032e30f69269168f67a67918e8d2dcafae Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 26 Sep 2015 03:16:55 +0200 Subject: [PATCH] rework modifier key, cleanup sandbags, tripod, ladder, fix #2590 --- addons/common/XEH_postInit.sqf | 30 +++++++-- addons/common/XEH_preInit.sqf | 4 ++ addons/common/functions/fnc_getHitPoints.sqf | 10 ++- .../fnc_getHitPointsWithSelections.sqf | 5 ++ .../functions/fnc_getVehicleUAVCrew.sqf | 17 +++++ .../functions/fnc_handleModifierKey.sqf | 17 +++++ .../functions/fnc_handleModifierKeyInit.sqf | 16 +++++ .../functions/fnc_handleModifierKeyUp.sqf | 17 +++++ addons/dragging/CfgEventHandlers.hpp | 3 +- .../{XEH_clientInit.sqf => XEH_postInit.sqf} | 17 +++-- addons/dragging/XEH_serverInit.sqf | 5 -- addons/dragging/functions/fnc_canCarry.sqf | 4 +- addons/dragging/functions/fnc_canDrag.sqf | 4 +- addons/dragging/functions/fnc_carryObject.sqf | 37 +++++------ addons/dragging/functions/fnc_dragObject.sqf | 37 ++++++----- addons/dragging/functions/fnc_dropObject.sqf | 12 +++- .../functions/fnc_dropObject_carry.sqf | 12 +++- .../functions/fnc_handleScrollWheel.sqf | 7 +-- addons/dragging/stringtable.xml | 4 ++ addons/explosives/stringtable.xml | 20 +++--- addons/interaction/Menu_Config.hpp | 2 +- addons/interaction/XEH_postInit.sqf | 17 ----- .../functions/fnc_hideMouseHint.sqf | 3 +- .../functions/fnc_showMouseHint.sqf | 20 +++--- addons/sandbag/CfgEventHandlers.hpp | 17 +++-- addons/sandbag/CfgVehicles.hpp | 39 +++++------- addons/sandbag/XEH_postInit.sqf | 28 ++++++--- addons/sandbag/XEH_preInit.sqf | 7 ++- addons/sandbag/functions/fnc_canDeploy.sqf | 12 ++-- addons/sandbag/functions/fnc_carry.sqf | 56 ----------------- addons/sandbag/functions/fnc_deploy.sqf | 62 ++++++++++++------- addons/sandbag/functions/fnc_deployCancel.sqf | 29 ++++----- .../sandbag/functions/fnc_deployConfirm.sqf | 52 +++++++++------- addons/sandbag/functions/fnc_drop.sqf | 47 -------------- .../fnc_handleInteractMenuOpened.sqf | 19 ++++++ addons/sandbag/functions/fnc_handleKilled.sqf | 19 ++++++ .../functions/fnc_handlePlayerChanged.sqf | 24 +++++++ .../fnc_handlePlayerInventoryChanged.sqf | 22 +++++++ .../functions/fnc_handleUnconscious.sqf | 19 ++++++ addons/sandbag/functions/fnc_pickup.sqf | 21 ++++--- addons/sandbag/stringtable.xml | 20 +++--- addons/tacticalladder/CfgEventHandlers.hpp | 9 +++ addons/tacticalladder/CfgVehicles.hpp | 14 +++-- addons/tacticalladder/XEH_postInit.sqf | 21 +++++-- addons/tacticalladder/XEH_preInit.sqf | 4 ++ .../functions/fnc_cancelTLdeploy.sqf | 18 ++++-- .../functions/fnc_confirmTLdeploy.sqf | 27 +++++--- .../tacticalladder/functions/fnc_deployTL.sqf | 27 ++++---- .../fnc_handleInteractMenuOpened.sqf | 19 ++++++ .../functions/fnc_handleKilled.sqf | 19 ++++++ .../functions/fnc_handlePlayerChanged.sqf | 26 ++++++++ .../functions/fnc_handleScrollWheel.sqf | 2 +- .../functions/fnc_handleUnconscious.sqf | 19 ++++++ .../tacticalladder/functions/fnc_pickupTL.sqf | 13 ++-- .../functions/fnc_positionTL.sqf | 31 ++++++---- addons/tacticalladder/stringtable.xml | 11 +--- addons/tripod/CfgEventHandlers.hpp | 9 +++ addons/tripod/CfgVehicles.hpp | 30 ++++----- addons/tripod/XEH_postInit.sqf | 21 ++++--- addons/tripod/XEH_preInit.sqf | 4 ++ addons/tripod/functions/fnc_adjust.sqf | 32 +++++----- .../fnc_handleInteractMenuOpened.sqf | 19 ++++++ addons/tripod/functions/fnc_handleKilled.sqf | 19 ++++++ .../functions/fnc_handlePlayerChanged.sqf | 24 +++++++ .../functions/fnc_handleScrollWheel.sqf | 2 +- .../functions/fnc_handleUnconscious.sqf | 19 ++++++ addons/tripod/functions/fnc_pickup.sqf | 21 ++++--- addons/tripod/functions/fnc_place.sqf | 19 +++--- addons/tripod/stringtable.xml | 18 +++--- 69 files changed, 849 insertions(+), 461 deletions(-) create mode 100644 addons/common/functions/fnc_getVehicleUAVCrew.sqf create mode 100644 addons/common/functions/fnc_handleModifierKey.sqf create mode 100644 addons/common/functions/fnc_handleModifierKeyInit.sqf create mode 100644 addons/common/functions/fnc_handleModifierKeyUp.sqf rename addons/dragging/{XEH_clientInit.sqf => XEH_postInit.sqf} (50%) delete mode 100644 addons/dragging/XEH_serverInit.sqf delete mode 100644 addons/sandbag/functions/fnc_carry.sqf delete mode 100644 addons/sandbag/functions/fnc_drop.sqf create mode 100644 addons/sandbag/functions/fnc_handleInteractMenuOpened.sqf create mode 100644 addons/sandbag/functions/fnc_handleKilled.sqf create mode 100644 addons/sandbag/functions/fnc_handlePlayerChanged.sqf create mode 100644 addons/sandbag/functions/fnc_handlePlayerInventoryChanged.sqf create mode 100644 addons/sandbag/functions/fnc_handleUnconscious.sqf create mode 100644 addons/tacticalladder/functions/fnc_handleInteractMenuOpened.sqf create mode 100644 addons/tacticalladder/functions/fnc_handleKilled.sqf create mode 100644 addons/tacticalladder/functions/fnc_handlePlayerChanged.sqf create mode 100644 addons/tacticalladder/functions/fnc_handleUnconscious.sqf create mode 100644 addons/tripod/functions/fnc_handleInteractMenuOpened.sqf create mode 100644 addons/tripod/functions/fnc_handleKilled.sqf create mode 100644 addons/tripod/functions/fnc_handlePlayerChanged.sqf create mode 100644 addons/tripod/functions/fnc_handleUnconscious.sqf diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index e374a7a716..c7042c03db 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -86,6 +86,7 @@ if (isServer) then { ["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler); + ["enableSimulationGlobal", {(_this select 0) enableSimulationGlobal (_this select 1)}] call FUNC(addEventHandler); }; @@ -94,8 +95,8 @@ if (isServer) then { ////////////////////////////////////////////////// // ACE events -"ACEg" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); }; -"ACEc" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); }; +"ACEg" addPublicVariableEventHandler {_this call FUNC(_handleNetEvent)}; +"ACEc" addPublicVariableEventHandler {_this call FUNC(_handleNetEvent)}; // Synced ACE events // Handle JIP scenario @@ -219,8 +220,29 @@ call FUNC(assignedItemFix); GVAR(ScrollWheelFrame) = diag_frameno; -addMissionEventHandler ["Loaded", {call FUNC(handleScrollWheelInit)}]; -call FUNC(handleScrollWheelInit); +["mainDisplayLoaded", { + call FUNC(handleScrollWheelInit); + [{ + call FUNC(handleModifierKeyInit); + }, [], 0.1] call FUNC(waitAndExecute); // needs delay, otherwise doesn't work without pressing "RESTART" in editor once. Tested in 1.52RC +}] call FUNC(addEventHandler); + +// add PFH to execute event that fires when the main display (46) is created +private "_fnc_initMainDisplayCheck"; +_fnc_initMainDisplayCheck = { + [{ + if !(isNull findDisplay 46) then { + // Raise ACE event locally + ["mainDisplayLoaded", [findDisplay 46]] call FUNC(localEvent); + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + }, 0, []] call CBA_fnc_addPerFrameHandler; +}; + +call _fnc_initMainDisplayCheck; + +// repeat this every time a savegame is loaded +addMissionEventHandler ["Loaded", _fnc_initMainDisplayCheck]; // @todo remove? enableCamShake true; diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index a1f19aab8d..e422206134 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -91,6 +91,9 @@ PREP(getWindDirection); PREP(getZoom); PREP(goKneeling); PREP(hadamardProduct); +PREP(handleModifierKey); +PREP(handleModifierKeyUp); +PREP(handleModifierKeyInit); PREP(handleScrollWheel); PREP(handleScrollWheelInit); PREP(hasItem); @@ -204,6 +207,7 @@ PREP(getReflectorsWithSelections); PREP(getLightProperties); PREP(getLightPropertiesWeapon); PREP(getVehicleCrew); +PREP(getVehicleUAVCrew); // turrets PREP(getTurrets); diff --git a/addons/common/functions/fnc_getHitPoints.sqf b/addons/common/functions/fnc_getHitPoints.sqf index 6c0645007e..84099b659a 100644 --- a/addons/common/functions/fnc_getHitPoints.sqf +++ b/addons/common/functions/fnc_getHitPoints.sqf @@ -18,4 +18,12 @@ ACE_DEPRECATED("ace_common_fnc_getHitPoints","3.5.0","getAllHitPointsDamage"); params ["_vehicle"]; -(getAllHitPointsDamage _vehicle select 0) - [""] +private "_hitPointsWithSelections"; +_hitPointsWithSelections = getAllHitPointsDamage _vehicle; + +// get correct format on vehicles without any hitpoints +if (_hitPointsWithSelections isEqualTo []) then { + _hitPointsWithSelections = [[],[],[]]; +}; + +(_hitPointsWithSelections select 0) - [""] diff --git a/addons/common/functions/fnc_getHitPointsWithSelections.sqf b/addons/common/functions/fnc_getHitPointsWithSelections.sqf index 36475672b9..b0b9867cf7 100644 --- a/addons/common/functions/fnc_getHitPointsWithSelections.sqf +++ b/addons/common/functions/fnc_getHitPointsWithSelections.sqf @@ -22,6 +22,11 @@ params ["_vehicle"]; private "_hitPointsWithSelections"; _hitPointsWithSelections = getAllHitPointsDamage _vehicle; +// get correct format on vehicles without any hitpoints +if (_hitPointsWithSelections isEqualTo []) then { + _hitPointsWithSelections = [[],[],[]]; +}; + _hitPointsWithSelections resize 2; _hitPointsWithSelections diff --git a/addons/common/functions/fnc_getVehicleUAVCrew.sqf b/addons/common/functions/fnc_getVehicleUAVCrew.sqf new file mode 100644 index 0000000000..8d9156810a --- /dev/null +++ b/addons/common/functions/fnc_getVehicleUAVCrew.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Returns array of uav dummy ais. + * + * Arguments: + * 0: Vehicle + * + * Return Value: + * UAV Dummy Crew + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_vehicle"]; + +[crew _vehicle, {getText (configFile >> "CfgVehicles" >> typeOf _this >> "simulation") == "UAVPilot"}] call FUNC(filter) // return diff --git a/addons/common/functions/fnc_handleModifierKey.sqf b/addons/common/functions/fnc_handleModifierKey.sqf new file mode 100644 index 0000000000..bfb7e84931 --- /dev/null +++ b/addons/common/functions/fnc_handleModifierKey.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Handles key down event for modifier key. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public : No + */ +#include "script_component.hpp" + +if (_this select 3) then {ACE_modifier = 1}; + +false diff --git a/addons/common/functions/fnc_handleModifierKeyInit.sqf b/addons/common/functions/fnc_handleModifierKeyInit.sqf new file mode 100644 index 0000000000..a945f5eba1 --- /dev/null +++ b/addons/common/functions/fnc_handleModifierKeyInit.sqf @@ -0,0 +1,16 @@ +/* + * Author: commy2 + * Initializes the modifier key handler. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public : No + */ +#include "script_component.hpp" + +(findDisplay 46) displayAddEventHandler ["KeyDown", FUNC(handleModifierKey)]; +(findDisplay 46) displayAddEventHandler ["KeyUp", FUNC(handleModifierKeyUp)]; diff --git a/addons/common/functions/fnc_handleModifierKeyUp.sqf b/addons/common/functions/fnc_handleModifierKeyUp.sqf new file mode 100644 index 0000000000..ffa5855115 --- /dev/null +++ b/addons/common/functions/fnc_handleModifierKeyUp.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Handles key up event for modifier key. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public : No + */ +#include "script_component.hpp" + +ACE_modifier = 0; + +false diff --git a/addons/dragging/CfgEventHandlers.hpp b/addons/dragging/CfgEventHandlers.hpp index 2ff7d07c0d..7276bc4284 100644 --- a/addons/dragging/CfgEventHandlers.hpp +++ b/addons/dragging/CfgEventHandlers.hpp @@ -7,8 +7,7 @@ class Extended_PreInit_EventHandlers { class Extended_PostInit_EventHandlers { class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit)); - serverInit = QUOTE(call COMPILE_FILE(XEH_serverInit)); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; diff --git a/addons/dragging/XEH_clientInit.sqf b/addons/dragging/XEH_postInit.sqf similarity index 50% rename from addons/dragging/XEH_clientInit.sqf rename to addons/dragging/XEH_postInit.sqf index e80d63cfde..5a54f8c8a2 100644 --- a/addons/dragging/XEH_clientInit.sqf +++ b/addons/dragging/XEH_postInit.sqf @@ -1,7 +1,14 @@ // by PabstMirror, commy2 #include "script_component.hpp" -[DFUNC(handleScrollWheel)] call EFUNC(common,addScrollWheelEventHandler); +if (isServer) then { + // release object on hard disconnection. Function is identical to killed + addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleKilled)}]; +}; + +if (!hasInterface) exitWith {}; + +[{_this call FUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); if (isNil "ACE_maxWeightDrag") then { ACE_maxWeightDrag = 800; @@ -15,11 +22,11 @@ if (isNil "ACE_maxWeightCarry") then { ["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition); // release object on player change. This does work when returning to lobby, but not when hard disconnecting. -["playerChanged", DFUNC(handlePlayerChanged)] call EFUNC(common,addEventhandler); -["playerVehicleChanged", {[ACE_player, objNull] call DFUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["playerWeaponChanged", DFUNC(handlePlayerWeaponChanged)] call EFUNC(common,addEventhandler); +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["playerWeaponChanged", {_this call FUNC(handlePlayerWeaponChanged)}] call EFUNC(common,addEventhandler); // handle waking up dragged unit and falling unconscious while dragging -["medical_onUnconscious", DFUNC(handleUnconscious)] call EFUNC(common,addEventhandler); +["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); //@todo Captivity? diff --git a/addons/dragging/XEH_serverInit.sqf b/addons/dragging/XEH_serverInit.sqf deleted file mode 100644 index 01d78ef4e3..0000000000 --- a/addons/dragging/XEH_serverInit.sqf +++ /dev/null @@ -1,5 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -// release object on hard disconnection. Function is identical to killed -addMissionEventHandler ["HandleDisconnect", DFUNC(handleKilled)]; diff --git a/addons/dragging/functions/fnc_canCarry.sqf b/addons/dragging/functions/fnc_canCarry.sqf index a6b8fed5ab..6ee28edff3 100644 --- a/addons/dragging/functions/fnc_canCarry.sqf +++ b/addons/dragging/functions/fnc_canCarry.sqf @@ -18,7 +18,7 @@ params ["_unit", "_target"]; if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; -// a static weapon has to be empty for dragging -if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false}; +// a static weapon has to be empty for dragging (ignore UAV AI) +if (((typeOf _target) isKindOf "StaticWeapon") && {{(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"} count crew _target > 0}) exitWith {false}; alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canCarry), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})} diff --git a/addons/dragging/functions/fnc_canDrag.sqf b/addons/dragging/functions/fnc_canDrag.sqf index 4ab3562ba2..58c4718407 100644 --- a/addons/dragging/functions/fnc_canDrag.sqf +++ b/addons/dragging/functions/fnc_canDrag.sqf @@ -21,7 +21,7 @@ _target = _this select 1; if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; -// a static weapon has to be empty for dragging -if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false}; +// a static weapon has to be empty for dragging (ignore UAV AI) +if ((typeOf _target) isKindOf "StaticWeapon" && {{(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"} count crew _target > 0}) exitWith {false}; alive _target && {vehicle _target == _target} && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLegs") > 0.4})}; diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index 7f70b2bdc5..8bea72b907 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -17,7 +17,7 @@ params ["_unit", "_target"]; // get attachTo offset and direction. -private ["_position", "_direction"]; +private ["_position", "_direction", "_UAVCrew"]; _position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]]; _direction = _target getVariable [QGVAR(carryDirection), 0]; @@ -48,29 +48,26 @@ if (_target isKindOf "CAManBase") then { _unit setVariable [QGVAR(isCarrying), true, true]; _unit setVariable [QGVAR(carriedObject), _target, true]; -// add scrollwheel action to release object -private "_actionID"; -_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; +// add drop action +_unit setVariable [QGVAR(ReleaseActionID), [ + _unit, "DefaultAction", + {!isNull ((_this select 0) getVariable [QGVAR(carriedObject), objNull])}, + {[_this select 0, (_this select 0) getVariable [QGVAR(carriedObject), objNull]] call FUNC(dropObject_carry)} +] call EFUNC(common,addActionEventHandler)]; -if (_actionID != -1) then { - _unit removeAction _actionID; -}; - -_actionID = _unit addAction [ - format ["%1", localize LSTRING(Drop)], - QUOTE([ARR_2(_this select 0, (_this select 0) getVariable [ARR_2(QUOTE(QGVAR(carriedObject)),objNull)])] call FUNC(dropObject_carry)), - nil, - 20, - false, - true, - "", - QUOTE(!isNull (_this getVariable [ARR_2(QUOTE(QGVAR(carriedObject)),objNull)])) -]; - -_unit setVariable [QGVAR(ReleaseActionID), _actionID]; +// show mouse hint +[localize LSTRING(Drop), "", localize LSTRING(LowerRaise)] call EFUNC(interaction,showMouseHint); // check everything [FUNC(carryObjectPFH), 0.5, [_unit, _target]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; + +// prevent UAVs from firing +_UAVCrew = _target call EFUNC(common,getVehicleUAVCrew); + +if !(_UAVCrew isEqualTo []) then { + {_target deleteVehicleCrew _x} count _UAVCrew; + _target setVariable [QGVAR(isUAV), true, true]; +}; diff --git a/addons/dragging/functions/fnc_dragObject.sqf b/addons/dragging/functions/fnc_dragObject.sqf index d12a98213a..17fbc60c06 100644 --- a/addons/dragging/functions/fnc_dragObject.sqf +++ b/addons/dragging/functions/fnc_dragObject.sqf @@ -14,9 +14,10 @@ */ #include "script_component.hpp" -private ["_position", "_direction", "_offset", "_actionID"]; params ["_unit", "_target"]; +private ["_position", "_direction", "_offset", "_UAVCrew"]; + // get attachTo offset and direction. _position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]]; _direction = _target getVariable [QGVAR(dragDirection), 0]; @@ -37,28 +38,26 @@ if (_target isKindOf "CAManBase") then { _unit setVariable [QGVAR(isDragging), true, true]; _unit setVariable [QGVAR(draggedObject), _target, true]; -// add scrollwheel action to release object -_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; +// add drop action +_unit setVariable [QGVAR(ReleaseActionID), [ + _unit, "DefaultAction", + {!isNull ((_this select 0) getVariable [QGVAR(draggedObject), objNull])}, + {[_this select 0, (_this select 0) getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject)} +] call EFUNC(common,addActionEventHandler)]; -if (_actionID != -1) then { - _unit removeAction _actionID; -}; - -_actionID = _unit addAction [ - format ["%1", localize LSTRING(Drop)], - QUOTE([ARR_2(_this select 0, (_this select 0) getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)])] call FUNC(dropObject)), - nil, - 20, - false, - true, - "", - QUOTE(!isNull (_this getVariable [ARR_2(QUOTE(QGVAR(draggedObject)),objNull)])) -]; - -_unit setVariable [QGVAR(ReleaseActionID), _actionID]; +// show mouse hint +[localize LSTRING(Drop), ""] call EFUNC(interaction,showMouseHint); // check everything [FUNC(dragObjectPFH), 0.5, [_unit, _target]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; + +// prevent UAVs from firing +_UAVCrew = _target call EFUNC(common,getVehicleUAVCrew); + +if !(_UAVCrew isEqualTo []) then { + {_target deleteVehicleCrew _x} count _UAVCrew; + _target setVariable [QGVAR(isUAV), true, true]; +}; diff --git a/addons/dragging/functions/fnc_dropObject.sqf b/addons/dragging/functions/fnc_dropObject.sqf index 2ae07be091..9da1656b8b 100644 --- a/addons/dragging/functions/fnc_dropObject.sqf +++ b/addons/dragging/functions/fnc_dropObject.sqf @@ -16,8 +16,8 @@ params ["_unit", "_target"]; -// remove scroll wheel action -_unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]); +// remove drop action +[_unit, "DefaultAction", _unit getVariable [QGVAR(ReleaseActionID), -1]] call EFUNC(common,removeActionEventHandler); private "_inBuilding"; _inBuilding = [_unit] call FUNC(isObjectOnObject); @@ -49,6 +49,9 @@ if (_inBuilding) then { _target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]); }; +// hide mouse hint +[] call EFUNC(interaction,hideMouseHint); + _unit setVariable [QGVAR(isDragging), false, true]; _unit setVariable [QGVAR(draggedObject), objNull, true]; @@ -63,3 +66,8 @@ if !(_target isKindOf "CAManBase") then { if (_unit getvariable ["ACE_isUnconscious", false]) then { [_unit, "unconscious", 2, true] call EFUNC(common,doAnimation); }; + +// recreate UAV crew +if (_target getVariable [QGVAR(isUAV), false]) then { + createVehicleCrew _target; +}; diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index 86009ac867..300846bc6c 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -16,8 +16,8 @@ params ["_unit", "_target"]; -// remove scroll wheel action -_unit removeAction (_unit getVariable [QGVAR(ReleaseActionID), -1]); +// remove drop action +[_unit, "DefaultAction", _unit getVariable [QGVAR(ReleaseActionID), -1]] call EFUNC(common,removeActionEventHandler); private "_inBuilding"; _inBuilding = [_unit] call FUNC(isObjectOnObject); @@ -55,6 +55,9 @@ if (_inBuilding) then { _target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]); }; +// hide mouse hint +[] call EFUNC(interaction,hideMouseHint); + _unit setVariable [QGVAR(isCarrying), false, true]; _unit setVariable [QGVAR(carriedObject), objNull, true]; @@ -65,3 +68,8 @@ if !(_target isKindOf "CAManBase") then { ["fixPosition", _target, _target] call EFUNC(common,targetEvent); ["fixFloating", _target, _target] call EFUNC(common,targetEvent); }; + +// recreate UAV crew +if (_target getVariable [QGVAR(isUAV), false]) then { + createVehicleCrew _target; +}; diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index cd613316ec..73c42c2810 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -13,20 +13,15 @@ */ #include "script_component.hpp" -private ["_unit", "_carriedItem", "_position", "_maxHeight"]; - params ["_scrollAmount"]; -// requires modifier key to be hold down -if (missionNamespace getVariable ["ACE_Modifier", 0] == 0) exitWith {false}; +private ["_unit", "_carriedItem", "_position", "_maxHeight"]; _unit = ACE_player; // EH is always assigned. Exit and don't overwrite input if not carrying if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {false}; - - // move carried item 15 cm per scroll interval _scrollAmount = _scrollAmount * 0.15; diff --git a/addons/dragging/stringtable.xml b/addons/dragging/stringtable.xml index 35f9d6038d..42bd0ccd02 100644 --- a/addons/dragging/stringtable.xml +++ b/addons/dragging/stringtable.xml @@ -49,5 +49,9 @@ Trasporta Нести + + Raise/Lower + Heben/Senken + diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index a346d3b4be..f23cb2fc00 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -94,16 +94,16 @@ Отмена - + Modifier, rotates - + Modifikator, drehen - + Modificador, girar - + Modificateur, tourner - + Modificatore, rotazione - + Modifikátor, otočit - + Változtatás, forgatás - + Modyfikator, obrót - + Modificador, rotaciona - + Bращать + +Ctrl rotate + +Strg drehen + +Ctrl girar + +Ctrl tourner + +Ctrl rotazione + +Ctrl otočit + +Ctrl forgatás + +Ctrl obrót + +Ctrl rotaciona + +Ctrl Bращать Turn On Thor III diff --git a/addons/interaction/Menu_Config.hpp b/addons/interaction/Menu_Config.hpp index 8359ee560a..4788e47c0d 100644 --- a/addons/interaction/Menu_Config.hpp +++ b/addons/interaction/Menu_Config.hpp @@ -148,7 +148,7 @@ class RscInteractionHelperIcon: RscInteractionIcon { class RscInteractionText: RscText{ x = 21 * GUI_GRID_W; y = 16 * GUI_GRID_H; - w = 8 * GUI_GRID_W; + w = 24 * GUI_GRID_W; h = 1.5 * GUI_GRID_H; }; class RscTitles { diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 8d97803b1d..7ecf9a5f5c 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -64,22 +64,5 @@ private ["_team"]; {false}, [20, [true, false, false]], false] call cba_fnc_addKeybind; -["ACE3 Common", QGVAR(modifierKey), localize LSTRING(ModifierKey), -{ - // Conditions: canInteract - //if !([ACE_player, objNull, ["isNotDragging"]] call EFUNC(common,canInteractWith)) exitWith {false}; // not needed - - // Statement - ACE_Modifier = 1; - // Return false so it doesn't block other actions - false -}, -{ - //Probably don't want any condidtions here, so variable never gets locked down - ACE_Modifier = 0; - false; -}, -[29, [false, false, false]], false] call cba_fnc_addKeybind; - ["isNotSwimming", {!underwater (_this select 0)}] call EFUNC(common,addCanInteractWithCondition); ["isNotOnLadder", {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "ACE_isLadder") != 1}] call EFUNC(common,addCanInteractWithCondition); diff --git a/addons/interaction/functions/fnc_hideMouseHint.sqf b/addons/interaction/functions/fnc_hideMouseHint.sqf index 69acba25a2..39f43e7fa3 100644 --- a/addons/interaction/functions/fnc_hideMouseHint.sqf +++ b/addons/interaction/functions/fnc_hideMouseHint.sqf @@ -15,7 +15,8 @@ */ #include "script_component.hpp" -if (isNull (uiNamespace getVariable ["ACE_Helper_Display", objNull])) exitWith{}; +if (isNull (uiNamespace getVariable ["ACE_Helper_Display", objNull])) exitWith {}; (QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; + showHUD true; diff --git a/addons/interaction/functions/fnc_showMouseHint.sqf b/addons/interaction/functions/fnc_showMouseHint.sqf index e3a9b45f94..e8f279cc0c 100644 --- a/addons/interaction/functions/fnc_showMouseHint.sqf +++ b/addons/interaction/functions/fnc_showMouseHint.sqf @@ -20,18 +20,16 @@ #define GUI_GRID_W (0.025) #define GUI_GRID_H (0.04) -private ["_scroll", "_display"]; +params ["_leftClick", "_rightClick", ["_scroll", ""]]; -PARAMS_2(_leftClick,_rightClick); -_scroll = ""; -if (count _this > 2) then { - _scroll = _this select 2; -}; +(QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutRsc [QGVAR(InteractionHelper), "PLAIN", 0.5, false]; -(QGVAR(InteractionHelper) call BIS_fnc_rscLayer) cutRsc [QGVAR(InteractionHelper), "PLAIN",0.5, false]; disableSerialization; + +private "_display"; _display = uiNamespace getVariable ["ACE_Helper_Display", objNull]; -if (isNull _display) exitWith{}; + +if (isNull _display) exitWith {}; (_display displayCtrl 1000) ctrlSetText _leftClick; (_display displayCtrl 1001) ctrlSetText _rightClick; @@ -44,10 +42,12 @@ if (isNull _display) exitWith{}; if (_scroll == "") exitWith { (_display displayCtrl 1002) ctrlShow false; (_display displayCtrl 1202) ctrlShow false; - (_display displayCtrl 1001) ctrlSetPosition [21 * GUI_GRID_W, 18 * GUI_GRID_H, 8 * GUI_GRID_W, 1.5 * GUI_GRID_H]; - (_display displayCtrl 1201) ctrlSetPosition [20 * GUI_GRID_W, 18.5 * GUI_GRID_H, 1 * GUI_GRID_W, 1 * GUI_GRID_H]; + (_display displayCtrl 1001) ctrlSetPosition [21 * GUI_GRID_W, 18 * GUI_GRID_H, 24 * GUI_GRID_W, 1.5 * GUI_GRID_H]; + (_display displayCtrl 1201) ctrlSetPosition [20 * GUI_GRID_W, 18.5 * GUI_GRID_H, 1.5 * GUI_GRID_W, 1 * GUI_GRID_H]; (_display displayCtrl 1001) ctrlCommit 0; (_display displayCtrl 1201) ctrlCommit 0; }; + (_display displayCtrl 1002) ctrlSetText _scroll; + showHUD false; diff --git a/addons/sandbag/CfgEventHandlers.hpp b/addons/sandbag/CfgEventHandlers.hpp index 17911f6b1f..da53514f3b 100644 --- a/addons/sandbag/CfgEventHandlers.hpp +++ b/addons/sandbag/CfgEventHandlers.hpp @@ -1,19 +1,28 @@ + class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_postInit) ); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; class Extended_Init_EventHandlers { class ACE_SandbagObject { class ADDON { - init = QUOTE(_this call DEFUNC(dragging,initObject)); + init = QUOTE(_this call EFUNC(dragging,initObject)); }; }; -}; \ No newline at end of file +}; + +class Extended_Killed_EventHandlers { + class CAManBase { + class ADDON { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; diff --git a/addons/sandbag/CfgVehicles.hpp b/addons/sandbag/CfgVehicles.hpp index 5a9b530062..a2b255318e 100644 --- a/addons/sandbag/CfgVehicles.hpp +++ b/addons/sandbag/CfgVehicles.hpp @@ -1,14 +1,15 @@ + class CfgVehicles { class Man; class CAManBase: Man { class ACE_SelfActions { - class ACE_Sandbags { + class GVAR(place) { displayName = CSTRING(DeploySandbag); - condition = QUOTE(call FUNC(canDeploy)); - //wait a frame to handle "Do When releasing action menu key" option: - statement = QUOTE([ARR_2({_this call FUNC(deploy)}, [])] call EFUNC(common,execNextFrame)); + condition = QUOTE(_this call FUNC(canDeploy)); + //wait a frame to handle "Do When releasing action menu key" option + statement = QUOTE([ARR_2({_this call FUNC(deploy)},_this)] call EFUNC(common,execNextFrame)); exceptions[] = {"isNotSwimming"}; - showDisabled = 1; + showDisabled = 0; priority = 4; icon = PATHTOF(UI\icon_sandbag_ca.paa); }; @@ -26,8 +27,8 @@ class CfgVehicles { MACRO_ADDITEM(ACE_Sandbag_empty,1); }; }; - /* - class ACE_Item_Sandbag: Item_Base_F { + + /*class ACE_Item_Sandbag: Item_Base_F { author = ECSTRING(common,ACETeam); scope = 2; scopeCurator = 2; @@ -39,8 +40,8 @@ class CfgVehicles { count = 1; }; }; - }; - */ + };*/ + class thingX; class ACE_SandbagObject: thingX { author = ECSTRING(common,ACETeam); @@ -55,10 +56,10 @@ class CfgVehicles { nameSound = "Bunker"; icon = PATHTOF(UI\icon_sandbag_ca.paa); accuracy = 1000; - destrType = "DestructDefault"; class DestructionEffects {}; + class Damage { tex[] = {}; mat[] = { @@ -67,28 +68,19 @@ class CfgVehicles { "z\ace\addons\sandbag\data\bag_destruct.rvmat" }; }; + class ACE_Actions { class ACE_MainActions { selection = ""; distance = 5; condition = "true"; + class ACE_PickUp { selection = ""; displayName = CSTRING(PICKUPSB); distance = 4; - condition = QUOTE(!(_player getVariable [ARR_2('ace_sandbag_usingSandbag',false)])); - statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickup)); - showDisabled = 0; - exceptions[] = {}; - priority = 5; - icon = PATHTOF(UI\icon_sandbag_ca.paa); - }; - class ACE_Carry { - selection = ""; - displayName = CSTRING(CARRYSB); - distance = 4; - condition = QUOTE(!(_player getVariable [ARR_2('ace_sandbag_usingSandbag',false)])); - statement = QUOTE([ARR_2(_target,_player)] call FUNC(carry)); + condition = QUOTE(!(_player getVariable [ARR_2(QUOTE(QGVAR(isUsingSandbag)),false)])); + statement = QUOTE([ARR_2(_player,_target)] call FUNC(pickup)); showDisabled = 0; exceptions[] = {}; priority = 5; @@ -97,6 +89,7 @@ class CfgVehicles { }; }; }; + class ACE_SandbagObject_NoGeo: ACE_SandbagObject { scope = 1; model = PATHTOF(data\ace_sandbag_nogeo.p3d); diff --git a/addons/sandbag/XEH_postInit.sqf b/addons/sandbag/XEH_postInit.sqf index d1c0ad0766..c3f99c2a9b 100644 --- a/addons/sandbag/XEH_postInit.sqf +++ b/addons/sandbag/XEH_postInit.sqf @@ -1,15 +1,27 @@ #include "script_component.hpp" -GVAR(placer) = objNull; +if (isServer) then { + // Cancel deploy on hard disconnection. Function is identical to killed + addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleKilled)}]; +}; + +if (!hasInterface) exitWith {}; + GVAR(sandBag) = objNull; GVAR(deployPFH) = -1; GVAR(deployDirection) = 0; -// Cancel deploy sandbag if interact menu opened -["interactMenuOpened", { - if (GVAR(deployPFH) != -1 && {!isNull (GVAR(sandBag))}) then { - call FUNC(deployCancel); - }; -}] call EFUNC(common,addEventHandler); +[{_this call FUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); -[{_this call DFUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); +// Cancel deploy sandbag if interact menu opened +["interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call EFUNC(common,addEventHandler); + +// Cancel deploy on player change. This does work when returning to lobby, but not when hard disconnecting. +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["playerInventoryChanged", {_this call FUNC(handlePlayerInventoryChanged)}] call EFUNC(common,addEventhandler); +["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); + +// handle waking up dragged unit and falling unconscious while dragging +["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); + +//@todo Captivity? diff --git a/addons/sandbag/XEH_preInit.sqf b/addons/sandbag/XEH_preInit.sqf index 1978913723..444dca7ae0 100644 --- a/addons/sandbag/XEH_preInit.sqf +++ b/addons/sandbag/XEH_preInit.sqf @@ -3,12 +3,15 @@ ADDON = false; PREP(canDeploy); -PREP(carry); PREP(deploy); PREP(deployCancel); PREP(deployConfirm); -PREP(drop); +PREP(handleInteractMenuOpened); +PREP(handleKilled); +PREP(handlePlayerChanged); +PREP(handlePlayerInventoryChanged); PREP(handleScrollWheel); +PREP(handleUnconscious); PREP(pickup); ADDON = true; diff --git a/addons/sandbag/functions/fnc_canDeploy.sqf b/addons/sandbag/functions/fnc_canDeploy.sqf index 0c5fda5b4c..d26569f4ab 100644 --- a/addons/sandbag/functions/fnc_canDeploy.sqf +++ b/addons/sandbag/functions/fnc_canDeploy.sqf @@ -1,5 +1,5 @@ /* - * Author: Ruthberg + * Author: Ruthberg, commy2 * Checks if the player can deploy a sandbag * * Arguments: @@ -9,7 +9,7 @@ * Can deploy * * Example: - * [] call ace_sandbag_fnc_canDeploy + * [ACE_player] call ace_sandbag_fnc_canDeploy * * Public: No */ @@ -17,13 +17,13 @@ #define SURFACE_BLACKLIST ["water", "concrete", "tarmac", "wood", "metal", "roof_tin", "roof_tiles", "wood_int", "concrete_int", "tiles_int", "metal_int", "stony", "rock", "int_concrete", "int_tiles", "int_wood", "tiling", "wavymetal", "int_metal"] -if !([ACE_player, "ACE_Sandbag_empty"] call EFUNC(common,hasItem)) exitWith { false }; -if (ACE_player getVariable [QGVAR(usingSandbag), false]) exitWith { false }; -if ((getPosATL ACE_player select 2) - (getPos ACE_player select 2) > 1E-5) exitWith { false }; +params ["_unit"]; + +if !("ACE_Sandbag_empty" in items _unit) exitWith {false}; private ["_surfaceClass", "_surfaceType"]; -_surfaceClass = ([surfaceType (position ACE_player), "#"] call CBA_fnc_split) select 1; +_surfaceClass = (surfaceType getPosASL _unit) select [1]; _surfaceType = getText (configfile >> "CfgSurfaces" >> _surfaceClass >> "soundEnviron"); !(_surfaceType in SURFACE_BLACKLIST) diff --git a/addons/sandbag/functions/fnc_carry.sqf b/addons/sandbag/functions/fnc_carry.sqf deleted file mode 100644 index 84ab8c1883..0000000000 --- a/addons/sandbag/functions/fnc_carry.sqf +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Author: Ruthberg - * Carry sandbag - * - * Arguments: - * 0: sandbag - * 1: unit - * - * Return Value: - * None - * - * Example: - * [_sandbag, _unit] call ace_sandbag_fnc_carry - * - * Public: No - */ -#include "script_component.hpp" - -params ["_sandbag", "_unit"]; - -_unit playActionNow "PutDown"; - -_unit setVariable [QGVAR(usingSandbag), true]; -[{ - params ["_sandbag", "_unit"]; - - GVAR(carrier) = ACE_player; - - [GVAR(carrier), "ACE_Sandbag", true] call EFUNC(common,setForceWalkStatus); - - deleteVehicle _sandbag; - - GVAR(sandBag) = createVehicle ["ACE_SandbagObject_NoGeo", [0, 0, 0], [], 0, "NONE"]; - GVAR(sandBag) enableSimulationGlobal false; - - // Force physx update - { - _x setPosASL (getPosASL _x); - } count (GVAR(carrier) nearObjects ["ACE_SandbagObject", 5]); - - GVAR(carryPFH) = [{ - if (GVAR(carrier) != ACE_player) exitWith { - call FUNC(drop); - }; - GVAR(sandBag) setPosASL ((eyePos ACE_player) vectorAdd (positionCameraToWorld [0, 0, 1] vectorDiff positionCameraToWorld [0, 0, 0])); - GVAR(sandBag) setDir (GVAR(deployDirection) + getDir ACE_player); - }, 0, []] call CBA_fnc_addPerFrameHandler; - - [localize LSTRING(DropSandbag), "", ""] call EFUNC(interaction,showMouseHint); - - GVAR(carrier) setVariable [QGVAR(drop), - [GVAR(carrier), "DefaultAction", - {GVAR(carryPFH) != -1 && !isNull (GVAR(sandBag))}, - {call FUNC(drop);} - ] call EFUNC(common,AddActionEventHandler)]; -}, [_sandbag, _unit], 1, 0.5] call EFUNC(common,waitAndExecute); diff --git a/addons/sandbag/functions/fnc_deploy.sqf b/addons/sandbag/functions/fnc_deploy.sqf index 5bb162e029..de5bd9458e 100644 --- a/addons/sandbag/functions/fnc_deploy.sqf +++ b/addons/sandbag/functions/fnc_deploy.sqf @@ -1,47 +1,61 @@ /* - * Author: Garth 'L-H' de Wet, Ruthberg + * Author: Garth 'L-H' de Wet, Ruthberg, edited by commy2 for better MP and eventual AI support * Starts the deploy process for sandbags. * * Arguments: - * None + * 0: unit * * Return Value: * None * * Example: - * [] call ace_sandbag_fnc_deploy + * [ACE_player] call ace_sandbag_fnc_deploy * * Public: No */ #include "script_component.hpp" -closeDialog 0; +params ["_unit"]; -GVAR(placer) = ACE_player; +// prevent the placing unit from running +[_unit, "ACE_Sandbag", true] call EFUNC(common,setForceWalkStatus); -[GVAR(placer), "ACE_Sandbag", true] call EFUNC(common,setForceWalkStatus); +// create the sandbag +private "_sandBag"; +_sandBag = createVehicle ["ACE_SandbagObject_NoGeo", [0, 0, 0], [], 0, "NONE"]; -GVAR(sandBag) = createVehicle ["ACE_SandbagObject_NoGeo", [0, 0, 0], [], 0, "NONE"]; -GVAR(sandBag) enableSimulationGlobal false; +GVAR(sandBag) = _sandBag; +// prevent collisions with sandbag +["enableSimulationGlobal", [_sandBag, false]] call EFUNC(common,serverEvent); + +GVAR(deployDirection) = 0; + +// pfh that runs while the deployment is in progress GVAR(deployPFH) = [{ - if (GVAR(placer) != ACE_player) exitWith { - call FUNC(deployCancel); - }; - GVAR(sandBag) setPosASL ((eyePos ACE_player) vectorAdd (positionCameraToWorld [0, 0, 1] vectorDiff positionCameraToWorld [0, 0, 0])); - GVAR(sandBag) setDir (GVAR(deployDirection) + getDir ACE_player); -}, 0, []] call CBA_fnc_addPerFrameHandler; + (_this select 0) params ["_unit", "_sandBag"]; + if (isNull _sandBag) exitWith { + [_unit] call FUNC(deployCancel); + }; + + _sandBag setPosASL (eyePos _unit vectorAdd (positionCameraToWorld [0, 0, 1] vectorDiff positionCameraToWorld [0, 0, 0])); + _sandBag setDir (GVAR(deployDirection) + getDir _unit); +}, 0, [_unit, _sandBag]] call CBA_fnc_addPerFrameHandler; + +// add mouse button action and hint [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)]; +_unit setVariable [QGVAR(Deploy), [ + _unit, "DefaultAction", + {GVAR(deployPFH) != -1}, + {[_this select 0] 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)]; +_unit setVariable [QGVAR(Cancel), [ + _unit, "zoomtemp", + {GVAR(deployPFH) != -1}, + {[_this select 0] call FUNC(deployCancel)} +] call EFUNC(common,addActionEventHandler)]; + +_unit setVariable [QGVAR(isDeploying), true, true]; diff --git a/addons/sandbag/functions/fnc_deployCancel.sqf b/addons/sandbag/functions/fnc_deployCancel.sqf index bb7480a59e..9186ddbf57 100644 --- a/addons/sandbag/functions/fnc_deployCancel.sqf +++ b/addons/sandbag/functions/fnc_deployCancel.sqf @@ -1,35 +1,36 @@ /* - * Author: Garth 'L-H' de Wet, Ruthberg + * Author: Garth 'L-H' de Wet, Ruthberg, edited by commy2 for better MP and eventual AI support * Cancels sandbag deployment * * Arguments: - * None + * 0: unit * * Return Value: * None * * Example: - * [] call ace_sandbag_fnc_deployCancel + * [ACE_player] call ace_sandbag_fnc_deployCancel * * Public: No */ #include "script_component.hpp" -if (isNull GVAR(placer)) exitWith {}; +params ["_unit"]; -[GVAR(deployPFH)] call cba_fnc_removePerFrameHandler; +// enable running again +[_unit, "ACE_Sandbag", false] call EFUNC(common,setForceWalkStatus); -if (!isNull (GVAR(sandBag))) then { - deleteVehicle GVAR(sandBag); -}; +// delete placement dummy +deleteVehicle GVAR(sandBag); -[GVAR(placer), "ACE_Sandbag", false] call EFUNC(Common,setForceWalkStatus); +// remove deployment pfh +[GVAR(deployPFH)] call CBA_fnc_removePerFrameHandler; +GVAR(deployPFH) = -1; +// remove mouse button actions call EFUNC(interaction,hideMouseHint); -[GVAR(placer), "DefaultAction", GVAR(placer) getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); -[GVAR(placer), "zoomtemp", GVAR(placer) getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); -GVAR(placer) addItem "ACE_Sandbag_empty"; +[_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(common,removeActionEventHandler); +[_unit, "zoomtemp", _unit getVariable [QGVAR(Cancel), -1]] call EFUNC(common,removeActionEventHandler); -GVAR(sandBag) = objNull; -GVAR(placer) = objNull; +_unit setVariable [QGVAR(isDeploying), false, true]; diff --git a/addons/sandbag/functions/fnc_deployConfirm.sqf b/addons/sandbag/functions/fnc_deployConfirm.sqf index 61264c15fe..62848dd0cd 100644 --- a/addons/sandbag/functions/fnc_deployConfirm.sqf +++ b/addons/sandbag/functions/fnc_deployConfirm.sqf @@ -1,51 +1,59 @@ /* - * Author: Garth 'L-H' de Wet, Ruthberg + * Author: Garth 'L-H' de Wet, Ruthberg, edited by commy2 for better MP and eventual AI support * Confirms sandbag deployment * * Arguments: - * None + * 0: unit * * Return Value: * None * * Example: - * [] call ace_sandbag_fnc_deployConfirm + * [ACE_player] call ace_sandbag_fnc_deployConfirm * * Public: No */ #include "script_component.hpp" -if (isNull GVAR(sandBag) || isNull GVAR(placer)) exitWith {}; +params ["_unit"]; -[GVAR(deployPFH)] call cba_fnc_removePerFrameHandler; +// enable running again +[_unit, "ACE_Sandbag", false] call EFUNC(common,setForceWalkStatus); -[GVAR(placer), "ACE_Sandbag", false] call EFUNC(Common,setForceWalkStatus); -[GVAR(placer), "DefaultAction", GVAR(placer) getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); -[GVAR(placer), "zoomtemp", GVAR(placer) getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); +// remove sandbag from inventory +_unit removeItem "ACE_Sandbag_empty"; -call EFUNC(interaction,hideMouseHint); - -GVAR(placer) playActionNow "PutDown"; - -GVAR(placer) setVariable [QGVAR(usingSandbag), true]; +// delete placement dummy and create real sandbag [{ - _this setVariable [QGVAR(usingSandbag), false]; -}, GVAR(placer), 1.5, 0.5] call EFUNC(common,waitAndExecute); + if (isNull GVAR(sandBag)) exitWith {}; + + params ["_unit"]; + + private ["_position", "_direction", "_sandBag"]; -[{ - private ["_sandBag", "_position", "_direction"]; _position = getPosASL GVAR(sandBag); _direction = getDir GVAR(sandBag); deleteVehicle GVAR(sandBag); _sandBag = createVehicle ["ACE_SandbagObject", [0, 0, 0], [], 0, "NONE"]; - _sandBag enableSimulationGlobal true; _sandBag setPosASL _position; _sandBag setDir _direction; - GVAR(placer) removeItem "ACE_Sandbag_empty"; - GVAR(sandBag) = objNull; - GVAR(placer) = objNull; -}, [], 1.0, 0.5] call EFUNC(common,waitAndExecute); +}, [_unit], 1] call EFUNC(common,waitAndExecute); + +// remove deployment pfh +[GVAR(deployPFH)] call CBA_fnc_removePerFrameHandler; +GVAR(deployPFH) = -1; + +// remove mouse button actions +call EFUNC(interaction,hideMouseHint); + +[_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(common,removeActionEventHandler); +[_unit, "zoomtemp", _unit getVariable [QGVAR(Cancel), -1]] call EFUNC(common,removeActionEventHandler); + +// play animation +_unit playActionNow "PutDown"; + +_unit setVariable [QGVAR(isDeploying), false, true]; diff --git a/addons/sandbag/functions/fnc_drop.sqf b/addons/sandbag/functions/fnc_drop.sqf deleted file mode 100644 index 3ba825d423..0000000000 --- a/addons/sandbag/functions/fnc_drop.sqf +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet, Ruthberg - * Drop sandbag - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * [] call ace_sandbag_fnc_deployCancel - * - * Public: No - */ -#include "script_component.hpp" - -if (isNull GVAR(sandBag) || isNull GVAR(carrier)) exitWith {}; - -[GVAR(carryPFH)] call cba_fnc_removePerFrameHandler; - -[GVAR(carrier), "ACE_Sandbag", false] call EFUNC(Common,setForceWalkStatus); -[GVAR(carrier), "DefaultAction", GVAR(carrier) getVariable [QGVAR(drop), -1]] call EFUNC(Common,removeActionEventHandler); - -call EFUNC(interaction,hideMouseHint); - -GVAR(carrier) playActionNow "PutDown"; - -[{ - _this setVariable [QGVAR(usingSandbag), false]; -}, GVAR(carrier), 1.5, 0.5] call EFUNC(common,waitAndExecute); - -[{ - private ["_sandBag", "_position", "_direction"]; - _position = getPosASL GVAR(sandBag); - _direction = getDir GVAR(sandBag); - - deleteVehicle GVAR(sandBag); - - _sandBag = createVehicle ["ACE_SandbagObject", [0, 0, 0], [], 0, "NONE"]; - _sandBag enableSimulationGlobal true; - _sandBag setPosASL _position; - _sandBag setDir _direction; - - GVAR(sandBag) = objNull; - GVAR(carrier) = objNull; -}, [], 1.0, 0.5] call EFUNC(common,waitAndExecute); diff --git a/addons/sandbag/functions/fnc_handleInteractMenuOpened.sqf b/addons/sandbag/functions/fnc_handleInteractMenuOpened.sqf new file mode 100644 index 0000000000..f4ea5891c7 --- /dev/null +++ b/addons/sandbag/functions/fnc_handleInteractMenuOpened.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle opening of interaction menu. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(isDeploying), false]) then { + [_unit] call FUNC(deployCancel); +}; diff --git a/addons/sandbag/functions/fnc_handleKilled.sqf b/addons/sandbag/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..63babd3f52 --- /dev/null +++ b/addons/sandbag/functions/fnc_handleKilled.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle death. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(isDeploying), false]) then { + [_unit] call FUNC(deployCancel); +}; diff --git a/addons/sandbag/functions/fnc_handlePlayerChanged.sqf b/addons/sandbag/functions/fnc_handlePlayerChanged.sqf new file mode 100644 index 0000000000..f27a295903 --- /dev/null +++ b/addons/sandbag/functions/fnc_handlePlayerChanged.sqf @@ -0,0 +1,24 @@ +/* + * Author: commy2 + * Handle player changes. + * + * Arguments: + * 0: New Player Unit + * 1: Old Player Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_newPlayer", "_oldPlayer"]; + +if (_newPlayer getVariable [QGVAR(isDeploying), false]) then { + [_newPlayer] call FUNC(deployCancel); +}; + +if (_oldPlayer getVariable [QGVAR(isDeploying), false]) then { + [_oldPlayer] call FUNC(deployCancel); +}; diff --git a/addons/sandbag/functions/fnc_handlePlayerInventoryChanged.sqf b/addons/sandbag/functions/fnc_handlePlayerInventoryChanged.sqf new file mode 100644 index 0000000000..9f5920edd1 --- /dev/null +++ b/addons/sandbag/functions/fnc_handlePlayerInventoryChanged.sqf @@ -0,0 +1,22 @@ +/* + * Author: commy2 + * Handle the InventoryChanged event. + * + * Arguments: + * 0: Unit + * 1: Weapon + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(isDeploying), false]) then { + if !("ACE_Sandbag_empty" in items _unit) then { + [_unit] call FUNC(deployCancel); + }; +}; diff --git a/addons/sandbag/functions/fnc_handleUnconscious.sqf b/addons/sandbag/functions/fnc_handleUnconscious.sqf new file mode 100644 index 0000000000..7e0e257158 --- /dev/null +++ b/addons/sandbag/functions/fnc_handleUnconscious.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle unconsciousness. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(isDeploying), false]) then { + [_unit] call FUNC(deployCancel); +}; diff --git a/addons/sandbag/functions/fnc_pickup.sqf b/addons/sandbag/functions/fnc_pickup.sqf index dd0b93fd59..7e04d047fd 100644 --- a/addons/sandbag/functions/fnc_pickup.sqf +++ b/addons/sandbag/functions/fnc_pickup.sqf @@ -3,27 +3,32 @@ * Pick up sandbag * * Arguments: - * 0: sandbag - * 1: unit + * 0: unit + * 1: sandbag * * Return Value: * None * * Example: - * [_sandbag, _unit] call ace_sandbag_fnc_pickup + * [_unit, _sandbag] call ace_sandbag_fnc_pickup * * Public: No */ #include "script_component.hpp" -params ["_sandbag", "_unit"]; +params ["_unit", "_sandbag"]; _unit playActionNow "PutDown"; -_unit setVariable [QGVAR(usingSandbag), true]; +_unit setVariable [QGVAR(isUsingSandbag), true]; + [{ - params ["_sandbag", "_unit"]; - _unit setVariable [QGVAR(usingSandbag), false]; + params ["_unit", "_sandbag"]; + + _unit setVariable [QGVAR(isUsingSandbag), false]; + + if (isNull _sandbag) exitWith {}; + deletevehicle _sandbag; // Force physx update @@ -32,4 +37,4 @@ _unit setVariable [QGVAR(usingSandbag), true]; } count (_unit nearObjects ["ACE_SandbagObject", 5]); [_unit, "ACE_Sandbag_empty"] call EFUNC(common,addToInventory); -}, [_sandbag, _unit], 1.5, 0.5] call EFUNC(common,waitAndExecute); +}, [_unit, _sandbag], 1.5] call EFUNC(common,waitAndExecute); diff --git a/addons/sandbag/stringtable.xml b/addons/sandbag/stringtable.xml index 5576add969..c67173466c 100644 --- a/addons/sandbag/stringtable.xml +++ b/addons/sandbag/stringtable.xml @@ -146,16 +146,16 @@ Aqui não tem areia - + Modifier, rotates - + Modifikator, drehen - + Modificador, girar - + Modificateur, tourner - + Modificatore, rotazione - + Modifikátor, otočit - + Változtatás, forgatás - + Modyfikator, obrót - + Modificador, rotaciona - + Bращать + +Ctrl rotate + +Strg drehen + +Ctrl girar + +Ctrl tourner + +Ctrl rotazione + +Ctrl otočit + +Ctrl forgatás + +Ctrl obrót + +Ctrl rotaciona + +Ctrl Bращать \ No newline at end of file diff --git a/addons/tacticalladder/CfgEventHandlers.hpp b/addons/tacticalladder/CfgEventHandlers.hpp index 737cae5e43..f9ceb35aa5 100644 --- a/addons/tacticalladder/CfgEventHandlers.hpp +++ b/addons/tacticalladder/CfgEventHandlers.hpp @@ -1,3 +1,4 @@ + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); @@ -9,3 +10,11 @@ class Extended_PostInit_EventHandlers { init = QUOTE( call COMPILE_FILE(XEH_postInit) ); }; }; + +class Extended_Killed_EventHandlers { + class CAManBase { + class ADDON { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; diff --git a/addons/tacticalladder/CfgVehicles.hpp b/addons/tacticalladder/CfgVehicles.hpp index a1eda1a955..1457c4ddee 100644 --- a/addons/tacticalladder/CfgVehicles.hpp +++ b/addons/tacticalladder/CfgVehicles.hpp @@ -5,8 +5,8 @@ class CfgVehicles { class ACE_SelfActions { class ACE_TacticalLadders { displayName = CSTRING(Deploy); - condition = QUOTE((backpack ACE_player) == QUOTE(QUOTE(ACE_TacticalLadder_Pack))); - statement = QUOTE(call FUNC(deployTL)); + condition = QUOTE(backpack _player == 'ACE_TacticalLadder_Pack'); + statement = QUOTE([_player] call FUNC(deployTL)); exceptions[] = {}; showDisabled = 1; priority = 4; @@ -33,7 +33,7 @@ class CfgVehicles { }; class House; - class ACE_Tactical_Ladder: House { + class ACE_TacticalLadder: House { XEH_ENABLED; displayName = CSTRING(DisplayName); class DestructionEffects {}; @@ -42,6 +42,7 @@ class CfgVehicles { autocenter = 0; featureSize = 12; ladders[] = {{"start","end"}}; + class AnimationSources { class rotate { source = "user"; @@ -62,28 +63,31 @@ class CfgVehicles { class extract_10: extract_1 {}; class extract_11: extract_1 {}; }; + class ACE_Actions { class ACE_MainActions { selection = "roadway"; distance = 5; condition = "true"; + class ACE_PickUp { selection = ""; displayName = CSTRING(Pickup); distance = 4; condition = QUOTE((backpack ACE_player) == ''); - statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickupTL)); + statement = QUOTE([ARR_2(_player,_target)] call FUNC(pickupTL)); showDisabled = 0; exceptions[] = {}; priority = 5; }; + class ACE_Position { selection = ""; displayName = CSTRING(Position); distance = 4; condition = "true"; //wait a frame to handle "Do When releasing action menu key" option: - statement = QUOTE([ARR_2({_this call FUNC(positionTL)}, [ARR_2(_target,_player)])] call EFUNC(common,execNextFrame)); + statement = QUOTE([ARR_2({_this call FUNC(positionTL)},[ARR_2(_player,_target)])] call EFUNC(common,execNextFrame)); showDisabled = 0; exceptions[] = {}; priority = 5; diff --git a/addons/tacticalladder/XEH_postInit.sqf b/addons/tacticalladder/XEH_postInit.sqf index f0091ec7fa..8ebf776987 100644 --- a/addons/tacticalladder/XEH_postInit.sqf +++ b/addons/tacticalladder/XEH_postInit.sqf @@ -1,15 +1,28 @@ #include "script_component.hpp" +if (!hasInterface) exitWith {}; + GVAR(ladder) = objNull; GVAR(cancelTime) = 0; GVAR(currentStep) = 3; GVAR(currentAngle) = 0; -// Cancel tactical ladder deployment if the interact menu is opened -["interactMenuOpened", { +/*["interactMenuOpened", { if ((ACE_time > GVAR(cancelTime)) && !isNull GVAR(ladder)) then { GVAR(ladder) call FUNC(cancelTLdeploy); }; -}] call EFUNC(common,addEventHandler); +}] call EFUNC(common,addEventHandler);*/ -[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler); +// Cancel adjustment if interact menu opens +["interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call EFUNC(common,addEventHandler); + +[{_this call FUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); + +// Cancel adjusting on player change. +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); + +// handle falling unconscious +["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); + +// @todo captivity? diff --git a/addons/tacticalladder/XEH_preInit.sqf b/addons/tacticalladder/XEH_preInit.sqf index e434974c9a..cb1d3a8cf3 100644 --- a/addons/tacticalladder/XEH_preInit.sqf +++ b/addons/tacticalladder/XEH_preInit.sqf @@ -5,7 +5,11 @@ ADDON = false; PREP(cancelTLdeploy); PREP(confirmTLdeploy); PREP(deployTL); +PREP(handleKilled); +PREP(handleInteractMenuOpened); +PREP(handlePlayerChanged); PREP(handleScrollWheel); +PREP(handleUnconscious); PREP(pickupTL); PREP(positionTL); diff --git a/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf b/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf index 456d245832..c134df31d1 100644 --- a/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf +++ b/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf @@ -1,9 +1,10 @@ /* - * Author: Rocko, Ruthberg + * Author: Rocko, Ruthberg, commy2 * Cancel tactical ladder deployment * * Arguments: - * 0: ladder + * 0: unit + * 1: ladder * * Return Value: * None @@ -17,16 +18,23 @@ #define __ANIMS ["extract_1","extract_2","extract_3","extract_4","extract_5","extract_6","extract_7","extract_8","extract_9","extract_10","extract_11"] -params ["_ladder"]; +params ["_unit", "_ladder"]; + +// enable running again +[_unit, "ACE_Ladder", false] call EFUNC(common,setForceWalkStatus); detach _ladder; + _ladder animate ["rotate", 0]; + { _ladder animate [_x, 0]; } count __ANIMS; +// remove mouse buttons and hint call EFUNC(interaction,hideMouseHint); -[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); -[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); + +[_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); +[_unit, "zoomtemp", _unit getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); GVAR(ladder) = objNull; diff --git a/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf b/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf index 764e5c73d8..0094e460dc 100644 --- a/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf +++ b/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf @@ -1,9 +1,10 @@ /* - * Author: Rocko, Ruthberg + * Author: Rocko, Ruthberg, commy2 * Confirm tactical ladder deployment * * Arguments: - * 0: ladder + * 0: unit + * 1: ladder * * Return Value: * Success @@ -15,18 +16,26 @@ */ #include "script_component.hpp" -params ["_ladder"]; +params ["_unit", "_ladder"]; + +// enable running again +[_unit, "ACE_Ladder", false] call EFUNC(common,setForceWalkStatus); private ["_pos1", "_pos2"]; -_pos1 = getPosASL GVAR(ladder); -_pos2 = (GVAR(ladder) modelToWorld (GVAR(ladder) selectionPosition "check2")) call EFUNC(common,positionToASL); -if (lineIntersects [_pos1, _pos2, GVAR(ladder)]) exitWith { false }; -call EFUNC(interaction,hideMouseHint); -[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler); -[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); +_pos1 = getPosASL _ladder; +_pos2 = AGLToASL (_ladder modelToWorld (_ladder selectionPosition "check2")); + +if (lineIntersects [_pos1, _pos2, _ladder]) exitWith {false}; detach _ladder; + +// remove mouse buttons and hint +call EFUNC(interaction,hideMouseHint); + +[_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(common,removeActionEventHandler); +[_unit, "zoomtemp", _unit getVariable [QGVAR(Cancel), -1]] call EFUNC(common,removeActionEventHandler); + GVAR(ladder) = objNull; true diff --git a/addons/tacticalladder/functions/fnc_deployTL.sqf b/addons/tacticalladder/functions/fnc_deployTL.sqf index 14c386dda1..b0eb1e0f68 100644 --- a/addons/tacticalladder/functions/fnc_deployTL.sqf +++ b/addons/tacticalladder/functions/fnc_deployTL.sqf @@ -3,32 +3,35 @@ * Deploy tactical ladder * * Arguments: - * None + * 0: unit * * Return Value: * None * * Example: - * [] call ace_tacticalladder_fnc_deployTL + * [_unit] call ace_tacticalladder_fnc_deployTL * * Public: No */ #include "script_component.hpp" -if ((backpack ACE_player) != "ACE_TacticalLadder_Pack") exitWith {}; +params ["_unit"]; + +if (backpack _unit != 'ACE_TacticalLadder_Pack') exitWith {}; + +removeBackpack _unit; private ["_pos", "_offset", "_ladder"]; -removeBackpack ACE_player; +_pos = _unit modelToWorld [0,0,0]; +_offset = if ((_unit call CBA_fnc_getUnitAnim select 0) == "prone") then { 1 } else {0.8}; -_pos = ACE_player modelToWorld [0,0,0]; -_offset = if ((ACE_player call CBA_fnc_getUnitAnim select 0) == "prone") then { 1 } else {0.8}; -_pos set [0, (_pos select 0) + (sin (direction ACE_player) * _offset)]; -_pos set [1, (_pos select 1) + (cos (direction ACE_player) * _offset)]; -_pos set [2, [ACE_player] call CBA_fnc_realHeight]; +_pos set [0, (_pos select 0) + (sin getDir _unit) * _offset]; +_pos set [1, (_pos select 1) + (cos getDir _unit) * _offset]; +_pos set [2, [_unit] call CBA_fnc_realHeight]; -_ladder = "ACE_Tactical_Ladder" createVehicle _pos; +_ladder = "ACE_TacticalLadder" createVehicle _pos; _ladder setPos _pos; -_ladder setDir (direction ACE_player); +_ladder setDir getDir _unit; -ACE_player reveal _ladder; +_unit reveal _ladder; diff --git a/addons/tacticalladder/functions/fnc_handleInteractMenuOpened.sqf b/addons/tacticalladder/functions/fnc_handleInteractMenuOpened.sqf new file mode 100644 index 0000000000..c7187acd55 --- /dev/null +++ b/addons/tacticalladder/functions/fnc_handleInteractMenuOpened.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle opening of interaction menu. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (!isNull (GETMVAR(GVAR(ladder),objNull)) && {GVAR(ladder) in attachedObjects _unit}) then { + [_unit, GVAR(ladder)] call FUNC(cancelTLdeploy); +}; diff --git a/addons/tacticalladder/functions/fnc_handleKilled.sqf b/addons/tacticalladder/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..c5d6aa1314 --- /dev/null +++ b/addons/tacticalladder/functions/fnc_handleKilled.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle death. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (!isNull (GETMVAR(ladder,objNull)) && {GVAR(ladder) in attachedObjects _unit}) then { + [_unit, GVAR(ladder)] call FUNC(cancelTLdeploy); +}; diff --git a/addons/tacticalladder/functions/fnc_handlePlayerChanged.sqf b/addons/tacticalladder/functions/fnc_handlePlayerChanged.sqf new file mode 100644 index 0000000000..bc8d1faf54 --- /dev/null +++ b/addons/tacticalladder/functions/fnc_handlePlayerChanged.sqf @@ -0,0 +1,26 @@ +/* + * Author: commy2 + * Handle player changes. + * + * Arguments: + * 0: New Player Unit + * 1: Old Player Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +if (isNull (GETMVAR(ladder,objNull))) exitWith {}; + +params ["_newPlayer", "_oldPlayer"]; + +if (GVAR(ladder) in attachedObjects _newPlayer) then { + [_newPlayer, GVAR(ladder)] call FUNC(cancelTLdeploy); +}; + +if (GVAR(ladder) in attachedObjects _oldPlayer) then { + [_oldPlayer, GVAR(ladder)] call FUNC(cancelTLdeploy); +}; diff --git a/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf b/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf index 6b5107b814..0b64d89610 100644 --- a/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf +++ b/addons/tacticalladder/functions/fnc_handleScrollWheel.sqf @@ -41,7 +41,7 @@ if (GETMVAR(ACE_Modifier,0) == 0) then { }; } else { // Tilting - GVAR(currentAngle) = 0 max (GVAR(currentAngle) + _scroll) min 90; + GVAR(currentAngle) = 0 max (GVAR(currentAngle) + _scroll) min 30; GVAR(ladder) animate ["rotate", GVAR(currentAngle)]; }; diff --git a/addons/tacticalladder/functions/fnc_handleUnconscious.sqf b/addons/tacticalladder/functions/fnc_handleUnconscious.sqf new file mode 100644 index 0000000000..e9ce28d524 --- /dev/null +++ b/addons/tacticalladder/functions/fnc_handleUnconscious.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle unconsciousness. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (!isNull (GETMVAR(ladder,objNull)) && {GVAR(ladder) in attachedObjects _unit}) then { + [_unit, GVAR(ladder)] call FUNC(cancelTLdeploy); +}; diff --git a/addons/tacticalladder/functions/fnc_pickupTL.sqf b/addons/tacticalladder/functions/fnc_pickupTL.sqf index ad409f8870..d8e313a17b 100644 --- a/addons/tacticalladder/functions/fnc_pickupTL.sqf +++ b/addons/tacticalladder/functions/fnc_pickupTL.sqf @@ -1,26 +1,27 @@ /* - * Author: Rocko, Ruthberg + * Author: Rocko, Ruthberg, commy2 * Pick up tactical ladder * * Arguments: - * 0: ladder - * 1: unit + * 0: unit + * 1: ladder * * Return Value: * Success * * Example: - * [_ladder, _unit] call ace_tacticalladder_fnc_pickupTL + * [_unit, _ladder] call ace_tacticalladder_fnc_pickupTL * * Public: No */ #include "script_component.hpp" -if ((backpack ACE_player) != "") exitWith { false }; +params ["_unit", "_ladder"]; -params ["_ladder", "_unit"]; +if (backpack _unit != "") exitWith {false}; deleteVehicle _ladder; + _unit addBackpack "ACE_TacticalLadder_Pack"; true diff --git a/addons/tacticalladder/functions/fnc_positionTL.sqf b/addons/tacticalladder/functions/fnc_positionTL.sqf index 1035101556..1e7f0db209 100644 --- a/addons/tacticalladder/functions/fnc_positionTL.sqf +++ b/addons/tacticalladder/functions/fnc_positionTL.sqf @@ -3,14 +3,14 @@ * Position tactical ladder * * Arguments: - * 0: sandbag - * 1: unit + * 0: unit + * 1: ladder * * Return Value: * None * * Example: - * [_ladder, _unit] call ace_tacticalladder_fnc_positionTL + * [_unit, _ladder] call ace_tacticalladder_fnc_positionTL * * Public: No */ @@ -18,13 +18,17 @@ #define __ANIMS ["extract_1","extract_2","extract_3","extract_4","extract_5","extract_6","extract_7","extract_8","extract_9","extract_10","extract_11"] -params ["_ladder", "_unit"]; +params ["_unit", "_ladder"]; + +// prevent the placing unit from running +[_unit, "ACE_Ladder", true] call EFUNC(common,setForceWalkStatus); { _ladder animate [_x, 0]; } count __ANIMS; -_unit switchMove "amovpercmstpslowwrfldnon_player_idlesteady03"; +[_unit, "amovpercmstpslowwrfldnon_player_idlesteady03", 2] call EFUNC(common,doAnimation); + _ladder attachTo [_unit, [0, 0.75, 0], ""]; // Position ladder in front of player _ladder animate ["rotate", 0]; @@ -37,16 +41,17 @@ GVAR(cancelTime) = ACE_time + 1; // Workaround to prevent accidental canceling GVAR(currentStep) = 3; GVAR(currentAngle) = 0; +// add mouse buttons and hints [localize LSTRING(Deploy), localize LSTRING(Drop), localize LSTRING(Adjust)] call EFUNC(interaction,showMouseHint); -ACE_player setVariable [QGVAR(Deploy), - [ACE_player, "DefaultAction", +_unit setVariable [QGVAR(Deploy), [ + _unit, "DefaultAction", {!isNull GVAR(ladder)}, - {GVAR(ladder) call FUNC(confirmTLdeploy);} -] call EFUNC(common,AddActionEventHandler)]; + {[_this select 0, GVAR(ladder)] call FUNC(confirmTLdeploy)} +] call EFUNC(common,addActionEventHandler)]; -ACE_player setVariable [QGVAR(Cancel), - [ACE_player, "zoomtemp", +_unit setVariable [QGVAR(Cancel), [ + _unit, "zoomtemp", {!isNull GVAR(ladder)}, - {GVAR(ladder) call FUNC(cancelTLdeploy);} -] call EFUNC(common,AddActionEventHandler)]; + {[_this select 0, GVAR(ladder)] call FUNC(cancelTLdeploy)} +] call EFUNC(common,addActionEventHandler)]; diff --git a/addons/tacticalladder/stringtable.xml b/addons/tacticalladder/stringtable.xml index a05c82efb2..98e041b1af 100644 --- a/addons/tacticalladder/stringtable.xml +++ b/addons/tacticalladder/stringtable.xml @@ -38,15 +38,8 @@ Derrubar escada - Adjust ladder - Leiter einstellen - Reguluj drabinę - Upravit žebřík - Ajustar escalera - Ajustar escada - Régler l'échelle - Létra állítása - Выровнять лестницу + Extend, +Ctrl tilt + Ausfahren, +Strg kippen Position ladder diff --git a/addons/tripod/CfgEventHandlers.hpp b/addons/tripod/CfgEventHandlers.hpp index d700ed4c85..ed59062ad5 100644 --- a/addons/tripod/CfgEventHandlers.hpp +++ b/addons/tripod/CfgEventHandlers.hpp @@ -1,3 +1,4 @@ + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call COMPILE_FILE(XEH_preInit) ); @@ -17,3 +18,11 @@ class Extended_Init_EventHandlers { }; }; }; + +class Extended_Killed_EventHandlers { + class CAManBase { + class ADDON { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; diff --git a/addons/tripod/CfgVehicles.hpp b/addons/tripod/CfgVehicles.hpp index 2a689ba349..60486b8afb 100644 --- a/addons/tripod/CfgVehicles.hpp +++ b/addons/tripod/CfgVehicles.hpp @@ -2,15 +2,13 @@ class CfgVehicles { class Man; class CAManBase: Man { class ACE_SelfActions { - class ACE_Equipment { - class GVAR(place) { - displayName = CSTRING(Placedown); - condition = QUOTE([ARR_2(_player,'ACE_Tripod')] call EFUNC(common,hasItem)); - statement = QUOTE([ARR_2(_player,'ACE_Tripod')] call FUNC(place)); - showDisabled = 0; - priority = 2; - icon = PATHTOF(UI\w_sniper_tripod_ca.paa); - }; + class GVAR(place) { + displayName = CSTRING(Placedown); + condition = QUOTE([ARR_2(_player,'ACE_Tripod')] call EFUNC(common,hasItem)); + statement = QUOTE([ARR_2(_player,'ACE_Tripod')] call FUNC(place)); + showDisabled = 0; + priority = 2; + icon = PATHTOF(UI\w_sniper_tripod_ca.paa); }; }; }; @@ -37,9 +35,13 @@ class CfgVehicles { class thingX; class ACE_TripodObject: thingX { XEH_ENABLED; + EGVAR(dragging,canDrag) = 1; + EGVAR(dragging,dragPosition[]) = {0,1,0}; + EGVAR(dragging,dragDirection) = 0; scope = 2; displayName = CSTRING(DisplayName); model = PATHTOF(data\sniper_tripod.p3d); + class AnimationSources { class slide_down_tripod { source = "user"; @@ -52,32 +54,32 @@ class CfgVehicles { class retract_leg_2: retract_leg_1 {}; class retract_leg_3: retract_leg_2 {}; }; - EGVAR(dragging,canDrag) = 1; - EGVAR(dragging,dragPosition[]) = {0,1,0}; - EGVAR(dragging,dragDirection) = 0; + class ACE_Actions { class ACE_MainActions { selection = ""; distance = 5; condition = "true"; + class ACE_Pickup { selection = ""; displayName = CSTRING(PickUp); distance = 5; condition = "true"; - statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickup)); + statement = QUOTE([ARR_2(_player,_target)] call FUNC(pickup)); showDisabled = 0; exceptions[] = {}; priority = 5; icon = PATHTOF(UI\w_sniper_tripod_ca.paa); }; + class ACE_Adjust { selection = ""; displayName = CSTRING(Adjust); distance = 5; condition = "true"; //wait a frame to handle "Do When releasing action menu key" option: - statement = QUOTE([ARR_2({_this call FUNC(adjust)}, [_target])] call EFUNC(common,execNextFrame)); + statement = QUOTE([ARR_2({_this call FUNC(adjust)}, [ARR_2(_player,_target)])] call EFUNC(common,execNextFrame)); showDisabled = 0; exceptions[] = {}; priority = 5; diff --git a/addons/tripod/XEH_postInit.sqf b/addons/tripod/XEH_postInit.sqf index 706aaecae9..6f2dc9b7e0 100644 --- a/addons/tripod/XEH_postInit.sqf +++ b/addons/tripod/XEH_postInit.sqf @@ -1,16 +1,21 @@ #include "script_component.hpp" -GVAR(adjuster) = objNull; -GVAR(adjusting) = false; +if (!hasInterface) exitWith {}; + GVAR(adjustPFH) = -1; GVAR(height) = 0; // Cancel adjustment if interact menu opens -["interactMenuOpened", { - if (GVAR(adjustPFH) != -1 && GVAR(adjusting)) then { - GVAR(adjusting) = false; - }; -}] call EFUNC(common,addEventHandler); +["interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call EFUNC(common,addEventHandler); -[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler); +[{_this call FUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); + +// Cancel adjusting on player change. +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); + +// handle falling unconscious +["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); + +// @todo captivity? diff --git a/addons/tripod/XEH_preInit.sqf b/addons/tripod/XEH_preInit.sqf index f27b707936..1699258b47 100644 --- a/addons/tripod/XEH_preInit.sqf +++ b/addons/tripod/XEH_preInit.sqf @@ -3,7 +3,11 @@ ADDON = false; PREP(adjust); +PREP(handleInteractMenuOpened); +PREP(handleKilled); +PREP(handlePlayerChanged); PREP(handleScrollWheel); +PREP(handleUnconscious); PREP(pickup); PREP(place); diff --git a/addons/tripod/functions/fnc_adjust.sqf b/addons/tripod/functions/fnc_adjust.sqf index 1ba99cedbe..2b8659b2a4 100644 --- a/addons/tripod/functions/fnc_adjust.sqf +++ b/addons/tripod/functions/fnc_adjust.sqf @@ -9,37 +9,39 @@ * None * * Example: - * [tripod] call ace_tripod_fnc_adjust + * [ACE_player, tripod] call ace_tripod_fnc_adjust * * Public: No */ #include "script_component.hpp" -params ["_tripod"]; +params ["_unit", "_tripod"]; -GVAR(adjuster) = ACE_player; -GVAR(adjusting) = true; +_unit setVariable [QGVAR(adjusting), true, true]; +// add PFH to adjust the tripod animation GVAR(adjustPFH) = [{ - params ["_args", "_pfhId"]; - _args params ["_tripod"]; + (_this select 0) params ["_unit", "_tripod"]; - if (GVAR(adjuster) != ACE_player || !GVAR(adjusting)) exitWith { + if (!(_unit getVariable [QGVAR(adjusting), false]) || {isNull _tripod} || {_unit distance _tripod > 5}) exitWith { call EFUNC(interaction,hideMouseHint); - [ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Adjust), -1]] call EFUNC(Common,removeActionEventHandler); - [_pfhId] call cba_fnc_removePerFrameHandler; + + [_unit, "DefaultAction", _unit getVariable [QGVAR(Adjust), -1]] call EFUNC(common,removeActionEventHandler); + + [_this select 1] call CBA_fnc_removePerFrameHandler; }; { _tripod animate [_x, 1 - GVAR(height)]; } count ["slide_down_tripod", "retract_leg_1", "retract_leg_2", "retract_leg_3"]; -}, 0, [_tripod]] call CBA_fnc_addPerFrameHandler; +}, 0, [_unit, _tripod]] call CBA_fnc_addPerFrameHandler; +// add mouse button action and hint [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)]; +_unit setVariable [QGVAR(Adjust), [ + _unit, "DefaultAction", + {GVAR(adjustPFH) != -1}, + {(_this select 0) setVariable [QGVAR(adjusting), false, true]} +] call EFUNC(common,addActionEventHandler)]; diff --git a/addons/tripod/functions/fnc_handleInteractMenuOpened.sqf b/addons/tripod/functions/fnc_handleInteractMenuOpened.sqf new file mode 100644 index 0000000000..8c49359d96 --- /dev/null +++ b/addons/tripod/functions/fnc_handleInteractMenuOpened.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle opening of interaction menu. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(adjusting), false]) then { + _unit setVariable [QGVAR(adjusting), false, true]; +}; diff --git a/addons/tripod/functions/fnc_handleKilled.sqf b/addons/tripod/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..ee28fc1f45 --- /dev/null +++ b/addons/tripod/functions/fnc_handleKilled.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle death. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(adjusting), false]) then { + _unit setVariable [QGVAR(adjusting), false, true]; +}; diff --git a/addons/tripod/functions/fnc_handlePlayerChanged.sqf b/addons/tripod/functions/fnc_handlePlayerChanged.sqf new file mode 100644 index 0000000000..dd0cad6533 --- /dev/null +++ b/addons/tripod/functions/fnc_handlePlayerChanged.sqf @@ -0,0 +1,24 @@ +/* + * Author: commy2 + * Handle player changes. + * + * Arguments: + * 0: New Player Unit + * 1: Old Player Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_newPlayer", "_oldPlayer"]; + +if (_newPlayer getVariable [QGVAR(adjusting), false]) then { + _newPlayer setVariable [QGVAR(adjusting), false, true]; +}; + +if (_oldPlayer getVariable [QGVAR(adjusting), false]) then { + _oldPlayer setVariable [QGVAR(adjusting), false, true]; +}; diff --git a/addons/tripod/functions/fnc_handleScrollWheel.sqf b/addons/tripod/functions/fnc_handleScrollWheel.sqf index 973a57dd2f..1589bbc476 100644 --- a/addons/tripod/functions/fnc_handleScrollWheel.sqf +++ b/addons/tripod/functions/fnc_handleScrollWheel.sqf @@ -17,7 +17,7 @@ params ["_scroll"]; -if (GETMVAR(ACE_Modifier,0) == 0 || GVAR(adjustPFH) == -1) exitWith { false }; +if (GVAR(adjustPFH) == -1) exitWith {false}; GVAR(height) = 0 max (GVAR(height) + (_scroll / 20)) min 1; diff --git a/addons/tripod/functions/fnc_handleUnconscious.sqf b/addons/tripod/functions/fnc_handleUnconscious.sqf new file mode 100644 index 0000000000..f81cecea58 --- /dev/null +++ b/addons/tripod/functions/fnc_handleUnconscious.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle unconsciousness. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(adjusting), false]) then { + _unit setVariable [QGVAR(adjusting), false, true]; +}; diff --git a/addons/tripod/functions/fnc_pickup.sqf b/addons/tripod/functions/fnc_pickup.sqf index 24fc26ea1d..886aa5087e 100644 --- a/addons/tripod/functions/fnc_pickup.sqf +++ b/addons/tripod/functions/fnc_pickup.sqf @@ -3,28 +3,31 @@ * Pick up tripod * * Arguments: - * 0: tripod - * 1: unit + * 0: unit + * 1: tripod * * Return value: * None * * Example: - * [tripod, player] call ace_tripod_fnc_pickup + * [ACE_player, tripod] call ace_tripod_fnc_pickup * * Public: No */ #include "script_component.hpp" -params ["_tripod", "_unit"]; +params ["_unit", "_tripod"]; -if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { - _unit playMove "AmovPercMstpSrasWrflDnon_diary"; +if (stance _unit == "STAND") then { + [_unit, "AmovPercMstpSrasWrflDnon_diary"] call EFUNC(common,doAnimation); }; [{ - params ["_tripod", "_unit"]; + params ["_unit", "_tripod"]; + + if (isNull _tripod) exitWith {}; + + deleteVehicle _tripod; [_unit, "ACE_Tripod"] call EFUNC(common,addToInventory); - deleteVehicle _tripod; -}, [_tripod, _unit], 1, 0]call EFUNC(common,waitAndExecute); +}, [_unit, _tripod], 1] call EFUNC(common,waitAndExecute); diff --git a/addons/tripod/functions/fnc_place.sqf b/addons/tripod/functions/fnc_place.sqf index ce7f445885..3168703f31 100644 --- a/addons/tripod/functions/fnc_place.sqf +++ b/addons/tripod/functions/fnc_place.sqf @@ -20,34 +20,37 @@ params ["_unit", "_tripodClass"]; _unit removeItem _tripodClass; -if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { - _unit playMove "AmovPercMstpSrasWrflDnon_diary"; +if (stance _unit == "STAND") then { + [_unit, "AmovPercMstpSrasWrflDnon_diary"] call EFUNC(common,doAnimation); }; [{ params ["_unit"]; private ["_direction", "_position", "_tripod"]; + _direction = getDir _unit; - _position = (getPosASL _unit) vectorAdd [0.8 * sin(_direction), 0.8 * cos(_direction), 0.02]; + _position = getPosASL _unit vectorAdd [0.8 * sin _direction, 0.8 * cos _direction, 0.02]; _tripod = "ACE_TripodObject" createVehicle [0, 0, 0]; + { _tripod animate [_x, 1]; } count ["slide_down_tripod", "retract_leg_1", "retract_leg_2", "retract_leg_3"]; [{ - params ["_args", "_pfhId"]; - _args params ["_tripod", "_direction", "_position"]; + (_this select 0) params ["_tripod", "_direction", "_position"]; if (_tripod animationPhase "slide_down_tripod" == 1) then { _tripod setDir _direction; _tripod setPosASL _position; - if ((getPosATL _tripod select 2) - (getPos _tripod select 2) < 1E-5) then { + + if ((getPosATL _tripod select 2) - (getPos _tripod select 2) < 1E-5) then { // if not on object, then adjust to surface normale _tripod setVectorUp (surfaceNormal (position _tripod)); }; - [_pfhId] call CBA_fnc_removePerFrameHandler; + + [_this select 1] call CBA_fnc_removePerFrameHandler; }; }, 0, [_tripod, _direction, _position]] call CBA_fnc_addPerFrameHandler; -}, [_unit], 1, 0] call EFUNC(common,waitAndExecute); +}, [_unit], 1] call EFUNC(common,waitAndExecute); diff --git a/addons/tripod/stringtable.xml b/addons/tripod/stringtable.xml index e87c89e6ff..c6366ba8de 100644 --- a/addons/tripod/stringtable.xml +++ b/addons/tripod/stringtable.xml @@ -59,15 +59,15 @@ Готово - + Modifier, adjust - + Modyfikator, regulacja - + Modificador, ajuste - + Modifikátor, regulace - + Modifikator, anpassen - + Modificador, ajuste - + modifier, régler - + Módosító, szabályzás - + Модификатор, подстройка + adjust + regulacja + ajuste + regulace + anpassen + ajuste + régler + szabályzás + подстройка