[Modpack] WorldEdit [worldedit]

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

by Temperest » Post

Hey temrix:

Make sure you have this line in your MINETEST_FOLDER/minetest.conf file:

Code: Select all

mg_flags = flat
Mind you, it will make all of your worlds start generating flat lands.

If this is not what you want, here's how you make a custom game that has flat worlds:
  • Copy the game you want to base it off of. For example, I might copy MINETEST_FOLDER/games/minetest_game and name that copy MINETEST_FOLDER/games/minetest_game_flat
  • In that game folder (make sure there's a "game.conf" file in there), make a file called "minetest.conf". In that file write "mg_flags = flat".
  • In game.conf, change "name = WHATEVER_THE_NAME_WAS" to "name = WHATEVER_YOU_WANT". For example, "Minetest Game Flat".
  • Now start Minetest. When you create the world, you will have the option of making it of the type Minetest Game Flat or whatever you named it. Choose this option.
  • Now your world will generate flat, while your other worlds are unaffected.
Personally, I just change the option to flat when I need it and then change it back afterward.
WorldEdit 1.0 released

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

User avatar
temrix
New member
Posts: 9
Joined: Wed Apr 16, 2014 09:40

by temrix » Post

I just have deleted my post because I already figured it out myself.
Definitely will try out your second way too.

User avatar
Krock
Developer
Posts: 4570
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

Temperest wrote:[*]In that game folder (make sure there's a "game.conf" file in there), make a file called "minetest.conf". In that file write "mg_flags = flat".[/*]
.. or just open minetest.conf in the minetest folder and change it there. Or get "a" flatgen mod if you are too lazy for this.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
CWz
Member
Posts: 197
Joined: Tue Dec 24, 2013 17:01
GitHub: chaoswormz
IRC: CWz
In-game: CWz
Location: Banana Land

by CWz » Post

worldedit seems to crash the server when sending //y command
posted the error here
I am CWz on the following servers: VanessaE's servers. If you see CWz on server other then those then chances are it's a Fake. you can contact me on irc.freenode.net or by PM if you are not sure

t3tNU9hNyeSJxFOmM5fmtGxlfoJrcBCg

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

Re:

by Temperest » Post

Krock wrote:
Temperest wrote:[*]In that game folder (make sure there's a "game.conf" file in there), make a file called "minetest.conf". In that file write "mg_flags = flat".[/*]
.. or just open minetest.conf in the minetest folder and change it there. Or get "a" flatgen mod if you are too lazy for this.
Hey Krock:

That works, but as I stated above, this causes the setting to be changed for all available worlds. The flatgen mod, in addition, is significantly slower than the native flat mapgen, at least in my experiences. As always, it is good to have options though.

CWz, I will take a look at that as soon as possible.

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by dgm5555 » Post

Would it be difficult to add a feature to worldedit so you can pretest installing a schem file? This would then list any missing mods and move the pos1 and pos2 markers to enclose the zone the new mod would be installed.
[EDIT: listing missing nodes would be a slight enhancement to the current //allocate function, which already locates the markers]

Worldedit also seems to silently fail to load or save files if there is no pre-existing schem folder in the world folder. This should be an easy fix if worldedit could check and automatically create it (or at least warn of the failure) if it wasn't present. [EDIT: see below, I think this might be a mod conflict]
Last edited by dgm5555 on Thu May 22, 2014 13:52, edited 2 times in total.

Sokomine
Member
Posts: 4159
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by Sokomine » Post

dgm555 wrote: Would it be difficult to add a feature to worldedit so you can pretest installing a schem file? This would then list any missing mods and move the pos1 and pos2 markers to enclose the zone the new mod would be installed.
At least the "identify unkown blocks" part could be done quite well. I've added code to read minetest schematic files to a degree. Things like size and nodes used are pretty straightforward. The rest is unfortionately a gzip-stream. and there's no way to decode that without additional libs. However, reading the node names would be sufficient for what you asked for.

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

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by sfan5 » Post

dgm5555 wrote:Worldedit also seems to silently fail to load or save files if there is no pre-existing schem folder in the world folder. This should be an easy fix if worldedit could check and automatically create it (or at least warn of the failure) if it wasn't present.
WorldEdit attempts to create the schems dir with mkdir. If this fails there is no portable way left of creating a directory.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by dgm5555 » Post

I've been making sections of wall, road/paths, roof, corridors, etc. ie things which are basically repetitive, but randomly change orientation or location. Therefore I can't easily use //copy //move or //rotate, as the orientation can't be defined, and would like to use player location to positioning much more easily.
I like to essentially develop a script to ease most of the work, as below, but have a couple of problems:
One problem is I can't figure out how WE translates and rotates a schem file relative to the pos locations when WE loads it. It doesn't seem to depend on the pos1/pos2 orientation, or player yaw.
Secondly I also can't figure out how to reset pos1/2 to exactly mark the just loaded section so I can then rotate it appropriately

I'd therefore like a shorthand (ideally a short chat command or hotkey) way of doing essentially the following sequence:-
set pos1 to player current location (possibly with a defined offset - in case the player can't stand exactly where needed eg for foundations etc)
set rotation based on player yaw (direction facing)
set pos2 (if needed) based on above location and rotation.
move the player forward far enough to move out of the load zone (ideally set from the schem file size, but otherwise could probably be a set amount - eg 1 or 2 nodes.
load so minX,minY,minZ for the schem file is at pos1
If needed rotation based on player direction (as above).
Ideally I would like to be able to extract the dimensions from the file so I could x/y/z offset it (useful if foundations etc required, so player can't stand at location of origin)
[then move to next location and repeat]...
I'm guessing some sort of //lua <code> would do it, but perhaps better would be defining my own chat command which loads the lua sequence from a file I can edit while in a game (since I don't want to reload the map each time I make a small edit, and can't copy and paste to the chat bar).
If anyone's done basically all this so I can copy code, I'd really appreciate it, else a few pointers to get me started would be much appreciated...

Also:-
sfan5 wrote:WorldEdit attempts to create the schems dir with mkdir. If this fails there is no portable way left of creating a directory.
Would it be possible to not fail silently - ie warn that the file was not created (or if somewhere random then note where). On my Ubuntu 14.04 if there is no pre-existing schem folder WE fails, but still produces a chat message implying that the file was saved.
[EDIT: actually looked at the code in the worldedit_commands/init.lua and realised that it is actually making a folder and warning, and turns out it works on a blank world, some must be some sort of mod conflict, I'll have a little play and see if I can figure it out.]
Last edited by dgm5555 on Thu May 22, 2014 13:34, edited 1 time in total.

Sokomine
Member
Posts: 4159
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by Sokomine » Post

Some of my mods place schematics based on the player's facedir. My apartments mod can also store schematics if you precede an apartment name with save_as_. The build chest from my random_buildings mod also spawns blueprints according to facedir, although that build chest is undergoing some rework. Perhaps it'll help you finding the right parameters for your own mod.

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by dgm5555 » Post

The following code adds listing of missing mods to the //allocate function:
Replace the for index loop with the following text in the allocate function (approx line 167 of WorldEdit/worldedit/serialization.lua)

Code: Select all

		local missingMods = ""
		for index = 1, count do
			local entry = nodes[index]
			x, y, z = originx + entry.x, originy + entry.y, originz + entry.z
			if x < pos1x then pos1x = x end
			if y < pos1y then pos1y = y end
			if z < pos1z then pos1z = z end
			if x > pos2x then pos2x = x end
			if y > pos2y then pos2y = y end
			if z > pos2z then pos2z = z end
			local colonLoc = string.find(entry.name, ":")
			if colonLoc ~= nil then
				local curMod = entry.name:sub(0,colonLoc-1)
				if not string.find(missingMods, (curMod.. ";")) then
					if not minetest.get_modpath(curMod) then
						missingMods = missingMods.. curMod.. "; "
					end
				end
			end			
		end
		if string.len(missingMods) ~= 0 then
			print("Worldedit file dependencies include the following missing mods:")
			print(missingMods)
			minetest.chat_send_player("singleplayer", "Worldedit file dependencies include the following missing mods: ".. missingMods, false)
		end
PS If people think it's reasonable code, I can add it as a pull request on the git hub. It currently only sends the chat to singleplayer, but sending it to the current user would only require a slightly larger change to the code (eg by returning missingMods and displaying the message from WorldEdit/worldedit_commands/init.lua:minetest.register_chatcommand("/allocate", {

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by dgm5555 » Post

The following code adds schem loads aligned to player forward direction. The functions are minor modifications of the original register //load and function load with added support for alignment relative to player:-
The chat command is "//loadalign filename"
NB //allocate will fail to correctly mark the load zone with this command unless you are facing north!
PS: only pos1 (the origin) is required to be set (this is actually also the case for the //load function)
[If I get a chance - next week, I'll add in using the players location to set pos1 if not already set, and possibly also automatically setting pos1/2 to the load-zone for further transformation].
The zone is loaded forward and to the right of the player. origin of the file is set at *save* time - I need to check, but I think as minx,miny,minz, (ie not necessarily at the location of either pos1 or pos2).
The code has only been tested on schem version4, so I'm not 100% sure it works with files saved with an earlier worldedit version.

Paste this at the end of WorldEdit/worldedit_commands/init.lua

Code: Select all

minetest.register_chatcommand("/loadalign", {
	params = "<file>",
	description = "Load nodes from \"(world folder)/schems/<file>[.we[m]]\" with position 1 of the current WorldEdit region as the origin",
	privs = {worldedit=true},
	func = function(name, param)
		local pos = get_position(name)
		if pos == nil then return end

		if param == "" then
			worldedit.player_notify(name, "invalid usage: " .. param)
			return
		end
		if not string.find(param, "^[%w \t.,+-_=!@#$%%^&*()%[%]{};'\"]+$") then
			worldedit.player_notify(name, "invalid file name: " .. param)
			return
		end

		--find the file in the world path
		local testpaths = {
			minetest.get_worldpath() .. "/schems/" .. param,
			minetest.get_worldpath() .. "/schems/" .. param .. ".we",
			minetest.get_worldpath() .. "/schems/" .. param .. ".wem",
		}
		local file, err
		for index, path in ipairs(testpaths) do
			file, err = io.open(path, "rb")
			if not err then
				break
			end
		end
		if err then
			worldedit.player_notify(name, "could not open file \"" .. param .. "\"")
			return
		end
		local value = file:read("*a")
		file:close()

		if worldedit.valueversion(value) == 0 then --unknown version
			worldedit.player_notify(name, "invalid file: file is invalid or created with newer version of WorldEdit")
			return
		end

		local yaw = minetest.get_player_by_name(name):get_look_yaw()
		if yaw ~= nil then
			-- Find angle player facing to enable rotation of position arrow based on yaw.
			yaw = math.deg(yaw)
			yaw = math.fmod (yaw, 360)
			if yaw<0 then yaw = 360 + yaw end
			if yaw>360 then yaw = yaw - 360 end           
			if yaw>315 or yaw<=45 then
				rotation="e"
			elseif yaw>45 and yaw<=135 then
				rotation="n"
			elseif yaw>135 and yaw<=225 then
				rotation="w"
			elseif yaw>225 and yaw<=315 then
				rotation="s"
			end
		end
		print (yaw)
		print (rotation)

		local count = worldedit.deserializeAligned(pos, value, rotation)

		worldedit.player_notify(name, count .. " nodes loaded")
	end,
})

Paste this at the end of WorldEdit/worldedit/serialization.lua

Code: Select all

--loads the nodes represented by string `value` at position `originpos`, returning the number of nodes deserialized
--contains code based on [table.save/table.load](http://lua-users.org/wiki/SaveTableToFile) by ChillCode, available under the MIT license (GPL compatible)
worldedit.deserializeAligned = function(originpos, value, rotation)
	--make area stay loaded
	local pos1, pos2 = worldedit.allocate(originpos, value)
	local manip = minetest.get_voxel_manip()
	manip:read_from_map(pos1, pos2)

	local originx, originy, originz = originpos.x, originpos.y, originpos.z
	local count = 0
	local add_node, get_meta = minetest.add_node, minetest.get_meta
	local version = worldedit.valueversion(value)
	if version == 1 or version == 2 then --original flat table format
		--obtain the node table
		local get_tables = loadstring(value)
		if not get_tables then --error loading value
			return count
		end
		local tables = get_tables()

		--transform the node table into an array of nodes
		for i = 1, #tables do
			for j, v in pairs(tables[i]) do
				if type(v) == "table" then
					tables[i][j] = tables[v[1]]
				end
			end
		end
		local nodes = tables[1]

		--load the node array
		count = #nodes
		if version == 1 then --original flat table format
			for index = 1, count do
				local entry = nodes[index]
				local pos = entry[1]
				if rotation == "w" then
					pos.x, pos.y, pos.z = originx + pos.z, originy - pos.y, originz - pos.x
				elseif rotation == "e" then
					pos.x, pos.y, pos.z = originx - pos.z, originy - pos.y, originz + pos.x
				elseif rotation == "s" then
					pos.x, pos.y, pos.z = originx + pos.x, originy - pos.y, originz + pos.z
				else
					pos.x, pos.y, pos.z = originx - pos.x, originy - pos.y, originz - pos.z
				end
--				pos.x, pos.y, pos.z = originx - pos.x, originy - pos.y, originz - pos.z
				add_node(pos, entry[2])
			end
		else --previous meta flat table format
			for index = 1, #nodes do
				local entry = nodes[index]
				if rotation == "w" then
					entry.x, entry.y, entry.z = originx - entry.z, originy + entry.y, originz + entry.x
				elseif rotation == "e" then
					entry.x, entry.y, entry.z = originx + entry.z, originy + entry.y, originz - entry.x
				elseif rotation == "s" then
					entry.x, entry.y, entry.z = originx - entry.x, originy + entry.y, originz - entry.z
				else
					entry.x, entry.y, entry.z = originx + entry.x, originy + entry.y, originz + entry.z
				end
--				entry.x, entry.y, entry.z = originx + entry.x, originy + entry.y, originz + entry.z

				add_node(entry, entry) --entry acts both as position and as node
				get_meta(entry):from_table(entry.meta)
			end
		end
	elseif version == 3 then --previous list format
		local pos = {x=0, y=0, z=0}
		local node = {name="", param1=0, param2=0}
		for x, y, z, name, param1, param2 in value:gmatch("([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)%s+([^%s]+)%s+(%d+)%s+(%d+)[^\r\n]*[\r\n]*") do --match node entries
			if rotation == "w" then
				pos.x, pos.y, pos.z = originx - tonumber(z), originy + tonumber(y), originz + tonumber(x)
			elseif rotation == "e" then
				pos.x, pos.y, pos.z = originx + tonumber(z), originy + tonumber(y), originz - tonumber(x)
			elseif rotation == "s" then
				pos.x, pos.y, pos.z = originx - tonumber(x), originy + tonumber(y), originz - tonumber(z)
			else
				pos.x, pos.y, pos.z = originx + tonumber(x), originy + tonumber(y), originz + tonumber(z)
			end
--			pos.x, pos.y, pos.z = originx + tonumber(x), originy + tonumber(y), originz + tonumber(z)
			node.name, node.param1, node.param2 = name, param1, param2
			add_node(pos, node)
			count = count + 1
		end
	elseif version == 4 then --current nested table format
		--wip: this is a filthy hack that works surprisingly well
		value = value:gsub("return%s*{", "", 1):gsub("}%s*$", "", 1)
		local escaped = value:gsub("\\\\", "@@"):gsub("\\\"", "@@"):gsub("(\"[^\"]*\")", function(s) return string.rep("@", #s) end)
		local startpos, startpos1, endpos = 1, 1
		local nodes = {}
		while true do
			startpos, endpos = escaped:find("},%s*{", startpos)
			if not startpos then
				break
			end
			local current = value:sub(startpos1, startpos)
			table.insert(nodes, minetest.deserialize("return " .. current))
			startpos, startpos1 = endpos, endpos
		end
		table.insert(nodes, minetest.deserialize("return " .. value:sub(startpos1)))

		--local nodes = minetest.deserialize(value) --wip: this is broken for larger tables in the current version of LuaJIT

		--load the nodes
		count = #nodes
		for index = 1, count do
			local entry = nodes[index]
			if rotation == "w" then
				entry.x, entry.y, entry.z = originx - entry.z, originy + entry.y, originz + entry.x
			elseif rotation == "e" then
				entry.x, entry.y, entry.z = originx + entry.z, originy + entry.y, originz - entry.x
			elseif rotation == "s" then
				entry.x, entry.y, entry.z = originx - entry.x, originy + entry.y, originz - entry.z
			else
				entry.x, entry.y, entry.z = originx + entry.x, originy + entry.y, originz + entry.z
			end
--			entry.x, entry.y, entry.z = originx + entry.x, originy + entry.y, originz + entry.z
			add_node(entry, entry) --entry acts both as position and as node
		end

		--load the metadata
		for index = 1, count do
			local entry = nodes[index]
			get_meta(entry):from_table(entry.meta)
		end
	end
	return count
end

User avatar
davi54l
Member
Posts: 16
Joined: Sun Apr 13, 2014 16:21

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by davi54l » Post

How to set position 1?

User avatar
cHyper
Member
Posts: 904
Joined: Fri May 06, 2011 08:49
GitHub: cHyper-0815OL
IRC: cHyper cHyper_de
In-game: cHyper cHyper_0815
Location: Austria
Contact:

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by cHyper » Post

davi54l wrote:How to set position 1?
//pos1

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

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by sfan5 » Post

dgm5555 wrote:{contributions}
Could you fork WorldEdit on github and send a Pull Request?
It makes it easier to integrate these changes.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

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

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by Temperest » Post

cHyper wrote:
davi54l wrote:How to set position 1?
//pos1
Also try the shorter version of the command, //1, if you have worldedit_shortcommands - it's included by default.

It probably would be a good idea to add a feature that lists missing mods in a region. It won't be too difficult to integrate your changes.

Giving an error if the directory can't be created is actually supposed to be the current behavior. What OS are you running, dgm5555? I guess there's some debugging to do...

As for your shorthand sequence, I think you can probably accomplish that using something like the following:

Code: Select all

//lua w,m,n=worldedit,minetest,"singleplayer";w.pos1[n]=m.get_player_by_name(n):getpos();REST_GOES_HERE
If you need any help constructing the proper command, let me know (preferably via GitHub issues, I check those more often). As sfan5 said, these are great contributions, but please submit them via GitHub so we can review it properly!

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by dgm5555 » Post

Temperest wrote:Giving an error if the directory can't be created is actually supposed to be the current behavior. What OS are you running, dgm5555? I guess there's some debugging to do...
I'm Ubuntu 14.04, but I'm thinking it could be a mod conflict, as it only happens on some worlds, when I get a chance I'll try to identify which one.

User avatar
ak399g
Member
Posts: 160
Joined: Tue Jul 30, 2013 02:36
In-game: SAFR
Contact:

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by ak399g » Post

Is there a way to copy in multiple directions? Like, if I wanted to copy a building 30 x nodes and 20 z nodes?

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

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by sfan5 » Post

ak399g wrote:Is there a way to copy in multiple directions? Like, if I wanted to copy a building 30 x nodes and 20 z nodes?
Just select the area with the building, there is no need for any fiddling with directions.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by dgm5555 » Post

sfan5 wrote:
ak399g wrote:Is there a way to copy in multiple directions? Like, if I wanted to copy a building 30 x nodes and 20 z nodes?
Just select the area with the building, there is no need for any fiddling with directions.
[ak399g]: Alternatively, do you mean you have a saved file of (say) 5x5x5 nodes, and you want to copy it 30 times along the x axis and 20 times along the z axis (ie generate 600 copies of the original). I'm not an expert on sequential commands, so I would have copied it 30 times along the x axis then reselect the block containing all 30 copies, then copy along the 20 times along the x axis (but yes this would be 2 operations)

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

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by Temperest » Post

Hi ak399g, I would recommend you copy in one axis, then move in the other axis. If you meant duplicate 600 times as dgm5555 stated, try using //stack in one direction, select the whole stacked area, then stack in the second direction.

You can also do this all in one operation using //lua, but this is more complicated.

If space is tight and it really must be copied and pasted, try using //save and //load. Make sure you use //allocate to avoid any accidents.

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by dgm5555 » Post

I've created a pull request on github for my changes. Essentially:-
1. add /loadalign load with player orientation. After doing this I realised it would probably have been easier to use existing code and set it up as sequential save1(temp space for load2/flip2/transpose2), set1=air, load2(into 1), flip2, transpose2, load1(back in) operations, but I didn't think of it earlier, it would have been slower, and it would have been a bit of a hastle saving and restoring the regions the loaded region damaged as it moved through.
2. add reporting of missing mods to /allocate (to version 4 files only). It's also added for /load and /loadalign, but is hidden by errors caused by attempting to add nodes from missing mods (which I will fix in the next few days)
Code is not the same as my above posts, and has been significantly enhanced/bug-tested for version 4 files, but not for other formats.

Sokomine
Member
Posts: 4159
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by Sokomine » Post

ak399g wrote: Is there a way to copy in multiple directions? Like, if I wanted to copy a building 30 x nodes and 20 z nodes?
A quick way to do this is to use my apartments mod. Use "/giveme apartment:apartment", place the control panel on your building, access the form, enter the dimensions of your buildings, use "save_as_buildingname" as the apartment name in order to save it. Then use "/giveme apartment:build_chest", place that chest, enter "buildingname_0_0" (or whatever was shown to you as filename after you did the above save) and fill out the form for copies to the left and upwards. You can also get rid of the copies of your building by digging the build chest. Note: The first 0 encodes how deep the building is burried into the ground, and the second 0 encodes original facedir/orientation (0, 90, 180 or 270).

User avatar
ak399g
Member
Posts: 160
Joined: Tue Jul 30, 2013 02:36
In-game: SAFR
Contact:

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by ak399g » Post

dgm5555 wrote:
sfan5 wrote:
ak399g wrote:Is there a way to copy in multiple directions? Like, if I wanted to copy a building 30 x nodes and 20 z nodes?
Just select the area with the building, there is no need for any fiddling with directions.
[ak399g]: Alternatively, do you mean you have a saved file of (say) 5x5x5 nodes, and you want to copy it 30 times along the x axis and 20 times along the z axis (ie generate 600 copies of the original). I'm not an expert on sequential commands, so I would have copied it 30 times along the x axis then reselect the block containing all 30 copies, then copy along the 20 times along the x axis (but yes this would be 2 operations)
Sorry if that wasn't clear.

Say I have a building between [10 10 10] and [20 20 20]. I know how to //copy it, say, 30 nodes along the x axis, so that the copy is located at [40 10 10] and [50 20 20]. I could then //copy that new building from [40 10 10] and [50 20 20] 20 nodes along the z axis, so that the second copy is located at [40 10 30] and [50 20 40]. I want to be able to //copy it along both x and z axes without doing two steps; i.e., going straight from [10 10 10] and [20 20 20] to [40 10 30] and [50 20 40].

In other terms, I can do a translation along a single axis, be it x or z (or y), but I want to do a translation across multiple axes at once.

I suppose I could "//save" and then "//load" but that seems convoluted. I also suppose I could //copy along x and then //move along z, but it'd be nice if I could do something like "//copy xz 30 20"

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [Mod] WorldEdit [1.0] [worldedit] {GitHub}

by dgm5555 » Post

Wondering about adding nodename aliases to the code to save having to repeatedly type in massive node names (try and correctly guess/type some of the 20-long node names created by scripts). You could run the command (eg /na n1 [nodename] -- n1 would be the alias, and if no name is supplied then you can punch a node to link. Aliases would then be stored in a table which could then be used for /set, /replace, and the various shape generators. Does anyone have any thoughts/extensions on the idea (or has it already been done elsewhere)?

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests