Add mirror dir helper function
parent
cc0ed45d54
commit
94e5945479
|
@ -1,5 +1,48 @@
|
|||
local S = minetest.get_translator("lzr_laser")
|
||||
|
||||
local mirror_out = {
|
||||
[0] = {1,0,0},
|
||||
[1] = {0,0,-1},
|
||||
[2] = {-1,0,0},
|
||||
[3] = {0,0,1},
|
||||
|
||||
[4] = {1,0,0},
|
||||
[5] = {0,1,0},
|
||||
[6] = {-1,0,0},
|
||||
[7] = {0,-1,0},
|
||||
|
||||
[8] = {1,0,0},
|
||||
[9] = {0,-1,0},
|
||||
[10] = {-1,0,0},
|
||||
[11] = {0,1,0},
|
||||
|
||||
[12] = {0,-1,0},
|
||||
[13] = {0,0,-1},
|
||||
[14] = {0,1,0},
|
||||
[15] = {0,0,1},
|
||||
|
||||
[16] = {0,1,0},
|
||||
[17] = {0,0,-1},
|
||||
[18] = {0,-1,0},
|
||||
[19] = {0,0,1},
|
||||
|
||||
[20] = {-1,0,0},
|
||||
[21] = {0,0,-1},
|
||||
[22] = {1,0,0},
|
||||
[23] = {0,0,1},
|
||||
}
|
||||
|
||||
lzr_laser.get_mirror_dirs = function(param2)
|
||||
local dir_input = minetest.facedir_to_dir(param2)
|
||||
if not dir_input then
|
||||
return
|
||||
end
|
||||
dir_input = vector.multiply(dir_input, -1)
|
||||
local dir_output = vector.new(unpack(mirror_out[param2]))
|
||||
|
||||
return dir_input, dir_output
|
||||
end
|
||||
|
||||
minetest.register_node("lzr_laser:mirror", {
|
||||
description = S("Mirror"),
|
||||
paramtype2 = "facedir",
|
||||
|
|
Loading…
Reference in New Issue