[Modpack] WorldEdit [worldedit]

User avatar
IPushButton2653
Member
 
Posts: 666
Joined: Wed Nov 16, 2011 22:47
Location: Mississippi

by IPushButton2653 » Sun Jan 15, 2012 03:49

This still isn't working for me!!! I put {John_Lennon} in the weperms.txt file inside the mod. And I still can't use the // commands :(
 

User avatar
sfan5
Moderator
 
Posts: 3817
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Jan 15, 2012 08:41

weperms.txt must be inside your bin folder not in the mod folder
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
IPushButton2653
Member
 
Posts: 666
Joined: Wed Nov 16, 2011 22:47
Location: Mississippi

by IPushButton2653 » Thu Jan 19, 2012 00:13

That explains all my problems. Thanks, and sorry for not replying sooner
 

copypaste
Member
 
Posts: 29
Joined: Tue Jan 17, 2012 19:46

by copypaste » Sun Jan 22, 2012 14:21

A //drain function for lava and water would really help a lot when fighting griefers.
Last edited by copypaste on Sun Jan 22, 2012 15:03, edited 1 time in total.
 

User avatar
sfan5
Moderator
 
Posts: 3817
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Jan 22, 2012 18:53

copypaste wrote:A //drain function for lava and water would really help a lot when fighting griefers.

I'll add that
Last edited by sfan5 on Sun Jan 22, 2012 18:53, edited 1 time in total.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Mon Jan 23, 2012 02:32

One thing I'd love to see would be a /duplicate and a /move command, which would be extremely helpful if working with things like mesecons.

I've tried to implement it myself, but I can't seem to get it quite right yet. Would this be difficult to implement?
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Mon Jan 23, 2012 03:19

I have gotten the duplicate command to work:

Code: Select all
-- Functions
function get_tmp(name)
    local f = io.open("wetemp_" .. name .. ".txt", "r")
    if f == nil then
        return ""
    else
        return f:read("*all")
    end
end
function set_tmp(name,text)
    local f = io.open("wetemp_" .. name .. ".txt", "w")
    if f == nil then
        return false
    else
        f:write(text)
        f:close()
        return true
    end
end
function to_pos(s)
    local pos = {-1,-1,-1}
    i = 1
    string.gsub(s,"{(.-)}", function(a)
        pos[i] = tonumber(a)
        i = i + 1
    end)
    return pos
end
function to_pos_str(x,y,z)
    return "{" .. x .. "}{" .. y .. "}{" .. z .. "}"
end
function to_pos_userstr(p)
    return "(" .. p[1] .. "," .. p[2] .. "," .. p[3] .. ")"
end
function string:split(delimiter)
  local result = { }
  local from  = 1
  local delim_from, delim_to = string.find( self, delimiter, from  )
  while delim_from do
    table.insert( result, string.sub( self, from , delim_from-1 ) )
    from  = delim_to + 1
    delim_from, delim_to = string.find( self, delimiter, from  )
  end
  table.insert( result, string.sub( self, from  ) )
  return result
end
function check_player_we_perms(pname)
    local fi = ""
    local f = io.open("weperms.txt", "r")
    if f ~= nil then
        fi = f:read("*all")
        f:close()
    else
        return false
    end
    local list = {}
    i = 1
    string.gsub(fi,"{(.-)}", function(a)
        list[i] = a
        i = i + 1
    end)
    for n = 1, table.getn(list), 1 do
        if list[n] == pname then
            return true
        end
    end
    return false
