<commit_before>﻿/*
	Author: <NAME>, based on Shuko's shkPos

	Description:
	  Selects a random position within the objective

	Parameter(s):
	  _this select 0: OBJECITVE, the objective to return a position for

    Example:
	  _pos = [_obj] call AFW_fnc_getRandomSpawnPosition;
	
	Returns:
	  A position at which to spawn the objective
*/

private ["_obj", "_pos", "_centre", "_rad"];

_obj = _THIS(0);
_centre = O_POS(_obj);
_rad = O_R(_obj);

_pos = [_centre, random 360, _rad, false, 1] call SHK_pos;
_pos<commit_msg>Build single function for getting the respawn position<commit_after>﻿/*
	Author: <NAME>

	Description:
	  Finds a random spawn position suitable for the given object within the objective radius

	Parameter(s):
	  _this select 0: ARRAY, The objective to find a spawn point for
	  _this select 1: STRING, The type of object to find a spawn point for

    Example:
	  pos = [_obj, "B_Officer_F"] call AFW_fnc_getRandomSpawnPosition;
	
	Returns:
	  A position to spawn the object at or the initial position if none can be found
*/

private ["_obj", "_safePos", "_radius", "_initial", "_temp", "_object", "_count"];

#include "defines.sqf"

_obj = _this select 0;
_object = _this select 1;

_radius = O_R(_obj);
_initial = O_POS(_obj);
_safePos = [];
_count = 0;

if (O_RANDOMISE(_obj)) then {

    while {format ["%1", _safePos] == "[]" and _count < 10} do {
        // find a random safe position
        _temp = [_initial, random 360, _radius, false, 1] call SHK_pos;
        _safePos = _temp findEmptyPosition [0, _radius, _object];
        _count = _count + 1;
    };

    if (format ["%1", _safePos] == "[]") {
        _safePos = _initial;
    };
} else {
    _safePos = _initial;
};

// return the crate handle
_safePos
{'fraction_non_alphanumeric': 0.1154508902929351, 'fraction_numerical': 0.012062033314187249, 'mean_word_length': 3.6084656084656084, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7589593', 'n_tokens_mistral': 624, 'n_tokens_neox': 581, 'n_words': 209}