Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- span class="re5"> va_outside_target = {
- ARGVX3(0,_player,objNull);
- ARGVX3(1,_distance,0);
- diag_log("va_outside_target:Input: " str _this);
- if (!isPlayer _player) exitWith {};
- _lineTarget = objNull;
- _pos1 = []; _pos2 = [];
- _pos1 = (eyePos player);
- _pos2 = ([_pos1, cameraDirDist(_distance)] call vector_add);
- _objects = [];
- _objects = (lineIntersectsWith [_pos1,_pos2,objNull,objNull,true]);
- if (!isARRAY(_objects) || {count _objects == 0}) then { } else {
- _lineTarget = _objects select 0;
- };
- diag_log(format["va_outside_target:LineObjects: %1 (Target is first object in Array)", _objects]);
- diag_log(format["va_outside_target:CursorTarget: %1", cursorTarget]);
- diag_log(format["va_outside_target:CursorObject: %1", cursorObject]);
- //Set the target
- _target = objNull;
- _target = cursorObject;
- _targetOk = true;
- if (isNil "_target") then { _targetOk = false; };
- if (isNull "_target") then { _targetOk = false;};
- if (!(_targetOk)) then {
- _target = objNull;
- _target = cursorTarget;
- _targetOk = true;
- if (isNil "_target") then { _targetOk = false; };
- if (isNull "_target") then { _targetOk = false;};
- };
- if (!(_targetOk)) then {
- _target = objNull;
- _target = _lineTarget;
- _targetOk = true;
- if (isNil "_target") then { _targetOk = false; };
- if (isNull "_target") then { _targetOk = false;};
- };
- if (!(_targetOk)) then {
- _target = objNull;
- };
- diag_log(format["va_outside_target:FinalTarget: %1", _target]);
- if (isNil "_target") exitWith {};
- if (isNull "_target") exitWith {};
- if (({_target isKindOf _x } count ["Helicopter", "Plane", "Ship_F", "Car", "Motorcycle", "Tank"]) == 0) exitWith {};
- diag_log(format["va_outside_target:FinalTarget: %1, Passed all Checks!", _target]);
- _target
- };
Advertisement
Add Comment
Please, Sign In to add comment