import(Module_Map)
import(Module_Defines)
import(Module_DataTypes)
import(Module_Table)
import(Module_Objects)
import(Module_Globals)
import(Module_Commands)
import(Module_Players)

local ReincPos = {
  MAP_XZ_2_WORLD_XYZ(240, 190),
  MAP_XZ_2_WORLD_XYZ(192, 238),
  MAP_XZ_2_WORLD_XYZ(4, 0),
  MAP_XZ_2_WORLD_XYZ(30, 36),
  MAP_XZ_2_WORLD_XYZ(182, 132),
  MAP_XZ_2_WORLD_XYZ(134, 180),
  MAP_XZ_2_WORLD_XYZ(114, 112),
  MAP_XZ_2_WORLD_XYZ(78, 76)
}

local teamOne = {}
local teamTwo = {}

for i,k in ipairs(ReincPos) do
  local me = world_coord3d_to_map_ptr(k)
  me.MapWhoList:processList(function(t)
    if (t.Type == T_PERSON) then
      if (t.Model == M_PERSON_MEDICINE_MAN) then
        if (i <= 4) then
          table.insert(teamOne, t.Owner)
        else
          table.insert(teamTwo, t.Owner)
        end
      end
    end
    return true
  end)
end


for i, v in ipairs(teamOne) do
    for k, t in ipairs(teamOne) do
        set_players_allied(v, t)
    end
end

for i, v in ipairs(teamTwo) do
    for k, t in ipairs(teamTwo) do
        set_players_allied(v, t)
    end
end