This commit is contained in:
TheMagnetar 2018-02-05 22:01:03 +01:00
parent 6cc05038ff
commit c4ef630b1e
7 changed files with 41 additions and 8 deletions

View File

@ -40,6 +40,7 @@ if (_startNewLoop) then {
// start a new position update loop
GVAR(positionUpdatePFEH) = [{
{
systemChat format ["updating position"];
if (ACE_time - (AD_GET_TIME(_x)) >= (AD_GET_REFRESH_RATE(_x))) then {
if (AD_GET_DEVICE_STATE_VALUE(_x) isEqualTo STATE_NORMAL) then {
private _deviceOwner = AD_GET_OWNER(_x);

View File

@ -28,7 +28,7 @@ private _targetOffSet = [];
// see if given unit name is still in the list of units with valid helmet cams
{
if (_data == str _x) exitWith {_newHost = _x;};
} count GVAR(hCamList);
} forEach GVAR(hCamList);
call {
// should unit not be in a vehicle

View File

@ -35,7 +35,7 @@ private _uav = objNull;
private _uavDeviceData = _x select 1;
_uav = D_GET_OWNER(_uavDeviceData);
};
} count GVAR(UAVlist);
} forEach GVAR(UAVlist);
// remove exisitng UAV cameras
[] call FUNC(deleteUAVcam);
@ -79,7 +79,7 @@ if (!alive _uav) exitWith {false};
};
GVAR(UAVcams) pushBack [_uav,_renderTarget,_cam,_camPosMemPt,_camDirMemPt];
};
} count _uavCams;
} forEach _uavCams;
// set up event handler
if !(GVAR(UAVcams) isEqualTo []) exitWith {

View File

@ -550,7 +550,7 @@ if (isNil "_mode") then {
};
// ----------------------------------
};
} forEach ([_settings] call CBA_fnc_hashKeys);
} forEach (_settings select 1);
// update scale and world position if we have to. If so, fill in the blanks and make the changes
if ((!isNil "_targetMapScale") || (!isNil "_targetMapWorldPos")) then {

View File

@ -21,11 +21,43 @@
// see if there is a selected UAV and if it is alive before continuing
if (isNil QGVAR(actUav) || {!alive GVAR(actUav)}) exitWith {false};
private _hasUavTraining = ace_player getVariable ["ACE_uavOperator", false];
if (!_hasUavTraining) exitWith {
["UAV","Action denied. You lack required training.",5] call FUNC(addNotification);
false
};
// make sure there is noone currently controlling the gunner seat
// unfortunately this fails as soon as there is a driver connected as only one unit is returned using UAVControl and it will alwasys be the driver if present.
// see http://feedback.arma3.com/view.php?id=23693
if (UAVControl GVAR(actUav) select 1 != "GUNNER") then {
// see if there is actually a gunner AI that we can remote control
if (count (crew GVAR(actUav)) >= 2) then {
[] call FUNC(ifClose);
ace_player remoteControl (gunner GVAR(actUav));
GVAR(actUav) switchCamera "Gunner";
GVAR(uavViewActive) = true;
} else {
if (!("DRIVER" in uavControl GVAR(actUav))) then {
if (count (crew GVAR(actUav)) >= 1) then {
[] call FUNC(ifClose);
ace_player remoteControl ((crew GVAR(actUav)) select 0);
GVAR(actUav) switchCamera "INTERNAL";
GVAR(uavViewActive) = true;
};
};
};
if (GVAR(uavViewActive)) then {
[{
if (cameraOn != (_this select 0) || !GVAR(uavViewActive)) then {
[_this select 1] call CBA_fnc_removePerFrameHandler;
GVAR(uavViewActive) = false;
};
},0,GVAR(actUav)] call CBA_fnc_addPerFrameHandler;
};
/*
private _uavGunner = gunner GVAR(actUav);
if (!isNull _uavGunner) then {
[] call FUNC(ifClose);
@ -42,7 +74,7 @@ if (UAVControl GVAR(actUav) select 1 != "GUNNER") then {
} else {
// show notification
["UAV","No gunner optics available",5] call FUNC(addNotification);
};
};*/
} else {
// show notification
["UAV","Another user has control",5] call FUNC(addNotification);

View File

@ -31,7 +31,7 @@ private _validSides = [];
if ([_deviceEncryptionKey, [_x] call EFUNC(bft,getEncryptionKey)] call EFUNC(bft,encryptionKeyMatch)) then {
_validSides pushBack _x;
};
} count ["WEST","EAST","GUER","CIV"];
} forEach ["WEST","EAST","GUER","CIV"];
// compile list of units with the ACE_HelmetCam item
private _hcamList = [];
@ -41,7 +41,7 @@ private _hcamList = [];
_hcamList pushBack _x;
};
};
} count allUnits;
} forEach allUnits;
GVAR(hCamList) = _hcamList;

View File

@ -40,6 +40,6 @@ GVAR(UAVlist) = [];
GVAR(UAVlist) pushBack [_uavDevice,_uavDeviceData];
};
};
} count allUnitsUAV;
} forEach allUnitsUAV;
true