make setHidden use forgetTarget

This commit is contained in:
commy2 2017-12-29 02:48:20 +01:00
parent 12208b4ebe
commit 13e52b4410

View File

@ -53,6 +53,9 @@
if (_vis != 0) then { if (_vis != 0) then {
_object setVariable [QGVAR(oldVisibility), _vis]; _object setVariable [QGVAR(oldVisibility), _vis];
_object setUnitTrait ["camouflageCoef", 0]; _object setUnitTrait ["camouflageCoef", 0];
{
_x forgetTarget _object;
} forEach allGroups;
}; };
} else { } else {
_vis = _object getVariable [QGVAR(oldVisibility), _vis]; _vis = _object getVariable [QGVAR(oldVisibility), _vis];
@ -277,10 +280,10 @@ addMissionEventHandler ["PlayerViewChanged", {
// On non-server client this command is semi-broken // On non-server client this command is semi-broken
// arg index 5 should be the controlled UAV, but it will often be objNull (delay from locality switching?) // arg index 5 should be the controlled UAV, but it will often be objNull (delay from locality switching?)
// On PlayerViewChanged event, start polling for new uav state for a few seconds (should be done within a few frames) // On PlayerViewChanged event, start polling for new uav state for a few seconds (should be done within a few frames)
params ["", "", "", "", "_newCameraOn", "_UAV"]; params ["", "", "", "", "_newCameraOn", "_UAV"];
TRACE_2("PlayerViewChanged",_newCameraOn,_UAV); TRACE_2("PlayerViewChanged",_newCameraOn,_UAV);
[{ [{
if (isNull player) exitWith {true}; if (isNull player) exitWith {true};
private _UAV = getConnectedUAV player; private _UAV = getConnectedUAV player;
@ -301,14 +304,14 @@ addMissionEventHandler ["PlayerViewChanged", {
_seatAI = gunner _UAV; _seatAI = gunner _UAV;
}; };
}; };
private _newArray = [_UAV, _seatAI, _turret, _position]; private _newArray = [_UAV, _seatAI, _turret, _position];
if (_newArray isEqualTo ACE_controlledUAV) exitWith {false}; // no change yet if (_newArray isEqualTo ACE_controlledUAV) exitWith {false}; // no change yet
TRACE_2("Seat Change",_newArray,ACE_controlledUAV); TRACE_2("Seat Change",_newArray,ACE_controlledUAV);
ACE_controlledUAV = _newArray; ACE_controlledUAV = _newArray;
["ACE_controlledUAV", _newArray] call CBA_fnc_localEvent; ["ACE_controlledUAV", _newArray] call CBA_fnc_localEvent;
// stay in the loop as we might switch from gunner -> driver, and there may be a empty position event in-between // stay in the loop as we might switch from gunner -> driver, and there may be a empty position event in-between
false false
}, {}, [], 3, {TRACE_1("timeout",_this);}] call CBA_fnc_waitUntilAndExecute; }, {}, [], 3, {TRACE_1("timeout",_this);}] call CBA_fnc_waitUntilAndExecute;