[Modpack] WorldEdit [worldedit]

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

I have made an extension to the player inventory to allow the player access to additional GUI screens. I made a quick mod here as an example:
http://minetest.net/forum/viewtopic.php?id=3101

I am thinking about creating a GUI for worldedit, however im not sure i'll have the time. If someone wants to work on it, please make it work with Inventory Plus

EDIT, i made the GUI:
http://minetest.net/forum/viewtopic.php?id=3112
Last edited by cornernote on Tue Sep 18, 2012 07:14, edited 1 time in total.

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

by Temperest » Post

Neat! I think it should stay a separate mod to reduce dependencies and keep everything modular.

Will definitely be using that, very nifty.
WorldEdit 1.0 released

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

User avatar
fgr
Member
Posts: 86
Joined: Mon Sep 17, 2012 08:22

by fgr » Post

you guys rock! but wouldnt it be better to merge the worldedit and worldedit gui into one? This could solve the depencies problem. Lets guess a new release will kicked out and the gui isnt able to handle for some reasons ... just a thinking of ...
Last edited by fgr on Wed Sep 19, 2012 08:02, edited 1 time in total.

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

i think its better to be modular, the only difference would be that you only have to download 1 file... but the gui has another dependency too (inventory_plus), and including all these things in WE would be messy.

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

[request]

can we have a sphere shape?

Code: Select all

-- sphere or hollow sphere - (based on sphere+hollowsphere in multinode by mauvebic)
make_sphere =  function(pos,radius,nodename,hollow)
    pos.x = math.floor(pos.x+0.5)
    pos.y = math.floor(pos.y+0.5)
    pos.z = math.floor(pos.z+0.5)
    for x=-radius,radius do
    for y=-radius,radius do
    for z=-radius,radius do
        if hollow ~= nil then
            if x*x+y*y+z*z >= (radius-hollow) * (radius-hollow) + (radius-hollow) and x*x+y*y+z*z <= radius * radius + radius then
                minetest.env:add_node({x=pos.x+x,y=pos.y+y,z=pos.z+z},{name=nodename})
            end
        else
            if x*x+y*y+z*z <= radius * radius + radius then
                minetest.env:add_node({x=pos.x+x,y=pos.y+y,z=pos.z+z},{name=nodename})
            end
        end
    end
    end
    end
end
Last edited by cornernote on Mon Sep 24, 2012 00:36, edited 1 time in total.

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

[request]

i would like to be able to draw a cylinder with a negative length (eg, -100). at the moment this does not render any nodes, it should start from 0 and go backwards.

p.s. when i have some time i'll look at it if nobody else has by then, just noting these issues here so i dont forget.

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

by Temperest » Post

cornernote wrote:[request]

i would like to be able to draw a cylinder with a negative length (eg, -100). at the moment this does not render any nodes, it should start from 0 and go backwards.

p.s. when i have some time i'll look at it if nobody else has by then, just noting these issues here so i dont forget.
Done!

Edit: forgot about the sphere shape, I'm looking it over, feel free to make a pull request in the meantime.
Last edited by Temperest on Tue Sep 25, 2012 21:08, edited 1 time in total.
WorldEdit 1.0 released

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

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

by Temperest » Post

Spheres! Commit.

I sped up the spheres code significantly, but it could still use some improvements with larger dimensions. Thanks to cornernote for the original code.

Edit: thanks to mauvebic, for awesome spherical action!
Last edited by Temperest on Wed Sep 26, 2012 00:49, edited 1 time in total.
WorldEdit 1.0 released

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

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

Temperest wrote:Spheres! Commit.

I sped up the spheres code significantly, but it could still use some improvements with larger dimensions. Thanks to cornernote for the original code.
No, thanks to mauvebic. It's his code, I just merged 2 functions into 1. These lines are the keys:

Code: Select all

-- detect sphere/hollow sphere area
if x*x+y*y+z*z >= (radius-hollow) * (radius-hollow) + (radius-hollow) and x*x+y*y+z*z <= radius * radius + radius then ... end
if x*x+y*y+z*z <= radius * radius + radius then ... end
Without those I wouldn't have a clue how to make a sphere.
Last edited by cornernote on Wed Sep 26, 2012 00:39, edited 1 time in total.

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

spiral does not seem to work: http://youtu.be/nLLyVpt2Ufw

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

is there any way i can offset the save position? for example i am saving a structure, but i dont want 0,0,0 to be where pos1 is. i want a new pos (pos3?) that is the relative position for saving.

does that make sense?

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

by Temperest » Post

I can't seem to get spiral to work either; I will be looking into rewriting it perhaps as per the GitHub issue, since it uses GFDL code from RosettaCode and nobody understands how it works :P

Edit: also to address your other concern, there is no way to do so at the moment, sorry. If you have any suggestions for doing this in an elegant way, I'd be glad to hear them.
WorldEdit 1.0 released

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

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

used the spiral from RosettaCode in my skyblock game to determine the start positions for new players. i'll take a look at the code in WE and see if i can get it working.

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

by Temperest » Post

I replaced spirals with pyramids in the API, but I'm going to bed now so commits will be tomorrow.
WorldEdit 1.0 released

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

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

Image
Image
Last edited by cornernote on Wed Sep 26, 2012 03:50, edited 1 time in total.

User avatar
Gage
Member
Posts: 45
Joined: Mon Sep 10, 2012 10:17

by Gage » Post

it wont work it says failed to load and run/init.lua

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

by Temperest » Post

Update:
  • cornernote fixed the //spiral command! Now you can make awesome mazes and similar things!
  • Added the //pyramid command, for making large solid pyramids.
  • Fixes to API documentation and some incorrect code.
Get it from the GitHub link!

Gage: I broke that accidentally yesterday, this new update should fix it.
WorldEdit 1.0 released

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

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

should transpose work? what is it supposed to do ?

when I did it, it just seemed to move parts of the area, basically screwed it up.

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

can we add maze to worldedit?

if so, did you want me to add it in?

maze - http://minetest.net/forum/viewtopic.php?id=2814

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

by Temperest » Post

Transpose is broken as per issue #8, for non-square regions. I'll need to figure out a new algorithm for non-square matrix transposition soon.

Feel free to add the maze primitive, or anything else you find useful. Make sure the license is compatible first, though. The mazes are pretty cool and actually somewhat difficult.
WorldEdit 1.0 released

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

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

with all these shapes, the functions.lua is getting quite large. i propose we break all these functions into their own files, then in the main init.lua do this:

Code: Select all

-- expose api
worldedit = {}

-- load api files
local path = minetest.get_modpath("worldedit")
local command = 'dir "'..path..'\\api\\*.lua" /b' -- windows
if os.getenv('home')~=nil then 
    command = 'ls -a "'..path..'/api/*.lua"' -- linux/mac
end
for filename in io.popen(command):lines() do
    dofile(path..'/api/'..filename)
end
What are your thoughts?

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

by Temperest » Post

I agree that it is becoming pretty unwieldy. However, I'm thinking init.lua should not be a dependency of the actual API. As it stands, you can just copy functions.lua to your own mod and it would work by itself (with the exception of meta save and metaload, which I suggest should be folded into the API to avoid too many files). That is, init.lua simply contains the chat interface alone.

I'm thinking of splitting the API into parts: the primitives, such as pyramids, cylinders, and spheres; the node modification tools, such as set, replace, and dig; and the serialization stuff, such as save, load, meatspace, and metaload. Each module could be imported independently and individual modules would be removable without affecting others.
Last edited by Temperest on Thu Sep 27, 2012 13:47, edited 1 time in total.
WorldEdit 1.0 released

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

User avatar
jordan4ibanez
Member
Posts: 1896
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Post

This should use a for statement instead of a while statement, so that on a multiplayer server the whole thing does not freeze up when people are worldediting

Guest2

by Guest2 » Post

What about changing WorldEdit to a modpack, including submods for each function, a mod for the api, and a mod for the default worldedit interface?

Code: Select all

mods/
 worldedit/
  worldedit_default/
   depends: worldedit_api
  worldedit_api/
   depends: worldedit_sphere, worldedit_cylinder, worldedit_set, etc.
  worldedit_cylinder/
  ... (etc.) ...

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

jordan4ibanez wrote:This should use a for statement instead of a while statement, so that on a multiplayer server the whole thing does not freeze up when people are worldediting
I dont think it makes any difference which loop you use. The thread will do the loop until its done.

Perhaps a better way would be to only process X nodes per interval.

For example, when you //load a file, it should read the file into a TODO list, and then it should process 10 lines (and remove those 10 lines from the list). It should then use minetest.after(1,func) to create a callback that will run the next loop.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 7 guests