ACE3/addons/viewports/functions/fnc_getSeatInfo.sqf
PabstMirror a4258f3587
Viewports (#8480)
* Viewports

* Support mem-points

* Update CfgVehicles.hpp

* Add some docs

* Cleanup Debugging

* Update addons/viewports/dev/debugPoints.sqf

Co-authored-by: Dystopian <sddex@ya.ru>

* Update addons/viewports/dev/debugPoints.sqf

Co-authored-by: Dystopian <sddex@ya.ru>

* Update addons/viewports/functions/fnc_eachFrame.sqf

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* configProperties / 3den macro

* Update viewports-framework.md

* Update viewports-framework.md

* Add compats for rhs btrs

* Update addons/viewports/dev/debugPoints.sqf

Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>

Co-authored-by: Dystopian <sddex@ya.ru>
Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>
Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>
2022-05-17 11:55:09 -05:00

47 lines
1.4 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Dystopian, PabstMirror
* Adapted from quickmount's addFreeSeatsActions
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* ARRAY
*
* Example:
* [player] call ace_viewports_fnc_getSeatInfo
*
* Public: No
*/
params ["_unit"];
private _vehicle = vehicle _unit;
if (_vehicle == _unit) exitWith { [] };
private _vehicleConfig = configOf _vehicle;
private _fullCrew = fullCrew [_vehicle, "", false];
(_fullCrew select (_fullCrew findIf {_unit == _x select 0})) params ["", "_role", "_cargoIndex", "_turretPath"];
private _compartment = switch (_role) do {
case "driver": {
(_vehicleConfig >> "driverCompartments") call BIS_fnc_getCfgData
};
case "cargo": {
// note: cargoNumber is different from the cargoIndex from fullCrew...
private _cargoNumber = fullCrew [_vehicle, "cargo", true] findIf {_unit == _x select 0};
private _cargoCompartments = getArray (_vehicleConfig >> "cargoCompartments");
private _cargoCompartmentsLast = count _cargoCompartments - 1;
_cargoCompartments select (_cargoNumber min _cargoCompartmentsLast)
};
default {
private _turretConfig = [_vehicleConfig, _turretPath] call CBA_fnc_getTurret;
(_turretConfig >> "gunnerCompartments") call BIS_fnc_getCfgData
};
};
if (!(_compartment isEqualType "")) then { _compartment = format ["Compartment%1",_compartment] };
[_role, _cargoIndex, _turretPath, _compartment]