fnc_checkInsideCCP.sqf 833 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Author: M3ales
  3. *
  4. * Arguments:
  5. * Unit to check for
  6. * Return Value:
  7. * True if inside the bounds of a given structure
  8. *
  9. * Example:
  10. * [player] call rd501_fnc_checkInsideCCP
  11. *
  12. * Public: No
  13. */
  14. params ["_unit"];
  15. private _fnc_check = {
  16. private _position = _unit modelToWorldVisual [0, 0, eyePos _unit select 2];
  17. (
  18. (lineIntersectsWith [_position, _position vectorAdd [0, 0, 10], _unit]) findIf {
  19. typeOf _x in rd501_medical_ccp_classes || {_x getVariable ["rd501_medical_ccp_inside", false]}
  20. } != -1
  21. )
  22. || {
  23. ((_unit nearObjects 7.5) findIf {
  24. typeOf _x in rd501_medical_ccp_classes || {_x getVariable ["rd501_medical_ccp_inside", false]}
  25. } != -1)
  26. }
  27. };
  28. [[], _fnc_check, _unit, "rd501_medical_ccp_insideCache", 1] call ace_common_fnc_cachedCall;