 sreV                prefix z\ace\addons\quickmount Mikero DePbo.dll.7.46 version 109e12cc  ACE_Settings.hpp            _  CfgEventHandlers.hpp            _  CfgVehicles.hpp     ~
       _~
  config.bin           J_  functions\fnc_addFreeSeatsActions.sqf     )       _)  functions\fnc_canShowFreeSeats.sqf     A      ª_A  functions\fnc_getInNearest.sqf           ª_  functions\fnc_moduleInit.sqf     W       _W  functions\script_component.hpp     :        _:   initSettings.sqf     4       _4  README.md            _  script_component.hpp            _  stringtable.xml     -       _-  XEH_postInitClient.sqf     "       _"  XEH_preInit.sqf             _   XEH_PREP.hpp     ]        _]   XEH_preStart.sqf     <        _<                        class ACE_Settings {
    class GVAR(enabled) {
        movedToSQF = 1;
    };
    class GVAR(distance) {
        movedToSQF = 1;
    };
    class GVAR(speed) {
        movedToSQF = 1;
    };
    class GVAR(priority) {
         movedToSQF = 1;
    };
};
class Extended_PreStart_EventHandlers {
    class ADDON {
        init = QUOTE(call COMPILE_FILE(XEH_preStart));
    };
};

class Extended_PreInit_EventHandlers {
    class ADDON {
        init = QUOTE(call COMPILE_FILE(XEH_preInit));
    };
};

class Extended_PostInit_EventHandlers {
    class ADDON {
        clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient));
    };
};
class CfgVehicles {
    class ACE_Module;
    class GVAR(module): ACE_Module {
        author = ECSTRING(common,ACETeam);
        category = "ACE";
        displayName = CSTRING(Category);
        function = QFUNC(moduleInit);
        scope = 1;
        isGlobal = 1;
        isTriggerActivated = 0;
        isDisposable = 0;
        icon = "a3\ui_f\data\IGUI\Cfg\Actions\Obsolete\ui_action_getin_ca.paa";
        class Arguments {
            class enabled {
                displayName = ECSTRING(common,Enabled);
                description = CSTRING(KeybindDescription);
                typeName = "BOOL";
                defaultValue = 1;
            };
            class distance {
                displayName = CSTRING(Distance);
                description = CSTRING(DistanceDescription);
                typeName = "NUMBER";
                defaultValue = DEFAULT_DISTANCE;
            };
            class speed {
                displayName = CSTRING(Speed);
                description = CSTRING(SpeedDescription);
                typeName = "NUMBER";
                defaultValue = DEFAULT_SPEED;
            };
        };
        class ModuleDescription {
            description = CSTRING(KeybindDescription);
        };
    };

#define GETIN_ACTIONS \
        class ACE_Actions { \
            class ACE_MainActions { \
                class GVAR(GetIn) { \
                    displayName = "$STR_rscMenu.hppRscGroupRootMenu_Items_GetIn1"; \
                    condition = QUOTE(call DFUNC(canShowFreeSeats)); \
                    statement = QUOTE(call DFUNC(getInNearest)); \
                    exceptions[] = {"isNotSwimming"}; \
                    insertChildren = QUOTE((_this select 2) param [ARR_2(0, [])]); \
                }; \
            }; \
        }; \
        class ACE_SelfActions { \
            class GVAR(ChangeSeat) { \
                displayName = CSTRING(ChangeSeat); \
                condition = QUOTE(call DFUNC(canShowFreeSeats)); \
                statement = ""; \
                insertChildren = QUOTE((_this select 2) param [ARR_2(0, [])]); \
            }; \
        }

