mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-01-09 17:40:30 +01:00
WorldEdit 0.4
This commit is contained in:
parent
b813058d57
commit
7862e2ae83
@ -1 +1 @@
|
|||||||
0.3
|
0.4
|
||||||
|
@ -5,7 +5,7 @@ assert(table.save ~= nil)
|
|||||||
assert(table.load ~= nil)
|
assert(table.load ~= nil)
|
||||||
-- Functions
|
-- Functions
|
||||||
function get_tmp(name)
|
function get_tmp(name)
|
||||||
local f = io.open("wetemp_" .. name .. ".txt", "r")
|
local f = io.open(minetest.get_modpath("worldedit").."/wetemp_" .. name .. ".txt", "r")
|
||||||
if f == nil then
|
if f == nil then
|
||||||
return ""
|
return ""
|
||||||
else
|
else
|
||||||
@ -13,7 +13,7 @@ function get_tmp(name)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function set_tmp(name,text)
|
function set_tmp(name,text)
|
||||||
local f = io.open("wetemp_" .. name .. ".txt", "w")
|
local f = io.open(minetest.get_modpath("worldedit").."/wetemp_" .. name .. ".txt", "w")
|
||||||
if f == nil then
|
if f == nil then
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
@ -51,7 +51,7 @@ function string:split(delimiter)
|
|||||||
end
|
end
|
||||||
function check_player_we_perms(pname)
|
function check_player_we_perms(pname)
|
||||||
local fi = ""
|
local fi = ""
|
||||||
local f = io.open("weperms.txt", "r")
|
local f = io.open(minetest.get_worldpath().."/weperms.txt", "r")
|
||||||
if f ~= nil then
|
if f ~= nil then
|
||||||
fi = f:read("*all")
|
fi = f:read("*all")
|
||||||
f:close()
|
f:close()
|
||||||
@ -330,6 +330,7 @@ minetest.register_on_chat_message(function(name, message)
|
|||||||
minetest.chat_send_player(name, 'usage: '..cmd..' [filename]')
|
minetest.chat_send_player(name, 'usage: '..cmd..' [filename]')
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
fn = fn .. ".we"
|
||||||
data = {}
|
data = {}
|
||||||
datai = 1
|
datai = 1
|
||||||
----------
|
----------
|
||||||
@ -346,6 +347,8 @@ minetest.register_on_chat_message(function(name, message)
|
|||||||
local np_rel = {x=pos1[1]-x, y=pos1[2]-y, z=pos1[3]-z} -- Relative Position
|
local np_rel = {x=pos1[1]-x, y=pos1[2]-y, z=pos1[3]-z} -- Relative Position
|
||||||
local n = minetest.env:get_node(np)
|
local n = minetest.env:get_node(np)
|
||||||
if n.name ~= "air" then -- Don't Save air
|
if n.name ~= "air" then -- Don't Save air
|
||||||
|
if n.param1 == 0 then n.param1 = nil end
|
||||||
|
if n.param2 == 0 then n.param2 = nil end
|
||||||
data[datai] = {np_rel,n} -- data[index] = {position,node_data}
|
data[datai] = {np_rel,n} -- data[index] = {position,node_data}
|
||||||
datai = datai + 1
|
datai = datai + 1
|
||||||
bs = bs + 1
|
bs = bs + 1
|
||||||
@ -354,8 +357,8 @@ minetest.register_on_chat_message(function(name, message)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
----------
|
----------
|
||||||
print(dump(data))
|
--print(dump(data))
|
||||||
table.save(data, fn)
|
table.save(data, minetest.get_modpath("worldedit").."/"..fn)
|
||||||
minetest.chat_send_player(name, bs..' Blocks saved to '..fn)
|
minetest.chat_send_player(name, bs..' Blocks saved to '..fn)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -370,9 +373,10 @@ minetest.register_on_chat_message(function(name, message)
|
|||||||
minetest.chat_send_player(name, 'usage: '..cmd..' [filename]')
|
minetest.chat_send_player(name, 'usage: '..cmd..' [filename]')
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
fn = fn .. ".we"
|
||||||
data = {}
|
data = {}
|
||||||
data = table.load(fn)
|
data = table.load(minetest.get_modpath("worldedit").."/"..fn)
|
||||||
print(dump(data))
|
--print(dump(data))
|
||||||
----------
|
----------
|
||||||
pos1 = to_pos(get_tmp("pos1_"..name))
|
pos1 = to_pos(get_tmp("pos1_"..name))
|
||||||
local bp = 0
|
local bp = 0
|
||||||
|
@ -44,7 +44,7 @@ do
|
|||||||
file:write( "return {"..charE )
|
file:write( "return {"..charE )
|
||||||
|
|
||||||
for idx,t in ipairs( tables ) do
|
for idx,t in ipairs( tables ) do
|
||||||
file:write( "-- Table: {"..idx.."}"..charE )
|
--file:write( "-- Table: {"..idx.."}"..charE )
|
||||||
file:write( "{"..charE )
|
file:write( "{"..charE )
|
||||||
local thandled = {}
|
local thandled = {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user