fn_degreeToOctant.sqf 473 B

12345678910111213141516171819202122232425
  1. /*
  2. Name: cTab_fnc_degreeToOctant
  3. Author(s):
  4. Gundy
  5. Description:
  6. Calculate octant from direction
  7. Parameters:
  8. 0: INTEGER - Degree value to convert 0 to 360.
  9. Returns:
  10. STRING - Matching octant as either N, NE, E, SE, S, SW, W, NW
  11. Example:
  12. _octant = [direction player] call cTab_fnc_degreeToOctant;
  13. */
  14. private ["_dir","_octant"];
  15. _dir = _this select 0;
  16. _octant = round (_dir / 45);
  17. ["N ","NE","E ","SE","S ","SW","W ","NW","N "] select _octant