1234567891011121314151617181920212223242526272829303132333435363738 |
- -- Code by Pedro Gimeno, donated to the public domain.
- -- Big thanks to entuland for making it much easier to create the table.
- local facedirs = {
- [-246] = 19;
- [-244] = 10;
- [-242] = 4;
- [-240] = 13;
- [ -90] = 21;
- [ -82] = 20;
- [ -80] = 22;
- [ -72] = 23;
- [ -36] = 7;
- [ -30] = 18;
- [ -24] = 12;
- [ -18] = 9;
- [ 18] = 11;
- [ 24] = 16;
- [ 30] = 14;
- [ 36] = 5;
- [ 72] = 3;
- [ 80] = 2;
- [ 82] = 0;
- [ 90] = 1;
- [ 240] = 17;
- [ 242] = 6;
- [ 244] = 8;
- [ 246] = 15;
- }
- local function matrix_to_facedir(matrix)
- local index = matrix[1] + 3 * matrix[2] + 9 * matrix[3]
- + 27 * matrix[5] + 81 * matrix[6] + 243 * matrix[7]
- return facedirs[index] or 0
- end
- return matrix_to_facedir
|