mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-06-30 08:54:55 +00:00
removed deprecated function and key_instance ref
This commit is contained in:
parent
b68dd2a387
commit
b89161a1bb
|
@ -16,13 +16,10 @@ end
|
||||||
|
|
||||||
local wea_c = worldeditadditions_core or nil
|
local wea_c = worldeditadditions_core or nil
|
||||||
local Vector3
|
local Vector3
|
||||||
local key_instance
|
|
||||||
if worldeditadditions_core then
|
if worldeditadditions_core then
|
||||||
key_instance = dofile(wea_c.modpath.."/utils/parse/key_instance.lua")
|
|
||||||
Vector3 = dofile(wea_c.modpath.."/utils/vector3.lua")
|
Vector3 = dofile(wea_c.modpath.."/utils/vector3.lua")
|
||||||
else
|
else
|
||||||
Vector3 = require("worldeditadditions_core.utils.vector3")
|
Vector3 = require("worldeditadditions_core.utils.vector3")
|
||||||
key_instance = require("worldeditadditions_core.utils.parse.key_instance")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,72 +140,6 @@ end
|
||||||
-- @param: sum: Bool | String | nil: Return a single vector by summing the 2 output vectors together
|
-- @param: sum: Bool | String | nil: Return a single vector by summing the 2 output vectors together
|
||||||
-- @returns: Vector3, [Vector3]: returns min, max Vector3s or sum Vector3 (if @param: sum ~= nil)
|
-- @returns: Vector3, [Vector3]: returns min, max Vector3s or sum Vector3 (if @param: sum ~= nil)
|
||||||
-- if error: @returns: false, String: error message
|
-- if error: @returns: false, String: error message
|
||||||
function parse.keytable_old(tbl, facing, sum)
|
|
||||||
local min, max = Vector3.new(), Vector3.new()
|
|
||||||
local expected = 1
|
|
||||||
local tmp = {axes = {}, num = 0, sign = 1, mirror = false}
|
|
||||||
|
|
||||||
function tmp:reset()
|
|
||||||
self.axis, self.sign = "", 1
|
|
||||||
end
|
|
||||||
|
|
||||||
for i, v in ipairs(tbl) do
|
|
||||||
if v:sub(1, 1) == "+" then
|
|
||||||
v = v:sub(2)
|
|
||||||
end
|
|
||||||
|
|
||||||
tmp.num = parse.num(v)
|
|
||||||
|
|
||||||
if expected == 1 then
|
|
||||||
if tmp.num then
|
|
||||||
if tmp.num * tmp.sign >= 0 then
|
|
||||||
max = max:add(parse.vectorize({"x","y","z"}, tmp.num, tmp.sign))
|
|
||||||
else
|
|
||||||
min = min:add(parse.vectorize({"x","y","z"}, tmp.num, tmp.sign))
|
|
||||||
end
|
|
||||||
else
|
|
||||||
local key_type, key_entry, key_sign = parse.keyword(v)
|
|
||||||
|
|
||||||
if key_type == "axis" then
|
|
||||||
tmp.axes = key_entry
|
|
||||||
tmp.sign = key_sign
|
|
||||||
elseif key_type == "dir" then
|
|
||||||
tmp.axes = {facing[key_entry].axis}
|
|
||||||
tmp.sign = facing[key_entry].sign * key_sign
|
|
||||||
elseif key_type == "rev" then
|
|
||||||
tmp.mirror = true
|
|
||||||
else
|
|
||||||
return false, key_entry
|
|
||||||
end
|
|
||||||
|
|
||||||
expected = 2
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if tmp.num then
|
|
||||||
if tmp.num * tmp.sign >= 0 then
|
|
||||||
max = max:add(parse.vectorize(tmp.axes, tmp.num, tmp.sign))
|
|
||||||
else
|
|
||||||
min = min:add(parse.vectorize(tmp.axes, tmp.num, tmp.sign))
|
|
||||||
end
|
|
||||||
expected = 1
|
|
||||||
else
|
|
||||||
return false, "Error: Expected number after \""..tostring(tbl[i-1]).."\". Got \""..tostring(v).."\"."
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if tmp.mirror and not sum then
|
|
||||||
max = max:max(min:abs())
|
|
||||||
min = max:multiply(-1)
|
|
||||||
end
|
|
||||||
|
|
||||||
if sum then
|
|
||||||
return min:add(max)
|
|
||||||
else
|
|
||||||
return min, max
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function parse.keytable(tbl, facing, sum)
|
function parse.keytable(tbl, facing, sum)
|
||||||
local min, max = Vector3.new(), Vector3.new()
|
local min, max = Vector3.new(), Vector3.new()
|
||||||
local expected = 1
|
local expected = 1
|
||||||
|
|
Loading…
Reference in a new issue