#include "..\script_component.hpp"

params [["_object", objNull, [objNull]]];
if (isNull _object) exitWith {objNull};

private _bases = missionNamespace getVariable ["milsim_baseObjects", []];
if (count _bases == 0) exitWith {objNull};

// get nearest base (Module_Respawn_F)
private _closestBase = [_bases, _object] call BIS_fnc_nearestPosition;
if (isNull _closestBase) exitWith {objNull};
_closestBase;