mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-26 00:53:00 +00:00
added compass directions, fixed tmp.sign bug
This commit is contained in:
parent
6e3252b471
commit
53600789d8
1 changed files with 17 additions and 2 deletions
|
@ -27,11 +27,23 @@ if worldeditadditions then
|
||||||
local wea = worldeditadditions
|
local wea = worldeditadditions
|
||||||
key_instance = dofile(wea.modpath.."/utils/parse/key_instance.lua")
|
key_instance = dofile(wea.modpath.."/utils/parse/key_instance.lua")
|
||||||
else
|
else
|
||||||
key_instance = require("worldeditadditions.key_instance")
|
key_instance = require("worldeditadditions.utils.parse.key_instance")
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Unified Axis Keywords banks
|
--- Unified Axis Keywords banks
|
||||||
local keywords = {
|
local keywords = {
|
||||||
|
-- Compass keywords
|
||||||
|
compass = {
|
||||||
|
n = "z", north = "z",
|
||||||
|
["-n"] = "-z", ["-north"] = "-z",
|
||||||
|
s = "-z", south = "-z",
|
||||||
|
["-s"] = "z", ["-south"] = "z",
|
||||||
|
e = "x", east = "x",
|
||||||
|
["-e"] = "-x", ["-east"] = "-x",
|
||||||
|
w = "-x", west = "-x",
|
||||||
|
["-w"] = "x", ["-west"] = "x",
|
||||||
|
},
|
||||||
|
|
||||||
-- Direction keywords
|
-- Direction keywords
|
||||||
dir = {
|
dir = {
|
||||||
["?"] = "front", f = "front",
|
["?"] = "front", f = "front",
|
||||||
|
@ -91,6 +103,8 @@ end
|
||||||
function parse.keyword(str)
|
function parse.keyword(str)
|
||||||
if type(str) ~= "string" then
|
if type(str) ~= "string" then
|
||||||
return key_instance.new("err", "Error: \""..tostring(str).."\" is not a string.", 404)
|
return key_instance.new("err", "Error: \""..tostring(str).."\" is not a string.", 404)
|
||||||
|
elseif keywords.compass[str] then
|
||||||
|
str = keywords.compass[str]
|
||||||
end
|
end
|
||||||
local sign = 1
|
local sign = 1
|
||||||
if str:sub(1,1) == "-" then
|
if str:sub(1,1) == "-" then
|
||||||
|
@ -156,9 +170,10 @@ function parse.keytable(tbl, facing, sum)
|
||||||
-- Check key type and process further
|
-- Check key type and process further
|
||||||
if key_inst.type == "axis" then
|
if key_inst.type == "axis" then
|
||||||
tmp.axes = key_inst.entry
|
tmp.axes = key_inst.entry
|
||||||
|
tmp.sign = key_inst.sign
|
||||||
elseif key_inst.type == "dir" then
|
elseif key_inst.type == "dir" then
|
||||||
tmp.axes = {facing[key_inst.entry].axis}
|
tmp.axes = {facing[key_inst.entry].axis}
|
||||||
tmp.sign = facing[key_inst.entry].sign
|
tmp.sign = facing[key_inst.entry].sign * key_inst.sign
|
||||||
elseif key_inst.type == "rev" then
|
elseif key_inst.type == "rev" then
|
||||||
tmp.mirror = true
|
tmp.mirror = true
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue