Use proper vector init functions

master
Wuzzy 2022-01-31 02:11:30 +01:00
parent b2d5cbd333
commit 2929b97cb7
2 changed files with 8 additions and 7 deletions

View File

@ -37,7 +37,8 @@ lzr_laser.get_detector_dir = function(param2)
if not dir_input then
return
end
dir_input = vector.multiply(dir_input, -1)
local v = vector.new(dir_input[1], dir_input[2], dir_input[3])
dir_input = vector.multiply(v, -1)
return dir_input
end

View File

@ -81,12 +81,12 @@ function lzr_laser.add_laser(pos, dir, varea, vdata)
vdata[vi] = minetest.get_content_id(active)
-- Set dirs
local dirs = {
{ x = 0, y = -1, z = 0 },
{ x = 0, y = 1, z = 0 },
{ x = -1, y = 0, z = 0 },
{ x = 1, y = 0, z = 0 },
{ x = 0, y = 0, z = -1 },
{ x = 0, y = 0, z = 1 },
vector.new(0, -1, 0),
vector.new(0, 1, 0),
vector.new(-1, 0, 0),
vector.new(1, 0, 0),
vector.new(0, 0, -1),
vector.new(0, 0, 1),
}
for d=1, #dirs do
if vector.equals(dirs[d], dirs) then