785 {
786 float nearest_distance = 1000.0;
787 int nearest_slot_index = -1;
789 for (int i = 0; i < slots_count; i++)
790 {
793 float current_distance = vector.Distance(position, slot_pos);
794
795 if (current_distance < nearest_distance)
796 {
797 if (slot != NULL && slot.GetState() == slot_state)
798 {
799 nearest_distance = current_distance;
800 nearest_slot_index = i;
801 }
802 }
803 }
804
805 return nearest_slot_index;
806 }
vector GetSlotPosition(int index)
ref array< ref Slot > m_Slots
int GetGardenSlotsCount()