mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
64 lines
2.1 KiB
Plaintext
64 lines
2.1 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: PabstMirror
|
|
* Finds turret owner of a pylon.
|
|
*
|
|
* Arguments:
|
|
* 0: Vehicle <OBJECT>
|
|
* 1: Pylon Index (starting at 0) <NUMBER>
|
|
*
|
|
* Return Value:
|
|
* * Turret index (either [-1] or [0]) <ARRAY>
|
|
*
|
|
* Example:
|
|
* [cursorObject, 0] call ace_common_fnc_getPylonTurret
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_vehicle", "_pylonIndex"];
|
|
|
|
// See if index is in ace_pylonTurrets setVar on vehicle
|
|
private _pylonTurrets = _vehicle getVariable ["ace_pylonTurrets", []];
|
|
private _returnValue = _pylonTurrets param [_pylonIndex, []];
|
|
|
|
if (!(_returnValue isEqualTo [])) then {
|
|
TRACE_1("Using ace_pylonTurrets value",_returnValue);
|
|
} else {
|
|
// Attempt to determine turret owner based on magazines in the vehicle
|
|
private _pyMags = getPylonMagazines _vehicle;
|
|
private _pylonConfigs = configProperties [configFile >> "CfgVehicles" >> typeOf _vehicle >> "Components" >> "TransportPylonsComponent" >> "Pylons", "isClass _x"];
|
|
if (_pylonIndex >= (count _pyMags)) exitWith {ERROR("out of bounds");};
|
|
if (_pylonIndex >= (count _pylonConfigs)) exitWith {ERROR("out of bounds");};
|
|
|
|
private _targetMag = _pyMags select _pylonIndex;
|
|
private _inPilot = _targetMag in (_vehicle magazinesTurret [-1]);
|
|
private _inGunner = _targetMag in (_vehicle magazinesTurret [0]);
|
|
|
|
if (_inPilot) then {
|
|
if (_inGunner) then {
|
|
TRACE_3("ambiguous - in both",_targetMag,_inPilot,_inGunner);
|
|
} else {
|
|
TRACE_3("Pilot Mag",_targetMag,_inPilot,_inGunner);
|
|
_returnValue = [-1];
|
|
};
|
|
} else {
|
|
if (_inGunner) then {
|
|
TRACE_3("Gunner Mag",_targetMag,_inPilot,_inGunner);
|
|
_returnValue = [0];
|
|
} else {
|
|
TRACE_3("ambiguous - in neither",_targetMag,_inPilot,_inGunner);
|
|
};
|
|
};
|
|
|
|
if (_returnValue isEqualTo []) then { // If not sure, just use config value
|
|
_returnValue = getArray ((_pylonConfigs select _pylonIndex) >> "turret");
|
|
if (_returnValue isEqualTo []) then {
|
|
_returnValue = [-1];
|
|
};
|
|
};
|
|
};
|
|
|
|
TRACE_3("",_vehicle,_pylonIndex,_returnValue);
|
|
_returnValue
|