    class LandVehicle;
    class Car: LandVehicle {
        GETIN_ACTIONS;
    };
    class Motorcycle: LandVehicle {
        GETIN_ACTIONS;
    };
    class StaticWeapon: LandVehicle {
        GETIN_ACTIONS;
    };
    class Tank: LandVehicle {
        GETIN_ACTIONS;
    };
    class Air;
    class Helicopter: Air {
        GETIN_ACTIONS;
    };
    class Plane: Air {
        GETIN_ACTIONS;
    };
    class Ship;
    class Ship_F: Ship {
        GETIN_ACTIONS;
    };

};
 raP           CfgPatches     Extended_PreStart_EventHandlers    Extended_PreInit_EventHandlers (   Extended_PostInit_EventHandlers    ACE_Settings '   CfgVehicles       ace_quickmount       
units  weapons  requiredVersion    @requiredAddons  ace_common  author $STR_ace_common_ACETeam authors  Kingsley  url $STR_ace_main_URL version QH@ versionStr 3.13.5.57 versionAr          9       ace_quickmount   (    init call compile preprocessFileLineNumbers '\z\ace\addons\quickmount\XEH_preStart.sqf' (    ace_quickmount B      init call compile preprocessFileLineNumbers '\z\ace\addons\quickmount\XEH_preInit.sqf'     ace_quickmount   '    clientInit call compile preprocessFileLineNumbers '\z\ace\addons\quickmount\XEH_postInitClient.sqf' '    ace_quickmount_enabled    ace_quickmount_distance    ace_quickmount_speed    ace_quickmount_priority      movedToSQF       movedToSQF       movedToSQF       movedToSQF       ACE_Module  ace_quickmount_module   LandVehicle  Car    Motorcycle 
   StaticWeapon 9   Tank g  Air  Helicopter    Plane   Ship  Ship_F     ACE_Module  author $STR_ace_common_ACETeam  category ACE  displayName $STR_ace_quickmount_Category  function ace_quickmount_fnc_moduleInit scope    isGlobal    isTriggerActivated     isDisposable      icon a3\ui_f\data\IGUI\Cfg\Actions\Obsolete\ui_action_getin_ca.paa  Arguments    ModuleDescription       enabled    distance    speed       displayName $STR_ace_common_Enabled  description $STR_ace_quickmount_KeybindDescription  typeName BOOL defaultValue        displayName $STR_ace_quickmount_Distance  description $STR_ace_quickmount_DistanceDescription  typeName NUMBER defaultValue        displayName $STR_ace_quickmount_Speed  description $STR_ace_quickmount_SpeedDescription  typeName NUMBER defaultValue        description $STR_ace_quickmount_KeybindDescription   LandVehicle  ACE_Actions    ACE_SelfActions B	  
    ACE_MainActions /  B	    ace_quickmount_GetIn O  B	    displayName $STR_rscMenu.hppRscGroupRootMenu_Items_GetIn1  condition call ace_quickmount_fnc_canShowFreeSeats  statement call ace_quickmount_fnc_getInNearest exceptions  isNotSwimming  insertChildren (_this select 2) param [0,[]] B	    ace_quickmount_ChangeSeat g	  
    displayName $STR_ace_quickmount_ChangeSeat  condition call ace_quickmount_fnc_canShowFreeSeats  statement   insertChildren (_this select 2) param [0,[]] 
  LandVehicle  ACE_Actions B
   ACE_SelfActions p  9    ACE_MainActions ]
  p    ace_quickmount_GetIn }
  p    displayName $STR_rscMenu.hppRscGroupRootMenu_Items_GetIn1  condition call ace_quickmount_fnc_canShowFreeSeats  statement call ace_quickmount_fnc_getInNearest exceptions  isNotSwimming  insertChildren (_this select 2) param [0,[]] p    ace_quickmount_ChangeSeat   9    displayName $STR_ace_quickmount_ChangeSeat  condition call ace_quickmount_fnc_canShowFreeSeats  statement   insertChildren (_this select 2) param [0,[]] 9  LandVehicle  ACE_Actions p   ACE_SelfActions   g    ACE_MainActions       ace_quickmount_GetIn       displayName $STR_rscMenu.hppRscGroupRootMenu_Items_GetIn1  condition call ace_quickmount_fnc_canShowFreeSeats  statement call ace_quickmount_fnc_getInNearest exceptions  isNotSwimming  insertChildren (_this select 2) param [0,[]]     ace_quickmount_ChangeSeat   g    displayName $STR_ace_quickmount_ChangeSeat  condition call ace_quickmount_fnc_canShowFreeSeats  statement   insertChildren (_this select 2) param [0,[]] g  LandVehicle  ACE_Actions    ACE_SelfActions       ACE_MainActions       ace_quickmount_GetIn       displayName $STR_rscMenu.hppRscGroupRootMenu_Items_GetIn1  condition call ace_quickmount_fnc_canShowFreeSeats  statement call ace_quickmount_fnc_getInNearest exceptions  isNotSwimming  insertChildren (_this select 2) param [0,[]]     ace_quickmount_ChangeSeat       displayName $STR_ace_quickmount_ChangeSeat  condition call ace_quickmount_fnc_canShowFreeSeats  statement   insertChildren (_this select 2) param [0,[]]   Air  ACE_Actions    ACE_SelfActions       ACE_MainActions       ace_quickmount_GetIn       displayName $STR_rscMenu.hppRscGroupRootMenu_Items_GetIn1  condition call ace_quickmount_fnc_canShowFreeSeats  statement call ace_quickmount_fnc_getInNearest exceptions  isNotSwimming  insertChildren (_this select 2) param [0,[]]     ace_quickmount_ChangeSeat       displayName $STR_ace_quickmount_ChangeSeat  condition call ace_quickmount_fnc_canShowFreeSeats  statement   insertChildren (_this select 2) param [0,[]]   Air  ACE_Actions    ACE_SelfActions       ACE_MainActions       ace_quickmount_GetIn %      displayName $STR_rscMenu.hppRscGroupRootMenu_Items_GetIn1  condition call ace_quickmount_fnc_canShowFreeSeats  statement call ace_quickmount_fnc_getInNearest exceptions  isNotSwimming  insertChildren (_this select 2) param [0,[]]     ace_quickmount_ChangeSeat =      displayName $STR_ace_quickmount_ChangeSeat  condition call ace_quickmount_fnc_canShowFreeSeats  statement   insertChildren (_this select 2) param [0,[]]   Ship  ACE_Actions    ACE_SelfActions ?      ACE_MainActions ,  ?    ace_quickmount_GetIn L  ?    displayName $STR_rscMenu.hppRscGroupRootMenu_Items_GetIn1  condition call ace_quickmount_fnc_canShowFreeSeats  statement call ace_quickmount_fnc_getInNearest exceptions  isNotSwimming  insertChildren (_this select 2) param [0,[]] ?    ace_quickmount_ChangeSeat d      displayName $STR_ace_quickmount_ChangeSeat  condition call ace_quickmount_fnc_canShowFreeSeats  statement   insertChildren (_this select 2) param [0,[]]       #include "script_component.hpp"
/*
 * Author: Dystopian
 * Creates actions for vehicle free seats.
 *
 * Arguments:
 * 0: Vehicle <OBJECT>
 * 1: Unit <OBJECT>
 *
 * Return Value:
 * Child actions <ARRAY>
 *
 * Example:
 * [cursorObject, player] call ace_quickmount_fnc_addFreeSeatsActions
 *
 * Public: No
 */

#define TAKEN_SEAT_TIMEOUT 0.5

#define ICON_DRIVER    "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_driver_ca.paa"
#define ICON_PILOT     "A3\ui_f\data\IGUI\Cfg\Actions\getinpilot_ca.paa"
#define ICON_CARGO     "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_cargo_ca.paa"
#define ICON_GUNNER    "A3\ui_f\data\IGUI\Cfg\Actions\getingunner_ca.paa"
#define ICON_COMMANDER "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_commander_ca.paa"
#define ICON_TURRET    "A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa"
#define ICON_FFV       "A3\ui_f\data\IGUI\Cfg\CrewAimIndicator\gunnerAuto_ca.paa"

#define TO_COMPARTMENT_STRING(var) if !(var isEqualType "") then {var = format [ARR_2("Compartment%1",var)]}

// if unit isn't moved to new seat in TAKEN_SEAT_TIMEOUT, we move him back to his seat
#define WAIT_IN_OR_MOVE_BACK \
    [ARR_5( \
        {!isNull objectParent (_this select 0)}, \
        { \
            LOG_1("moved in after %1 frames",diag_frameno-GVAR(frame)); \
            (_this select 0) enableSimulation true; \
        }, \
        [ARR_3(_player,_moveBackCode,_moveBackParams)], \
        TAKEN_SEAT_TIMEOUT, \
        { \
            params [ARR_3("_player","_moveBackCode","_moveBackParams")]; \
            WARNING_1("failed move in after %1 frames",diag_frameno-GVAR(frame)); \
            [ARR_2(_player,_moveBackParams)] call _moveBackCode; \
            localize "str_mis_state_failed" call EFUNC(common,displayTextStructured); \
            _player enableSimulation true; \
        } \
    )] call CBA_fnc_waitUntilAndExecute;

#define IS_MOVED_OUT \
( \
    isNull objectParent _player \
    && { \
        [] isEqualTo _currentTurret \
        || {local _target isEqualTo (_target turretLocal _currentTurret)} \
    } \
)

#define MOVE_IN_CODE(command) (_this select 0) command (_this select 1)

private _fnc_move = {
    (_this select 2) params ["_moveInCode", "_moveInParams", "_currentTurret", "_moveBackCode", "_moveBackParams", ["_enabledByAnimationSource", ""]];
    TRACE_7("fnc_move params",_moveInCode,_moveInParams,_currentTurret,_moveBackCode,_moveBackParams,_enabledByAnimationSource,call {GVAR(frame)=diag_frameno});

    // workaround getting damage when moveOut while vehicle is moving
    // also this helps with arma bug when unit is stuck in wrong anim when move in turret with configured enabledByAnimationSource
    _player enableSimulation false;

    private _preserveEngineOn = _player == driver _target && {isEngineOn _target};
    moveOut _player;
    if (_preserveEngineOn) then {_target engineOn true};

    // moveIn right after moveOut doesn't work in MP for non-local vehicles, player just stays out
    // so we have to wait some time (e.g. until player is out and turret locality become vehicle locality)
    // usually it's done in the same frame for local vehicles/turrets and takes 3-7 frames for non-local, so in MP can look a little lagging
    if (IS_MOVED_OUT) exitWith {
        LOG("moved out in current frame");
        [_player, _moveInParams] call _moveInCode;
        WAIT_IN_OR_MOVE_BACK;
    };
    [
        {params ["_target", "_player", "_currentTurret"]; IS_MOVED_OUT},
        {
            params ["", "_player", "", "_moveInCode", "_moveInParams", "_moveBackCode", "_moveBackParams"];
            LOG_2("moved out after %1 frames",diag_frameno-GVAR(frame),call {GVAR(frame)=diag_frameno; 0});
            [_player, _moveInParams] call _moveInCode;
            WAIT_IN_OR_MOVE_BACK;
        },
        [_target, _player, _currentTurret, _moveInCode, _moveInParams, _moveBackCode, _moveBackParams]
    ] call CBA_fnc_waitUntilAndExecute;
};

scopeName "main";

params ["_vehicle", "_player"];

private _vehicleConfig = configFile >> "CfgVehicles" >> typeOf _vehicle;
private _isInVehicle = _player in _vehicle;
private _fullCrew = fullCrew [_vehicle, "", true];

private ["_driverCompartments", "_isDriverIsolated", "_cargoCompartments", "_cargoCompartmentsLast", "_compartment", "_currentTurret", "_moveBackCode", "_moveBackParams"];

if (_isInVehicle) then {
    _driverCompartments = (_vehicleConfig >> "driverCompartments") call BIS_fnc_getCfgData;
    // Air class by default has driverCompartments=0 and cargoCompartments[]={0}, so we have to disable them
    _isDriverIsolated = _driverCompartments isEqualTo 0 && {_vehicle isKindOf "Air"};
    TO_COMPARTMENT_STRING(_driverCompartments);

    _cargoCompartments = getArray (_vehicleConfig >> "cargoCompartments");
    {
        if !(_x isEqualType "") then {
            _cargoCompartments set [_forEachIndex, format ["Compartment%1", _x]];
        };
    } forEach _cargoCompartments;
    _cargoCompartmentsLast = count _cargoCompartments - 1;

    // find current compartment
    (
        _fullCrew select (_fullCrew findIf {_player == _x select 0})
    ) params ["", "_role", "_cargoIndex", "_turretPath"];

    _currentTurret = _turretPath;

    switch (_role) do {
        case "driver": {
            if (_isDriverIsolated) then {
                [] breakOut "main";
            };
            _compartment = _driverCompartments;
            _moveBackCode = {MOVE_IN_CODE(moveInDriver)};
            _moveBackParams = _vehicle;
        };
        case "cargo": {
            private _cargoNumber = fullCrew [_vehicle, "cargo", true] findIf {_player == _x select 0};
            _compartment = _cargoCompartments select (_cargoNumber min _cargoCompartmentsLast);
            _moveBackCode = {MOVE_IN_CODE(moveInCargo)};
            _moveBackParams = [_vehicle, _cargoIndex];
        };
        default {
            private _turretConfig = [_vehicleConfig, _turretPath] call CBA_fnc_getTurret;
            _compartment = (_turretConfig >> "gunnerCompartments") call BIS_fnc_getCfgData;
            TO_COMPARTMENT_STRING(_compartment);
            _moveBackCode = {MOVE_IN_CODE(moveInTurret)};
            _moveBackParams = [_vehicle, _turretPath];
        };
    };
    TRACE_6("current",_role,_cargoIndex,_turretPath,_compartment,_driverCompartments,_cargoCompartments);
};

private _actions = [];
private _cargoNumber = -1;
{
    scopeName "crewLoop";
    _x params ["_unit", "_role", "_cargoIndex", "_turretPath", "_isPersonTurret"];
    if (!isNull _unit && {alive _unit}) then {
        if (_role == "cargo") then {
            INC(_cargoNumber);
        };
    } else {
        private ["_name", "_icon", "_statement", "_params"];
        switch (toLower _role) do {
            case "driver": {
                if (
                    lockedDriver _vehicle
                    || {unitIsUAV _vehicle}
                    || {0 == getNumber (_vehicleConfig >> "hasDriver")}
                ) then {
                    breakTo "crewLoop";
                };
                if (_isInVehicle) then {
                    if (_compartment != _driverCompartments || {_isDriverIsolated}) then {breakTo "crewLoop"};
                    _params = [{MOVE_IN_CODE(moveInDriver)}, _vehicle, _currentTurret, _moveBackCode, _moveBackParams];
                    _statement = _fnc_move;
                } else {
                    _params = ["GetInDriver", _vehicle];
                    _statement = {_player action (_this select 2)};
                };
                if (_vehicle isKindOf "Air") then {
                    _name = localize "str_getin_pos_pilot";
                    _icon = ICON_PILOT;
                } else {
                    _name = localize "str_driver";
                    _icon = ICON_DRIVER;
                };
            };
            case "cargo": {
                INC(_cargoNumber);
                if (_vehicle lockedCargo _cargoIndex) then {breakTo "crewLoop"};
                if (_isInVehicle) then {
                    if (_compartment != (_cargoCompartments select (_cargoNumber min _cargoCompartmentsLast))) then {breakTo "crewLoop"};
                    _params = [{MOVE_IN_CODE(moveInCargo)}, [_vehicle, _cargoIndex], _currentTurret, _moveBackCode, _moveBackParams];
                    _statement = _fnc_move;
                } else {
                    _params = ["GetInCargo", _vehicle, _cargoNumber];
                    _statement = {_player action (_this select 2)};
                };
                _name = format ["%1 %2", localize "str_getin_pos_passenger", _cargoNumber + 1];
                _icon = ICON_CARGO;
            };
            default { // all turrets including FFV
                if (_vehicle lockedTurret _turretPath) then {breakTo "crewLoop"};
                if (_role == "gunner" && {unitIsUAV _vehicle}) then {breakTo "crewLoop"};
                private _turretConfig = [_vehicleConfig, _turretPath] call CBA_fnc_getTurret;
                if (!_isInVehicle) then {
                    _params = ["GetInTurret", _vehicle, _turretPath];
                    _statement = {_player action (_this select 2)};
                } else {
                    private _gunnerCompartments = (_turretConfig >> "gunnerCompartments") call BIS_fnc_getCfgData;
                    TO_COMPARTMENT_STRING(_gunnerCompartments);
                    if (_compartment != _gunnerCompartments) then {breakTo "crewLoop"};
                    _params = [{MOVE_IN_CODE(moveInTurret)}, [_vehicle, _turretPath], _currentTurret, _moveBackCode, _moveBackParams, _enabledByAnimationSource];
                    _statement = _fnc_move;
                };
                _name = getText (_turretConfig >> "gunnerName");
                _icon = switch true do {
                    case (0 < getNumber (_turretConfig >> "isCopilot")): {ICON_PILOT};
                    case (_role == "gunner"): {ICON_GUNNER};
                    case (_role == "commander"): {ICON_COMMANDER};
                    case (_isPersonTurret): {ICON_FFV};
                    case ("" isEqualTo getText (_turretConfig >> "gun")): {ICON_CARGO};
                    default {ICON_TURRET};
                };
            };
        };
        private _action = [
            format ["%1%2%3", _role, _cargoIndex, _turretPath],
            _name, _icon, _statement, {true}, {}, _params
        ] call EFUNC(interact_menu,createAction);
        _actions pushBack [_action, [], _vehicle];
    };
} forEach _fullCrew;

_actions
#include "script_component.hpp"
/*
 * Author: Dystopian
 * Checks if Free Seats menu can be shown.
 *
 * Arguments:
 * 0: Vehicle <OBJECT>
 * 1: Unit <OBJECT>
 * 2: Args <ARRAY>
 *
 * Return Value:
 * Can show menu <BOOL>
 *
 * Example:
 * [cursorObject, player] call ace_quickmount_fnc_canShowFreeSeats
 *
 * Public: No
 */

params ["_vehicle", "_unit", "_args"];

_args set [0, []];
private _isInVehicle = _unit in _vehicle;

GVAR(enabled)
&& {
    GVAR(enableMenu) == 3
    || {_isInVehicle && {GVAR(enableMenu) == 2}}
    || {!_isInVehicle && {GVAR(enableMenu) == 1}}
}
&& {alive _vehicle}
&& {2 > locked _vehicle}
&& {simulationEnabled _vehicle}
&& {
    -1 == crew _vehicle findIf {alive _x}
    || {0.6 <= side group _unit getFriend side group _vehicle}
}
&& {
    0.3 < vectorUp _vehicle select 2 // moveIn* and GetIn* don't work for flipped vehicles
    || {_vehicle isKindOf "Air"} // except Air
}
&& {
    private _subActions = _this call FUNC(addFreeSeatsActions);
    _args set [0, _subActions];
    !([] isEqualTo _subActions)
}
#include "script_component.hpp"
/*
 * Author: Kingsley
 * Mount the player in the vehicle they are directly looking at based on their distance.
 *
 * Arguments:
 * 0: Target <OBJECT>(Optional)
 *
 * Return Value:
 * None
 *
 * Example:
 * [] call ace_quickmount_fnc_getInNearest;
 *
 * Public: No
 */

if (!GVAR(enabled) ||
    {isNull ACE_player} ||
    {vehicle ACE_player != ACE_player} ||
    {!alive ACE_player} ||
    {ACE_player getVariable ["ace_unconscious", false]}
) exitWith {};

params [["_interactionTarget", objNull, [objNull]]];
TRACE_1("getInNearest",_interactionTarget);

private _start = AGLtoASL (ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot"));
private _end = (_start vectorAdd (getCameraViewDirection ACE_player vectorMultiply GVAR(distance)));
private _objects = lineIntersectsSurfaces [_start, _end, ACE_player];
private _target = (_objects param [0, []]) param [2, objNull];

if ((isNull _target) && {alive _interactionTarget}) then {
    _end = _start vectorAdd ((_start vectorFromTo (aimPos _interactionTarget)) vectorMultiply GVAR(distance));
    _objects = lineIntersectsSurfaces [_start, _end, ACE_player];
    TRACE_1("2nd ray attempt at interaction target aim pos",_objects);
    _target = (_objects param [0, []]) param [2, objNull];
};

if (locked _target in [2,3] || {!simulationEnabled _target}) exitWith {
    [localize LSTRING(VehicleLocked)] call EFUNC(common,displayTextStructured);
    true
};

TRACE_2("",_target,typeOf _target);

if (!isNull _target &&
        {alive _target} &&
        {{_target isKindOf _x} count ["Air","LandVehicle","Ship","StaticMortar"] > 0} &&
        {([ACE_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith))} &&
        {speed _target <= GVAR(speed)}
        ) then {


    if (GVAR(priority) > 3 || GVAR(priority) < 0) then {
        GVAR(priority) = 0;
    };

    private _seats = ["Driver", "Gunner", "Commander", "Cargo"];
    private _sortedSeats = [_seats select GVAR(priority)];
    _seats deleteAt GVAR(priority);
    _sortedSeats append _seats;


    private _hasAction = false;
    scopeName "SearchForSeat";
    {
        private _desiredRole = _x;
        {
            _x params ["_unit", "_role", "_cargoIndex", "_turretPath"];
            if ((isNull _unit) || {!alive _unit}) then {
                private _effectiveRole = toLower _role;

                if ((_effectiveRole in ["driver", "gunner"]) && {unitIsUAV _target}) exitWith {}; // Ignoring UAV Driver/Gunner
                if ((_effectiveRole == "driver") && {(getNumber (([_target] call CBA_fnc_getObjectConfig) >> "hasDriver")) == 0}) exitWith {}; // Ignoring Non Driver (static weapons)

                // Seats can be locked independently of the main vehicle
                if ((_role == "driver") && {lockedDriver _target}) exitWith {TRACE_1("lockedDriver",_x);};
                if ((_cargoIndex >= 0) && {_target lockedCargo _cargoIndex}) exitWith {TRACE_1("lockedCargo",_x);};
                if ((!(_turretPath isEqualTo [])) && {_target lockedTurret _turretPath}) exitWith {TRACE_1("lockedTurret",_x);};

                if (_effectiveRole == "turret") then {
                    private _turretConfig = [_target, _turretPath] call CBA_fnc_getTurret;
                    if (getNumber (_turretConfig >> "isCopilot") == 1) exitWith {
                        _effectiveRole = "driver";
                    };
                    if (
                        _cargoIndex >= 0 // FFV
                        || {"" isEqualTo getText (_turretConfig >> "gun")} // turret without weapon
                    ) exitWith {
                        _effectiveRole = "cargo";
                    };
                    _effectiveRole = "gunner"; // door gunners / 2nd turret
                };
                TRACE_2("",_effectiveRole,_x);
                if (_effectiveRole != _desiredRole) exitWith {};

                if (!(_turretPath isEqualTo [])) then {
                     // Using GetInTurret seems to solve problems with incorrect GetInEH params when gunner/commander
                    ACE_player action ["GetInTurret", _target, _turretPath];
                    TRACE_3("Geting In Turret",_x,_role,_turretPath);
                } else {
                    if (_cargoIndex > -1) then {
                        // GetInCargo expects the index of the seat in the "cargo" array from fullCrew
                        // See description: https://community.bistudio.com/wiki/fullCrew
                        private _cargoActionIndex = -1;
                        {
                            if ((_x select 2) == _cargoIndex) exitWith {_cargoActionIndex = _forEachIndex};
                        } forEach (fullCrew [_target, "cargo", true]);

                        ACE_player action ["GetInCargo", _target, _cargoActionIndex];
                        TRACE_4("Geting In Cargo",_x,_role,_cargoActionIndex,_cargoIndex);
                    } else {
                        ACE_player action ["GetIn" + _role, _target];
                        TRACE_2("Geting In",_x,_role);
                    };
                };

                _hasAction = true;
                breakTo "SearchForSeat";
            };
        } forEach (fullCrew [_target, "", true]);
    } forEach _sortedSeats;

    if (!_hasAction) then {
        TRACE_1("no empty seats",_hasAction);
        [localize LSTRING(VehicleFull)] call EFUNC(common,displayTextStructured);
    };
};

true
#include "script_component.hpp"
/*
 * Author: Kingsley
 * Initializes the quick-mount module.
 *
 * Arguments:
 * 0: The module logic <LOGIC>
 * 1: Units <ARRAY> (Unused)
 * 2: Activated <BOOL>
 *
 * Return Value:
 * None
 *
 * Public: No
 */

if (!isServer) exitWith {};

params ["_logic", "", "_activated"];

if (!_activated) exitWith {};

[_logic, QGVAR(enabled), "enabled"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(distance), "distance"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(speed), "speed"] call EFUNC(common,readSettingFromModule);
#include "\z\ace\addons\quickmount\script_component.hpp"
[
    QGVAR(enabled),
    "CHECKBOX",
    [ELSTRING(common,Enabled), LSTRING(EnabledDescription)],
    format ["ACE %1", LLSTRING(Category)],
    true,
    true
] call CBA_settings_fnc_init;

[
    QGVAR(distance),
    "SLIDER",
    [LSTRING(Distance), LSTRING(DistanceDescription)],
    format ["ACE %1", LLSTRING(Category)],
    [0, 10, DEFAULT_DISTANCE, 0],
    true
] call CBA_settings_fnc_init;

[
    QGVAR(speed),
    "SLIDER",
    [LSTRING(Speed), LSTRING(SpeedDescription)],
    format ["ACE %1", LLSTRING(Category)],
    [0, 30, DEFAULT_SPEED, 0],
    true
] call CBA_settings_fnc_init;

[
    QGVAR(priority),
    "LIST",
    [LSTRING(Priority), LSTRING(PriorityDescription)],
    format ["ACE %1", LLSTRING(Category)],
    [[0, 1, 2, 3], ["str_getin_pos_driver", "str_getin_pos_gunn", "str_getin_pos_comm", "str_getin_pos_passenger"], DEFAULT_PRIORITY],
    false
] call CBA_settings_fnc_init;

[
    QGVAR(enableMenu),
    "LIST",
    ELSTRING(interact_menu,Category_InteractionMenu),
    format ["ACE %1", LLSTRING(Category)],
    [
        [0,1,2,3],
        [
            "STR_A3_None",
            "STR_rscMenu.hppRscGroupRootMenu_Items_GetIn1",
            LSTRING(ChangeSeat),
            "str_word_all"
        ],
        3
    ]
] call CBA_settings_fnc_init;
ace_quickmount
============
Adds a keybind to quickly enter the vehicle you are directly looking at.

## Maintainers

The people responsible for merging changes to this component or answering potential questions.

- [Kingsley](https://github.com/jameslkingsley)
#define COMPONENT quickmount
#define COMPONENT_BEAUTIFIED Quick Mount
#include "\z\ace\addons\main\script_mod.hpp"

// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS

#ifdef DEBUG_ENABLED_QUICKMOUNT
    #define DEBUG_MODE_FULL
#endif

#ifdef DEBUG_SETTINGS_QUICKMOUNT
    #define DEBUG_SETTINGS DEBUG_SETTINGS_QUICKMOUNT
#endif

#include "\z\ace\addons\main\script_macros.hpp"

#define DEFAULT_DISTANCE 3
#define DEFAULT_SPEED 18
#define DEFAULT_PRIORITY 0
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
    <Package name="QuickMount">
        <Key ID="STR_ACE_QuickMount_Category">
            <English>Quick Mount</English>
            <German>Schnellzugang</German>
            <Italian>Entrata Rapida</Italian>
            <Japanese>クイック マウント</Japanese>
            <Chinesesimp>快速搭乘</Chinesesimp>
            <Chinese>快速搭乘</Chinese>
            <Polish>Szybkie wsiadanie</Polish>
            <Korean>빠른 탑승</Korean>
            <Russian>Быстрая посадка</Russian>
            <Portuguese>Entrada Rápida</Portuguese>
            <French>Entrée rapide</French>
            <Czech>Rychlé nastoupení</Czech>
        </Key>
        <Key ID="STR_ACE_QuickMount_KeybindName">
            <English>Vehicle quick mount</English>
            <German>Fahrzeug-Schnellzugang</German>
            <Polish>Szybkie wsiadanie do pojazdu</Polish>
            <Italian>Entrata rapida veicolo</Italian>
            <Japanese>車両クイック マウント</Japanese>
            <Chinesesimp>快速搭乘载具</Chinesesimp>
            <Chinese>快速搭乘載具</Chinese>
            <Korean>빠른 차량 탑승</Korean>
            <Russian>Быстрая посадка в технику</Russian>
            <Portuguese>Entrada Rápida em Veículo</Portuguese>
            <French>Entrée rapide véhicules</French>
            <Czech>Rychlé nastoupení do vozidla</Czech>
        </Key>
        <Key ID="STR_ACE_QuickMount_KeybindDescription">
            <English>Quickly enter the vehicle you are directly looking at.</English>
            <German>Schnellzugang in das Fahrzeug, welches man direkt anschaut.</German>
            <Italian>Entra velocemente nel veicolo che stai guardando.</Italian>
            <Japanese>見ている車両へ迅速に搭乗します。</Japanese>
            <Chinesesimp>快速进入你正在看的载具之中</Chinesesimp>
            <Chinese>快速進入你正在看的載具之中</Chinese>
            <Polish>Szybko wsiądź do pojazdu, na który patrzysz.</Polish>
            <Korean>빠르게 당신이 보고 있는 가까운 차량에 탑승합니다. </Korean>
            <Russian>Позволяет быстро сесть в технику, на которую вы смотрите</Russian>
            <Portuguese>Rapidamente entra no veículo que você está olhando diretamente.</Portuguese>
            <French>Permet d'entrer rapidement dans le véhicule que vous regardez.</French>
            <Czech>Rychle nastoupit do vozidla na které se díváte.</Czech>
            <Turkish>Doğrudan bakmakta olduğunuz araca hızla girin.</Turkish>
        </Key>
        <Key ID="STR_ACE_QuickMount_VehicleFull">
            <English>Vehicle Full</English>
            <German>Fahrzeug voll</German>
            <Italian>Veicolo Pieno</Italian>
            <Japanese>車両は満員です</Japanese>
            <Chinesesimp>载具已满</Chinesesimp>
            <Chinese>載具已滿</Chinese>
            <Polish>Pojazd pełny</Polish>
            <Korean>만차</Korean>
            <Russian>Мест нет</Russian>
            <Portuguese>Veículo cheio</Portuguese>
            <French>Véhicule plein</French>
            <Czech>Vozidlo je plné</Czech>
            <Turkish>Araç Dolu</Turkish>
        </Key>
        <Key ID="STR_ACE_QuickMount_EnabledDescription">
            <English>This option allows quick entry into the vehicle you are directly looking at.</English>
            <French>Cette option permet d'entrer rapidement dans les véhicules que vous regardez.</French>
            <Chinese>這個選項允許你能快速進入你直視的載具</Chinese>
            <Polish>Ta opcja umożliwia szybkie wsiadanie do pojazdu na który patrzysz.</Polish>
            <Portuguese>Esta opção permite entrada rápida para o veículo que você está olhando</Portuguese>
            <Japanese>この機能により直接見ている車両へすぐさま搭乗できます。</Japanese>
            <Italian>Questa opzione permette l'entrata rapida nel veicolo che si sta guardando.</Italian>
            <Turkish>Bu seçenek, doğrudan bakmakta olduğunuz araca hızlı giriş sağlar.</Turkish>
            <Czech>Tato možnost umožňuje rychle nastoupit do vozidla na které se díváte.</Czech>
            <Russian>Эта опция разрешает быстро залезть в транспорт, на который вы смотрите.</Russian>
        </Key>
        <Key ID="STR_ACE_QuickMount_Distance">
            <English>Distance</English>
            <German>Entfernung</German>
            <Italian>Distanza</Italian>
            <Japanese>距離</Japanese>
            <Chinesesimp>距离</Chinesesimp>
            <Chinese>距離</Chinese>
            <Polish>Odległość</Polish>
            <Korean>거리</Korean>
            <Russian>Дистанция</Russian>
            <Portuguese>Distância</Portuguese>
            <French>Distance</French>
            <Czech>Vzdálenost</Czech>
            <Turkish>Mesafe</Turkish>
        </Key>
        <Key ID="STR_ACE_QuickMount_DistanceDescription">
            <English>Maximum distance to check for vehicles.</English>
            <German>Maximale Entfernung zu Fahrzeugen</German>
            <Italian>Distanza massima per controllare i veicoli.</Italian>
            <Japanese>車両を検知できる最大距離を設定します。</Japanese>
            <Chinesesimp>最大可检查载具的距离.</Chinesesimp>
            <Chinese>最大可檢查載具的距離</Chinese>
            <Polish>Maksymalna odległość do pojazdu.</Polish>
            <Korean>탑승 가능한 차량과의 거리</Korean>
            <Russian>Максимальная дистанция для техники</Russian>
            <Portuguese>Distância máxima para checar por veículos.</Portuguese>
            <French>Distance de vérification maximale des véhicules.</French>
            <Czech>Maximální vzdálenost od vozidel.</Czech>
            <Turkish>Araçların kontrol edilmesi için maksimum mesafe.</Turkish>
        </Key>
        <Key ID="STR_ACE_QuickMount_VehicleLocked">
            <English>Vehicle Locked</English>
            <German>Fahrzeug abgeschlossen</German>
            <Italian>Veicolo Bloccato.</Italian>
            <Japanese>車両は施錠されています</Japanese>
            <Chinesesimp>载具已上锁</Chinesesimp>
            <Chinese>載具已上鎖</Chinese>
            <Polish>Pojazd zablokowany</Polish>
            <Korean>차량 잠김</Korean>
            <Russian>Техника закрыта</Russian>
            <Portuguese>Veículo Trancado</Portuguese>
            <French>Véhicule verrouillé</French>
            <Czech>Vozidlo je zamčeno</Czech>
            <Turkish>Araç Kilitli</Turkish>
        </Key>
        <Key ID="STR_ACE_QuickMount_Speed">
            <English>Maximum Speed (km/h)</English>
            <German>Maximale Geschwindigkeit (km/h)</German>
            <Italian>Velocità Massima (km/h)</Italian>
            <Japanese>最高速度 (km/h)</Japanese>
            <Chinesesimp>最高速度 (公里/小时)</Chinesesimp>
            <Chinese>最高速度 (公里/小時)</Chinese>
            <Polish>Maksymalna prędkość (km/h)</Polish>
            <Korean>최대 속도 (km/h)</Korean>
            <Russian>Макс. скорость (км/ч)</Russian>
            <Portuguese>Velocidade Máxima (km/h)</Portuguese>
            <French>Vitesse maximale (km/h)</French>
            <Czech>Maximální rychlost (km/h)</Czech>
            <Turkish>Yüksek Hız (km/h)</Turkish>
        </Key>
        <Key ID="STR_ACE_QuickMount_SpeedDescription">
            <English>Maximum vehicle speed (km/h) allowed for player entry</English>
            <German>Maximale erlaubte Geschwindigkeit (km/h) für Schnellzugang</German>
            <Italian>Velocità massima del veicolo (km/h) consentita per far salire un giocatore</Italian>
            <Japanese>プレイヤーが搭乗できる最高速度 (km/h) を設定します。</Japanese>
            <Chinesesimp>设置玩家能在最高速度是多少的情况之下进入载具。</Chinesesimp>
            <Chinese>設置玩家能在最高多少的速度之下進入載具</Chinese>
            <Polish>Maksymalna prędkość pojazdu (km/h) pozwalająca graczowi wsiąść.</Polish>
            <Korean>플레이어가 탑승 가능한 목표 차량의 최대 속도</Korean>
            <Russian>Макс. скорость техники для посадки игрока (км/ч)</Russian>
            <Portuguese>Velocidade máxima que o veículo pode estar para permitr entrada rápida.</Portuguese>
            <French>Définit la vitesse maximale que peut avoir un véhicule en mouvement pour qu'un joueur réussisse à y entrer.</French>
            <Czech>Maximální rychlost vozidla (km/h) při které hráči mohou nastoupit do vozidla</Czech>
            <Turkish>Oyuncu binmesi için izin verilen maksimum araç hızı (km / s)</Turkish>
        </Key>
        <Key ID="STR_ACE_QuickMount_Priority">
            <English>Prioritize Seat</English>
            <German>Priorisierter Sitzplatz</German>
            <Italian>Priorità Sedile</Italian>
            <Japanese>優先席</Japanese>
            <Chinesesimp>优先位置</Chinesesimp>
            <Chinese>優先座位</Chinese>
            <Polish>Priorytet zajmowanych pozycji</Polish>
            <Korean>좌석 우선순위 지정</Korean>
            <Russian>Приоритет мест</Russian>
            <Portuguese>Priorizar Assento</Portuguese>
            <French>Place prioritaire</French>
            <Czech>Priorita sedadel</Czech>
            <Turkish>Koltuğa Öncelik Ver</Turkish>
        </Key>
        <Key ID="STR_ACE_QuickMount_PriorityDescription">
            <English>Seat priority on entry</English>
            <German>Priorisierter Sitzplatz zum Schnellzugang</German>
            <Italian>Priorità del sedile in entrata</Italian>
            <Japanese>搭乗時の優先順位をします。</Japanese>
            <Chinesesimp>优先想进入哪个位置。</Chinesesimp>
            <Chinese>優先想進入哪個座位</Chinese>
            <Polish>Priorytet pozycji w pojeździe</Polish>
            <Korean>탑승할 좌석의 우선순위를 지정합니다.</Korean>
            <Russian>Приоритет мест при посадке</Russian>
            <Portuguese>Define qual o assento que vai priorizar a Entrada Rápida</Portuguese>
            <French>Définit à quel poste s'asseoir en priorité lors de l'embarquement.</French>
            <Czech>Priorita sedadla při nástupu</Czech>
            <Turkish>Araça binerken koltuk önceliği</Turkish>
        </Key>
        <Key ID="STR_ACE_QuickMount_ChangeSeat">
            <English>Change seat</English>
            <German>Sitz wechseln</German>
            <Russian>Пересесть</Russian>
            <Japanese>席の変更</Japanese>
            <Polish>Zmień zajmowaną pozycję</Polish>
            <Italian>Cambia posto</Italian>
            <Portuguese>Mudar de Assento</Portuguese>
            <Chinese>換座位</Chinese>
            <French>Changer de place</French>
            <Czech>Změnit sedadlo</Czech>
            <Turkish>Koltuk Değiştir</Turkish>
        </Key>
    </Package>
</Project>
#include "script_component.hpp"

if (!hasInterface) exitWith {};

["ACE3 Movement", QGVAR(mount), [localize LSTRING(KeybindName), localize LSTRING(KeybindDescription)], "", {
    if (!dialog) then {
        [] call FUNC(getInNearest);
    };
    false
}] call CBA_fnc_addKeybind;
#include "script_component.hpp"

ADDON = false;

PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#include "initSettings.sqf"

ADDON = true;
PREP(addFreeSeatsActions);
PREP(canShowFreeSeats);
PREP(getInNearest);
PREP(moduleInit);
#include "script_component.hpp"

#include "XEH_PREP.hpp"
 ˏLPIW8nt