end
-- Other Code
set_tmp("pos1", to_pos_str(0,0,0))
set_tmp("pos2", to_pos_str(0,0,0))
set_tmp("postoset", "-1")
minetest.register_on_chat_message(function(name, message)
    local cmd = "//pos1"
    if message:sub(0, #cmd) == cmd then
        if check_player_we_perms(name) then
            local pl = minetest.env:get_player_by_name(name)
            local p = pl:getpos()
            set_tmp("pos1", to_pos_str(p.x,p.y,p.z))
            minetest.chat_send_player(name, 'P1 was set to '..to_pos_userstr({p.x,p.y,p.z}))
        else
            minetest.chat_send_player(name, 'You havent got the Permission for that')
        end
        return true
    end
    local cmd = "//pos2"
    if message:sub(0, #cmd) == cmd then
        if check_player_we_perms(name) then
            local pl = minetest.env:get_player_by_name(name)
            local p = pl:getpos()
            set_tmp("pos2", to_pos_str(p.x,p.y,p.z))
            minetest.chat_send_player(name, 'P2 was set to '..to_pos_userstr({p.x,p.y,p.z}))
        else
            minetest.chat_send_player(name, 'You havent got the Permission for that')
        end
        return true
    end
    local cmd = "//p"
    if message:sub(0, #cmd) == cmd then
        if check_player_we_perms(name) then
            local ope = string.match(message, cmd.." (.*)")
            if ope == nil then
                minetest.chat_send_player(name, 'usage: '..cmd..' [get/set]')
                return true
            end
            if ope == "get" then
                local pos1 = to_pos(get_tmp("pos1"))
                local pos2 = to_pos(get_tmp("pos2"))
                minetest.chat_send_player(name, "P1: ("..pos1[1]..","..pos1[2]..","..pos1[3]..")")
                minetest.chat_send_player(name, "P2: ("..pos2[1]..","..pos2[2]..","..pos2[3]..")")
                return true
            end
            if ope == "set" then
                set_tmp("postoset", "0")
                minetest.chat_send_player(name, "Please select P1 and P2")
                return true
            end
        else
            minetest.chat_send_player(name, 'You havent got the Permission for that')
            return true
        end
    end
    local cmd = "//set"
    if message:sub(0, #cmd) == cmd then
        if check_player_we_perms(name) then
            local nn = string.match(message, cmd.." (.*)")
            if nn == nil then
                minetest.chat_send_player(name, 'usage: '..cmd..' [nodename]')
                return true
            end
            local pos1 = to_pos(get_tmp("pos1"))
            local pos2 = to_pos(get_tmp("pos2"))
            if pos1[1] >= pos2[1] then
                local temp = pos2[1]
                pos2[1] = pos1[1]
                pos1[1] = temp
                temp = nil
            end
            if pos1[2] >= pos2[2] then
                local temp = pos2[2]
                pos2[2] = pos1[2]
                pos1[2] = temp
                temp = nil
            end
            if pos1[3] >= pos2[3] then
                local temp = pos2[3]
                pos2[3] = pos1[3]
                pos1[3] = temp
                temp = nil
            end
            local bc = 0
            for x = pos1[1], pos2[1], 1 do
                for y = pos1[2], pos2[2], 1 do
                    for z = pos1[3], pos2[3], 1 do
                        local np = {x=x, y=y, z=z}
                        minetest.env:add_node(np, {name=nn})
                        bc = bc + 1
                    end
                end
            end
            minetest.chat_send_player(name, bc..' Blocks changed')
            return true
        else
            minetest.chat_send_player(name, 'You havent got the Permission for that')
            return true
        end
    end
    local cmd = "//replace"
    if message:sub(0, #cmd) == cmd then
        if check_player_we_perms(name) then
            local nn = {}
            local tmp = message:gsub(cmd.." ","")
            nn = tmp:split(",")
            tmp = nil
            print("nn: "..dump(nn))
            if nn[2] == nil then
                minetest.chat_send_player(name, 'usage: '..cmd..' [nodename],[nodename2]')
                return true
            end
            local pos1 = to_pos(get_tmp("pos1"))
            local pos2 = to_pos(get_tmp("pos2"))
            if pos1[1] >= pos2[1] then
                local temp = pos2[1]
                pos2[1] = pos1[1]
                pos1[1] = temp
                temp = nil
            end
            if pos1[2] >= pos2[2] then
                local temp = pos2[2]
                pos2[2] = pos1[2]
                pos1[2] = temp
                temp = nil
            end
            if pos1[3] >= pos2[3] then
                local temp = pos2[3]
                pos2[3] = pos1[3]
                pos1[3] = temp
                temp = nil
            end
            local bc = 0
            for x = pos1[1], pos2[1], 1 do
                for y = pos1[2], pos2[2], 1 do
                    for z = pos1[3], pos2[3], 1 do
                        local np = {x=x, y=y, z=z}
                        local n = minetest.env:get_node(np)
                        if n.name == "default:"..nn[1] or n.name == nn[1] then
                            minetest.env:add_node(np, {name=nn[2]})
                            bc = bc + 1
                        end
                    end
                end
            end
            minetest.chat_send_player(name, bc..' Blocks replaced')
            return true
        else
            minetest.chat_send_player(name, 'You havent got the Permission for that')
            return true
        end
    return true
    end
    local cmd = "//duplicate"
    if message:sub(0, #cmd) == cmd then
        if check_player_we_perms(name) then
            local offset = {}
            local tmp = message:gsub(cmd.." ","")
            offset = tmp:split(",")
            tmp = nil
            print("offset: "..dump(offset))
            if offset[1] == nil or offset[2] == nil or offset[3] == nil then
                minetest.chat_send_player(name, 'usage: '..cmd..' [x],[y],[z]')
                return true
            end
            local pos1 = to_pos(get_tmp("pos1"))
            local pos2 = to_pos(get_tmp("pos2"))
            if pos1[1] >= pos2[1] then
                local temp = pos2[1]
                pos2[1] = pos1[1]
                pos1[1] = temp
                temp = nil
            end
            if pos1[2] >= pos2[2] then
                local temp = pos2[2]
                pos2[2] = pos1[2]
                pos1[2] = temp
                temp = nil
            end
            if pos1[3] >= pos2[3] then
                local temp = pos2[3]
                pos2[3] = pos1[3]
                pos1[3] = temp
                temp = nil
            end
            local bc = 0
            for x = pos1[1], pos2[1], 1 do
                for y = pos1[2], pos2[2], 1 do
                    for z = pos1[3], pos2[3], 1 do
                        local n = minetest.env:get_node({x=x, y=y, z=z})
            minetest.env:add_node({x=x+offset[1], y=y+offset[2], z=z+offset[3]}, n)
            bc = bc + 1
                    end
                end
            end
            minetest.chat_send_player(name, bc..' Blocks duplicated')
            return true
        else
            minetest.chat_send_player(name, 'You havent got the Permission for that')
            return true
        end
    return true
    end
end)
minetest.register_on_punchnode(function(p, node)
    if get_tmp("postoset") == "1" then
        set_tmp("pos2", to_pos_str(p.x,p.y,p.z))
        set_tmp("postoset", "-1")
    end
    if get_tmp("postoset") == "0" then
        set_tmp("pos1", to_pos_str(p.x,p.y,p.z))
        set_tmp("postoset", "1")
    end
end)


Use it with //duplicate offsetx,offsety,offsetz.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

User avatar
sfan5
Moderator
 
Posts: 3817
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Mon Jan 23, 2012 06:23

I'll merge your Code, but I'll probably make a //stack direction,amount too
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
dannydark
Member
 
Posts: 428
Joined: Fri Aug 12, 2011 21:28
Location: Manchester, UK

by dannydark » Sun Feb 12, 2012 20:40

Any news on an update? I'm not waiting for any specific feature was just curious ^_^

By the way, I saw that you had added the //replace command :D excellent! thanks for that, also it might be worth adding the //replace command to the original post. I only noticed it because I saw your commit log lol.
 

User avatar
RAPHAEL
Member
 
Posts: 627
Joined: Tue Nov 01, 2011 09:09
Location: Earth

by RAPHAEL » Sun Feb 12, 2012 22:14

EDIT: Found the issue. Basically for proper functioning run WorldEdit with a "runinplace" minetest. Using the Ubuntu packages for minetest just doesn't work due to permission issues.

Ok so I finally got around to trying WorldEdit but it fails. I tried both methods listed in first post and all I ever get is "1 blocks changed".

EDIT: And that appears to be at -1,-1,-1 or very close to it.
Last edited by RAPHAEL on Sun Feb 12, 2012 22:48, edited 1 time in total.
"Before you speak, ask yourself: Is it kind, is it true, is it necessary, does it improve upon the silence?"
My mods: http://goo.gl/n4kpn
(Currently Various, Industrial, Fakeblocks, Jail, MoarCraft, Christmas, Replicator, minetest dev installer for linux, bash mod installer, windows mod installer)
 

User avatar
dannydark
Member
 
Posts: 428
Joined: Fri Aug 12, 2011 21:28
Location: Manchester, UK

by dannydark » Sun Feb 12, 2012 23:32

@Raphael works fine for me on with or without RUN_IN_PLACE active, try doing "//p set" then punch 2 nodes then use "//p get" to see if the location params have changed.
 

User avatar
RAPHAEL
Member
 
Posts: 627
Joined: Tue Nov 01, 2011 09:09
Location: Earth

by RAPHAEL » Sun Feb 12, 2012 23:43

dannydark wrote:@Raphael works fine for me on with or without RUN_IN_PLACE active, try doing "//p set" then punch 2 nodes then use "//p get" to see if the location params have changed.

The issue was that minetest was under /usr/bin and after compiling a run in place minetest I noticed files created in the same folder as minetest. Due to permissions that couldn't be done with minetest in /usr/bin

Compiling a run in place minetest and putting it somewhere under /home/username fixes that and allows it to work. After some playing around I find WorldEdit rather useful.
"Before you speak, ask yourself: Is it kind, is it true, is it necessary, does it improve upon the silence?"
My mods: http://goo.gl/n4kpn
(Currently Various, Industrial, Fakeblocks, Jail, MoarCraft, Christmas, Replicator, minetest dev installer for linux, bash mod installer, windows mod installer)
 

User avatar
sfan5
Moderator
 
Posts: 3817
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Mon Feb 13, 2012 06:00

dannydark wrote:Any news on an update? I'm not waiting for any specific feature was just curious ^_^

By the way, I saw that you had added the //replace command :D excellent! thanks for that, also it might be worth adding the //replace command to the original post. I only noticed it because I saw your commit log lol.

I'll add a //stack Command, so you don't need to type //duplicate 10 Times.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
sfan5
Moderator
 
Posts: 3817
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Feb 19, 2012 16:57

Update!
  • If someone punches a block and //p set was typed before, it will be ignored if the User has no WorldEdit-Priv
  • Save the Selection with //save [filename]
  • Paste File relative to P1 with //load [filename]
  • Stack things with //stack [direction],[amount]
Download: http://ubuntuone.com/4JAj3d46ywX65a605wgDPm
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
dannydark
Member
 
Posts: 428
Joined: Fri Aug 12, 2011 21:28
Location: Manchester, UK

by dannydark » Mon Feb 20, 2012 16:18

sfan5 wrote:Update!
  • If someone punches a block and //p set was typed before, it will be ignored if the User has no WorldEdit-Priv
  • Save the Selection with //save [filename]
  • Paste File relative to P1 with //load [filename]
  • Stack things with //stack [direction],[amount]
Download: http://ubuntuone.com/4JAj3d46ywX65a605wgDPm


Awesome thanks for the update ^_^

If someone punches a block and //p set was typed before, it will be ignored if the User has no WorldEdit-Priv <-- Does this fix: me and a moderator on my server were both using worldedit at the same time and I used //p set and punched one block then went to the other block and punched it but when I did //set stone it create a massive stone cube from my position (about 400 blocks into the air) straight down into a cave at -560ish where a 3rd player was mining.

So I'm guessing when I did //p set and punched the first block before I had chance to punch the next block the player mining hit something which made the selection box huge lol.

Also quick question are the selected coordinates set when using "//p set" per-player? i.e. If I do "//p set" then hit 2 positions to make a selection and then someone else did "//p set" and hit 2 positions elsewhere would the positions I had selected be overwritten?

Because if it isn't stored per-player this could also cause quite a few problems ^_^ Also could I make a few feature suggestions for some extra commands :)

  • //copy - Copies the selected area
  • //cut - Cuts the selected area
  • //paste - Pastes the Cut or Copied area

I believe the above commands could be useful for moving buildings to a new spawn point or whatever ^_^

Also Thanks for the Save & Load functionality :D its made a lot of people happy on my server as I've been able to bring over buildings from the old 0.3 server ^_^
 

User avatar
sfan5
Moderator
 
Posts: 3817
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Mon Feb 20, 2012 18:01

dannydark wrote:
sfan5 wrote:Update!
  • If someone punches a block and //p set was typed before, it will be ignored if the User has no WorldEdit-Priv
  • Save the Selection with //save [filename]
  • Paste File relative to P1 with //load [filename]
  • Stack things with //stack [direction],[amount]
Download: http://ubuntuone.com/4JAj3d46ywX65a605wgDPm

Also quick question are the selected coordinates set when using "//p set" per-player? i.e. If I do "//p set" then hit 2 positions to make a selection and then someone else did "//p set" and hit 2 positions elsewhere would the positions I had selected be overwritten?

Yes, i'll change that in the next Version
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
dannydark
Member
 
Posts: 428
Joined: Fri Aug 12, 2011 21:28
Location: Manchester, UK

by dannydark » Tue Feb 21, 2012 01:02

hmmmm is there a size limit when pasting regions? I'm trying to paste a large building but every time I try it gets to 54642 blocks and then floods the terminal with these errors:

Code: Select all
00:35:50: INFO[ServerThread]: Debug stacks:
00:35:50: INFO[ServerThread]: DEBUG STACK FOR THREAD 140273843414784:
00:35:50: INFO[ServerThread]: #0  virtual void* ServerThread::Thread()
00:35:50: INFO[ServerThread]: #1  void Server::Receive()
00:35:50: INFO[ServerThread]: #2  void Server::ProcessData(irr::u8*, irr::u32, irr::u16)
00:35:50: INFO[ServerThread]: DEBUG STACK FOR THREAD 140273874904864:
00:35:50: INFO[ServerThread]: #0  int main(int, char**)
00:35:50: INFO[ServerThread]: #1  void dedicated_server_loop(Server&, bool&)
00:35:50: INFO[ServerThread]: #2  irr::core::list<PlayerInfo> Server::getPlayerInfo()
00:35:50: ERROR[ServerThread]: Map::setNode(): Not allowing to place CONTENT_IGNORE while trying to replace "air" at (274,42,207) (block (17,2,12))


Meaning I end up with half a building lol, I've tried to make the region copy as close to the building as possible (i.e. no unnecessary air blocks etc)
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Tue Feb 21, 2012 01:22

I'm pretty sure that means it's trying to place a node in an unloaded chunk. I'm not sure if it's possible to load a chunk using Lua, but this would be fixed if it was possible to.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

User avatar
sfan5
Moderator
 
Posts: 3817
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Tue Feb 21, 2012 15:21

dannydark wrote:hmmmm is there a size limit when pasting regions? I'm trying to paste a large building but every time I try it gets to 54642 blocks and then floods the terminal with these errors:

Code: Select all
00:35:50: INFO[ServerThread]: Debug stacks:
00:35:50: INFO[ServerThread]: DEBUG STACK FOR THREAD 140273843414784:
00:35:50: INFO[ServerThread]: #0  virtual void* ServerThread::Thread()
00:35:50: INFO[ServerThread]: #1  void Server::Receive()
00:35:50: INFO[ServerThread]: #2  void Server::ProcessData(irr::u8*, irr::u32, irr::u16)
00:35:50: INFO[ServerThread]: DEBUG STACK FOR THREAD 140273874904864:
00:35:50: INFO[ServerThread]: #0  int main(int, char**)
00:35:50: INFO[ServerThread]: #1  void dedicated_server_loop(Server&, bool&)
00:35:50: INFO[ServerThread]: #2  irr::core::list<PlayerInfo> Server::getPlayerInfo()
00:35:50: ERROR[ServerThread]: Map::setNode(): Not allowing to place CONTENT_IGNORE while trying to replace "air" at (274,42,207) (block (17,2,12))


Meaning I end up with half a building lol, I've tried to make the region copy as close to the building as possible (i.e. no unnecessary air blocks etc)

WorldEdit can only paste into loaded chunks and it can only save loaded chunks
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
sfan5
Moderator
 
Posts: 3817
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Tue Mar 13, 2012 13:42

I'll release an Update soon!!
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Jordach
Member
 
Posts: 4523
Joined: Mon Oct 03, 2011 17:58
Location: Blender Scene
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Tue Mar 13, 2012 15:54

AWESOME, ALL YOU NEED IS SOME ADMIN TOOLS AND WE ARE AWAY!
viewtopic.php?f=10&t=19056 Solar Plains Dev Server
 

User avatar
sfan5
Moderator
 
Posts: 3817
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Sat Mar 17, 2012 09:30

Update!
Changelog:
  • Fixed annoying "You havent got the Permission for that"-Bug when punching Blocks
  • Each Player now has his/her own P1 and P2
    e.g. sfan5 has selected his house while jordan4ibanez has selected a tnt cannon
Download in first Post!
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Jordach
Member
 
Posts: 4523
Joined: Mon Oct 03, 2011 17:58
Location: Blender Scene
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Sat Mar 17, 2012 09:35

Nice one. How's snow coming along?
viewtopic.php?f=10&t=19056 Solar Plains Dev Server
 

User avatar
sfan5
Moderator
 
Posts: 3817
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

by sfan5 » Sat Mar 17, 2012 09:39

Image
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

Utilisatrice
Member
 
Posts: 103
Joined: Thu Feb 16, 2012 18:04

by Utilisatrice » Wed Mar 21, 2012 21:23

Hi,

Sfan5, can you add the cut command please :D ?

Where found this mod (Snow) ?
 

PreviousNext

Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 7 guests