Re-organize the repository, Begin the minetest.conf file

This commit is contained in:
Quentin BUISSON-DEBON 2015-09-01 15:10:29 +02:00
parent e492f0fbf6
commit f982d7616e
326 changed files with 4410 additions and 4362 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.patch

22
LICENSE
View File

@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015 MinetestForFun
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1
game.conf Normal file
View File

@ -0,0 +1 @@
name = Minetest Bros

View File

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

0
minetestforfun-bros/menu/icon.png → menu/icon.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

78
minetest.conf Normal file
View File

@ -0,0 +1,78 @@
### GENERAL SETTINGS SERVER ###
###############################
name = Darcidride
# 0 = none, 1 = errors and debug, 2 = action, 3 = info, 4 = verbose
debug_log_level = 2
# Désactivation de l'anti-cheat qui fait ce téléporter en arrière si l'on va trop vite
disable_anticheat = true
# Options pour le type du serveur
creative_mode = false
enable_damage = true
disallow_empty_password = true
server_dedicated = true
# If true, actions are recorded for rollback
enable_rollback_recording = true
# Desactivate fire
disable_fire = true
mg_flags = nocaves, nodungeons
# no mapgen, and no lua mod for mapgen
mg_name = singlenode
# Activated the minimap usage if true
enable_minimap = true
### SERVER PERFORMANCE SETTINGS ###
###################################
max_block_send_distance = 8
max_simultaneous_block_sends_per_client = 10000
max_simultaneous_block_sends_server_total = 10000
active_block_range = 1
server_map_save_interval = 300
### Game balance ###
####################
movement_speed_walk = 5
movement_speed_crouch = 2
time_speed = 0
### SERVER ANNOUNCEMENT ###
###########################
server_announce = 1
server_url = http://minetestforfun.com/
server_name = MinetestForFun BROS
server_description = Bros server hosted by MinetestForFun Team.
motd = Welcome to MinetestForFun Team Bros server.
max_users = 20
serverlist_url = servers.minetest.net
server_address = 212.83.148.178
#port = 300??
strict_protocol_version_checking = false
#Sert à quoi ?
#remote_media = http://hugo.pro/minetest-data/
### Mods ###
############
# Mobs
#spawn_hostile_mobs = false
# HudBars
#hudbars_sorting = health=0,breath=1,hunger=2,thirst=3
# Random_Messages
#random_messages_interval = 900
# Bottom layout of death blocks
bottom_layout = -100
### IRC CHAT ###
################
#irc.server = digitalaudioconcepts.com
#irc.channel = #minetestforfun-hg
#irc.interval = 2.0
#irc.nick = MFFSB-Bot
# irc.password = # Empty because no channel password
#secure.trusted_mods = irc # Mod security
#irc.debug = false
#irc.disable_auto_connect = false
#irc.disable_auto_join = false
#irc.send_join_part = true
### TIME TO REMOVE DROPPED ITEMS ###
####################################
#item_entity_ttl = 30

View File

@ -1 +0,0 @@
name = minetestforfun-bros

View File

@ -1,9 +0,0 @@
# Game configuration file
mg_name = singlenode
time_speed = 0
# Bottom layout of death blocks
bottom_layout = -100
# Desactivate fire
disable_fire = true

View File

View File

@ -1,382 +1,382 @@
Chat Commands Chat Commands
------------- -------------
For more information, see the [README](README.md). For more information, see the [README](README.md).
Many commands also have shorter names that can be typed faster. For example, if we wanted to use `//move ? 5`, we could instead type `//m ? 5`. All shortened names are listed below: Many commands also have shorter names that can be typed faster. For example, if we wanted to use `//move ? 5`, we could instead type `//m ? 5`. All shortened names are listed below:
| Short Name | Original Name | | Short Name | Original Name |
|:-----------|:-------------------| |:-----------|:-------------------|
| `//i` | `//inspect` | | `//i` | `//inspect` |
| `//rst` | `//reset` | | `//rst` | `//reset` |
| `//mk` | `//mark` | | `//mk` | `//mark` |
| `//umk` | `//unmark` | | `//umk` | `//unmark` |
| `//1` | `//pos1` | | `//1` | `//pos1` |
| `//2` | `//pos2` | | `//2` | `//pos2` |
| `//fp` | `//fixedpos` | | `//fp` | `//fixedpos` |
| `//v` | `//volume` | | `//v` | `//volume` |
| `//s` | `//set` | | `//s` | `//set` |
| `//r` | `//replace` | | `//r` | `//replace` |
| `//ri` | `//replaceinverse` | | `//ri` | `//replaceinverse` |
| `//hspr` | `//hollowsphere` | | `//hspr` | `//hollowsphere` |
| `//spr` | `//sphere` | | `//spr` | `//sphere` |
| `//hdo` | `//hollowdome` | | `//hdo` | `//hollowdome` |
| `//do` | `//dome` | | `//do` | `//dome` |
| `//hcyl` | `//hollowcylinder` | | `//hcyl` | `//hollowcylinder` |
### `//about` ### `//about`
Get information about the mod. Get information about the mod.
//about //about
### `//inspect on/off/1/0/true/false/yes/no/enable/disable/<blank>` ### `//inspect on/off/1/0/true/false/yes/no/enable/disable/<blank>`
Enable or disable node inspection. Enable or disable node inspection.
//inspect on //inspect on
//inspect off //inspect off
//inspect 1 //inspect 1
//inspect 0 //inspect 0
//inspect true //inspect true
//inspect false //inspect false
//inspect yes //inspect yes
//inspect no //inspect no
//inspect enable //inspect enable
//inspect disable //inspect disable
//inspect //inspect
### `//reset` ### `//reset`
Reset the region so that it is empty. Reset the region so that it is empty.
//reset //reset
### `//mark` ### `//mark`
Show markers at the region positions. Show markers at the region positions.
//mark //mark
### `//unmark` ### `//unmark`
Hide markers if currently shown. Hide markers if currently shown.
//unmark //unmark
### `//pos1` ### `//pos1`
Set WorldEdit region position 1 to the player's location. Set WorldEdit region position 1 to the player's location.
//pos1 //pos1
### `//pos2` ### `//pos2`
Set WorldEdit region position 2 to the player's location. Set WorldEdit region position 2 to the player's location.
//pos2 //pos2
### `//p set/set1/set2/get` ### `//p set/set1/set2/get`
Set WorldEdit region, WorldEdit position 1, or WorldEdit position 2 by punching nodes, or display the current WorldEdit region. Set WorldEdit region, WorldEdit position 1, or WorldEdit position 2 by punching nodes, or display the current WorldEdit region.
//p set //p set
//p set1 //p set1
//p set2 //p set2
//p get //p get
### `//fixedpos set1 x y z` ### `//fixedpos set1 x y z`
Set a WorldEdit region position to the position at (`<x>`, `<y>`, `<z>`). Set a WorldEdit region position to the position at (`<x>`, `<y>`, `<z>`).
//fixedpos set1 0 0 0 //fixedpos set1 0 0 0
//fixedpos set1 -30 5 28 //fixedpos set1 -30 5 28
//fixedpos set2 1004 -200 432 //fixedpos set2 1004 -200 432
### `//volume` ### `//volume`
Display the volume of the current WorldEdit region. Display the volume of the current WorldEdit region.
//volume //volume
### `//deleteblocks` ### `//deleteblocks`
Delete the MapBlocks (16x16x16 units) that contain the selected region. This means that mapgen will be invoked for that area. As only whole MapBlocks get removed, the deleted area is usually larger than the selected one. Also, mapgen can trigger mechanisms like mud reflow or cavegen, which affects nodes (up to 112 nodes away) outside the MapBlock, so dont use this near buildings. Delete the MapBlocks (16x16x16 units) that contain the selected region. This means that mapgen will be invoked for that area. As only whole MapBlocks get removed, the deleted area is usually larger than the selected one. Also, mapgen can trigger mechanisms like mud reflow or cavegen, which affects nodes (up to 112 nodes away) outside the MapBlock, so dont use this near buildings.
//deleteblocks //deleteblocks
### `//set <node>` ### `//set <node>`
Set the current WorldEdit region to `<node>`. Set the current WorldEdit region to `<node>`.
//set air //set air
//set cactus //set cactus
//set Blue Lightstone //set Blue Lightstone
//set dirt with grass //set dirt with grass
### `//mix <node1> ...` ### `//mix <node1> ...`
Fill the current WorldEdit region with a random mix of `<node1>`, `...`. Fill the current WorldEdit region with a random mix of `<node1>`, `...`.
//mix air //mix air
//mix cactus stone glass sandstone //mix cactus stone glass sandstone
//mix Bronze //mix Bronze
//mix default:cobble air //mix default:cobble air
### `//replace <search node> <replace node>` ### `//replace <search node> <replace node>`
Replace all instances of `<search node>` with `<replace node>` in the current WorldEdit region. Replace all instances of `<search node>` with `<replace node>` in the current WorldEdit region.
//replace Cobblestone air //replace Cobblestone air
//replace lightstone_blue glass //replace lightstone_blue glass
//replace dirt Bronze Block //replace dirt Bronze Block
//replace mesecons:wire_00000000_off flowers:flower_tulip //replace mesecons:wire_00000000_off flowers:flower_tulip
### `//replaceinverse <search node> <replace node>` ### `//replaceinverse <search node> <replace node>`
Replace all nodes other than `<search node>` with `<replace node>` in the current WorldEdit region. Replace all nodes other than `<search node>` with `<replace node>` in the current WorldEdit region.
//replaceinverse Cobblestone air //replaceinverse Cobblestone air
//replaceinverse flowers:flower_waterlily glass //replaceinverse flowers:flower_waterlily glass
//replaceinverse dirt Bronze Block //replaceinverse dirt Bronze Block
//replaceinverse mesecons:wire_00000000_off flowers:flower_tulip //replaceinverse mesecons:wire_00000000_off flowers:flower_tulip
### `//hollowsphere <radius> <node>` ### `//hollowsphere <radius> <node>`
Add hollow sphere centered at WorldEdit position 1 with radius `<radius>`, composed of `<node>`. Add hollow sphere centered at WorldEdit position 1 with radius `<radius>`, composed of `<node>`.
//hollowsphere 5 Diamond Block //hollowsphere 5 Diamond Block
//hollowsphere 12 glass //hollowsphere 12 glass
//hollowsphere 17 mesecons:wire_00000000_off //hollowsphere 17 mesecons:wire_00000000_off
### `//sphere <radius> <node>` ### `//sphere <radius> <node>`
Add sphere centered at WorldEdit position 1 with radius `<radius>`, composed of `<node>`. Add sphere centered at WorldEdit position 1 with radius `<radius>`, composed of `<node>`.
//sphere 5 Diamond Block //sphere 5 Diamond Block
//sphere 12 glass //sphere 12 glass
//sphere 17 mesecons:wire_00000000_off //sphere 17 mesecons:wire_00000000_off
### `//hollowdome <radius> <node>` ### `//hollowdome <radius> <node>`
Add hollow dome centered at WorldEdit position 1 with radius `<radius>`, composed of `<node>`. Add hollow dome centered at WorldEdit position 1 with radius `<radius>`, composed of `<node>`.
//hollowdome 5 Diamond Block //hollowdome 5 Diamond Block
//hollowdome -12 glass //hollowdome -12 glass
//hollowdome 17 mesecons:wire_00000000_off //hollowdome 17 mesecons:wire_00000000_off
### `//dome <radius> <node>` ### `//dome <radius> <node>`
Add dome centered at WorldEdit position 1 with radius `<radius>`, composed of `<node>`. Add dome centered at WorldEdit position 1 with radius `<radius>`, composed of `<node>`.
//dome 5 Diamond Block //dome 5 Diamond Block
//dome -12 glass //dome -12 glass
//dome 17 mesecons:wire_00000000_off //dome 17 mesecons:wire_00000000_off
### `//hollowcylinder x/y/z/? <length> <radius> <node>` ### `//hollowcylinder x/y/z/? <length> <radius> <node>`
Add hollow cylinder at WorldEdit position 1 along the x/y/z/? axis with length `<length>` and radius `<radius>`, composed of `<node>`. Add hollow cylinder at WorldEdit position 1 along the x/y/z/? axis with length `<length>` and radius `<radius>`, composed of `<node>`.
//hollowcylinder x +5 8 Bronze Block //hollowcylinder x +5 8 Bronze Block
//hollowcylinder y 28 10 glass //hollowcylinder y 28 10 glass
//hollowcylinder z -12 3 mesecons:wire_00000000_off //hollowcylinder z -12 3 mesecons:wire_00000000_off
//hollowcylinder ? 2 4 default:stone //hollowcylinder ? 2 4 default:stone
### `//cylinder x/y/z/? <length> <radius> <node>` ### `//cylinder x/y/z/? <length> <radius> <node>`
Add cylinder at WorldEdit position 1 along the x/y/z/? axis with length `<length>` and radius `<radius>`, composed of `<node>`. Add cylinder at WorldEdit position 1 along the x/y/z/? axis with length `<length>` and radius `<radius>`, composed of `<node>`.
//cylinder x +5 8 Bronze Block //cylinder x +5 8 Bronze Block
//cylinder y 28 10 glass //cylinder y 28 10 glass
//cylinder z -12 3 mesecons:wire_00000000_off //cylinder z -12 3 mesecons:wire_00000000_off
//cylinder ? 2 4 default:stone //cylinder ? 2 4 default:stone
### `//pyramid x/y/z? <height> <node>` ### `//pyramid x/y/z? <height> <node>`
Add pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height `<height>`, composed of `<node>`. Add pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height `<height>`, composed of `<node>`.
//pyramid x 8 Diamond Block //pyramid x 8 Diamond Block
//pyramid y -5 glass //pyramid y -5 glass
//pyramid z 2 mesecons:wire_00000000_off //pyramid z 2 mesecons:wire_00000000_off
//pyramid ? 12 mesecons:wire_00000000_off //pyramid ? 12 mesecons:wire_00000000_off
### `//spiral <length> <height> <spacer> <node>` ### `//spiral <length> <height> <spacer> <node>`
Add spiral centered at WorldEdit position 1 with side length `<length>`, height `<height>`, space between walls `<spacer>`, composed of `<node>`. Add spiral centered at WorldEdit position 1 with side length `<length>`, height `<height>`, space between walls `<spacer>`, composed of `<node>`.
//spiral 20 5 3 Diamond Block //spiral 20 5 3 Diamond Block
//spiral 5 2 1 glass //spiral 5 2 1 glass
//spiral 7 1 5 mesecons:wire_00000000_off //spiral 7 1 5 mesecons:wire_00000000_off
### `//copy x/y/z/? <amount>` ### `//copy x/y/z/? <amount>`
Copy the current WorldEdit region along the x/y/z/? axis by `<amount>` nodes. Copy the current WorldEdit region along the x/y/z/? axis by `<amount>` nodes.
//copy x 15 //copy x 15
//copy y -7 //copy y -7
//copy z +4 //copy z +4
//copy ? 8 //copy ? 8
### `//move x/y/z/? <amount>` ### `//move x/y/z/? <amount>`
Move the current WorldEdit positions and region along the x/y/z/? axis by `<amount>` nodes. Move the current WorldEdit positions and region along the x/y/z/? axis by `<amount>` nodes.
//move x 15 //move x 15
//move y -7 //move y -7
//move z +4 //move z +4
//move ? -1 //move ? -1
### `//stack x/y/z/? <count>` ### `//stack x/y/z/? <count>`
Stack the current WorldEdit region along the x/y/z/? axis `<count>` times. Stack the current WorldEdit region along the x/y/z/? axis `<count>` times.
//stack x 3 //stack x 3
//stack y -1 //stack y -1
//stack z +5 //stack z +5
//stack ? 12 //stack ? 12
### `//stack2 <count> <x> <y> <z>` ### `//stack2 <count> <x> <y> <z>`
Stack the current WorldEdit region `<count>` times by offset `<x>`, `<y>`, `<z>`. Stack the current WorldEdit region `<count>` times by offset `<x>`, `<y>`, `<z>`.
//stack2 5 3 8 2 //stack2 5 3 8 2
//stack2 1 -1 -1 -1 //stack2 1 -1 -1 -1
### `//scale <factor>` ### `//scale <factor>`
Scale the current WorldEdit positions and region by a factor of positive integer `<factor>` with position 1 as the origin. Scale the current WorldEdit positions and region by a factor of positive integer `<factor>` with position 1 as the origin.
//scale 2 //scale 2
//scale 1 //scale 1
//scale 10 //scale 10
### `//transpose x/y/z/? x/y/z/?` ### `//transpose x/y/z/? x/y/z/?`
Transpose the current WorldEdit positions and region along the x/y/z/? and x/y/z/? axes. Transpose the current WorldEdit positions and region along the x/y/z/? and x/y/z/? axes.
//transpose x y //transpose x y
//transpose x z //transpose x z
//transpose y z //transpose y z
//transpose ? y //transpose ? y
### `//flip x/y/z/?` ### `//flip x/y/z/?`
Flip the current WorldEdit region along the x/y/z/? axis. Flip the current WorldEdit region along the x/y/z/? axis.
//flip x //flip x
//flip y //flip y
//flip z //flip z
//flip ? //flip ?
### `//rotate x/y/z/? <angle>` ### `//rotate x/y/z/? <angle>`
Rotate the current WorldEdit positions and region along the x/y/z/? axis by angle `<angle>` (90 degree increment). Rotate the current WorldEdit positions and region along the x/y/z/? axis by angle `<angle>` (90 degree increment).
//rotate x 90 //rotate x 90
//rotate y 180 //rotate y 180
//rotate z 270 //rotate z 270
//rotate ? -90 //rotate ? -90
### `//orient <angle>` ### `//orient <angle>`
Rotate oriented nodes in the current WorldEdit region around the Y axis by angle `<angle>` (90 degree increment) Rotate oriented nodes in the current WorldEdit region around the Y axis by angle `<angle>` (90 degree increment)
//orient 90 //orient 90
//orient 180 //orient 180
//orient 270 //orient 270
//orient -90 //orient -90
### `//fixlight` ### `//fixlight`
Fixes the lighting in the current WorldEdit region. Fixes the lighting in the current WorldEdit region.
//fixlight //fixlight
### `//hide` ### `//hide`
Hide all nodes in the current WorldEdit region non-destructively. Hide all nodes in the current WorldEdit region non-destructively.
//hide //hide
### `//suppress <node>` ### `//suppress <node>`
Suppress all <node> in the current WorldEdit region non-destructively. Suppress all <node> in the current WorldEdit region non-destructively.
//suppress Diamond Block //suppress Diamond Block
//suppress glass //suppress glass
//suppress mesecons:wire_00000000_off //suppress mesecons:wire_00000000_off
### `//highlight <node>` ### `//highlight <node>`
Highlight <node> in the current WorldEdit region by hiding everything else non-destructively. Highlight <node> in the current WorldEdit region by hiding everything else non-destructively.
//highlight Diamond Block //highlight Diamond Block
//highlight glass //highlight glass
//highlight mesecons:wire_00000000_off //highlight mesecons:wire_00000000_off
### `//restore` ### `//restore`
Restores nodes hidden with WorldEdit in the current WorldEdit region. Restores nodes hidden with WorldEdit in the current WorldEdit region.
//restore //restore
### `//save <file>` ### `//save <file>`
Save the current WorldEdit region to "(world folder)/schems/`<file>`.we". Save the current WorldEdit region to "(world folder)/schems/`<file>`.we".
//save some random filename //save some random filename
//save huge_base //save huge_base
### `//allocate <file>` ### `//allocate <file>`
Set the region defined by nodes from "(world folder)/schems/`<file>`.we" as the current WorldEdit region. Set the region defined by nodes from "(world folder)/schems/`<file>`.we" as the current WorldEdit region.
//allocate some random filename //allocate some random filename
//allocate huge_base //allocate huge_base
### `//load <file>` ### `//load <file>`
Load nodes from "(world folder)/schems/`<file>`.we" with position 1 of the current WorldEdit region as the origin. Load nodes from "(world folder)/schems/`<file>`.we" with position 1 of the current WorldEdit region as the origin.
//load some random filename //load some random filename
//load huge_base //load huge_base
### `//lua <code>` ### `//lua <code>`
Executes `<code>` as a Lua chunk in the global namespace. Executes `<code>` as a Lua chunk in the global namespace.
//lua worldedit.pos1["singleplayer"] = {x=0, y=0, z=0} //lua worldedit.pos1["singleplayer"] = {x=0, y=0, z=0}
//lua worldedit.rotate(worldedit.pos1["singleplayer"], worldedit.pos2["singleplayer"], "y", 90) //lua worldedit.rotate(worldedit.pos1["singleplayer"], worldedit.pos2["singleplayer"], "y", 90)
### `//luatransform <code>` ### `//luatransform <code>`
Executes `<code>` as a Lua chunk in the global namespace with the variable pos available, for each node in the current WorldEdit region. Executes `<code>` as a Lua chunk in the global namespace with the variable pos available, for each node in the current WorldEdit region.
//luatransform minetest.add_node(pos, {name="default:stone"}) //luatransform minetest.add_node(pos, {name="default:stone"})
//luatransform if minetest.get_node(pos).name == "air" then minetest.add_node(pos, {name="default:water_source"}) //luatransform if minetest.get_node(pos).name == "air" then minetest.add_node(pos, {name="default:water_source"})
### `//mtschemcreate <file>` ### `//mtschemcreate <file>`
Save the current WorldEdit region using the Minetest Schematic format to "(world folder)/schems/`<file>`.mts". Save the current WorldEdit region using the Minetest Schematic format to "(world folder)/schems/`<file>`.mts".
//mtschemcreate some random filename //mtschemcreate some random filename
//mtschemcreate huge_base //mtschemcreate huge_base
### `//mtschemplace <file>` ### `//mtschemplace <file>`
Load nodes from "(world folder)/schems/`<file>`.mts" with position 1 of the current WorldEdit region as the origin. Load nodes from "(world folder)/schems/`<file>`.mts" with position 1 of the current WorldEdit region as the origin.
//mtschemplace some random filename //mtschemplace some random filename
//mtschemplace huge_base //mtschemplace huge_base
### `//mtschemprob start/finish/get` ### `//mtschemprob start/finish/get`
After using `//mtschemprob start` all nodes punched will bring up a text field where a probablity can be entered. After using `//mtschemprob start` all nodes punched will bring up a text field where a probablity can be entered.
This mode can be left with `//mtschemprob finish`. `//mtschemprob get` will display the probabilities saved for the nodes. This mode can be left with `//mtschemprob finish`. `//mtschemprob get` will display the probabilities saved for the nodes.
//mtschemprob get //mtschemprob get
### `//clearobjects` ### `//clearobjects`
Clears all objects within the WorldEdit region. Clears all objects within the WorldEdit region.
//clearobjects //clearobjects

View File

@ -1,120 +1,120 @@
WorldEdit Tutorial WorldEdit Tutorial
================== ==================
This is a step-by-step tutorial outlining the basic usage of WorldEdit. For more information, see the [README](README.md). This is a step-by-step tutorial outlining the basic usage of WorldEdit. For more information, see the [README](README.md).
Let's start with a few assumptions: Let's start with a few assumptions:
* You have a compatible version of Minetest working. * You have a compatible version of Minetest working.
* See the [README](README.md) for compatibility information. * See the [README](README.md) for compatibility information.
* You have WorldEdit installed as a mod. * You have WorldEdit installed as a mod.
* If using Windows, [MODSTER](https://forum.minetest.net/viewtopic.php?pid=101463) makes installing mods totally painless. * If using Windows, [MODSTER](https://forum.minetest.net/viewtopic.php?pid=101463) makes installing mods totally painless.
* Simply download the file, extract the archive, and move it to the correct mod folder for Minetest. * Simply download the file, extract the archive, and move it to the correct mod folder for Minetest.
* See the installation instructions in [README](README.md) if you need more details. * See the installation instructions in [README](README.md) if you need more details.
* You are familiar with the basics of the game. * You are familiar with the basics of the game.
* How to walk, jump, and climb. * How to walk, jump, and climb.
* How to dig, place, and punch blocks. * How to dig, place, and punch blocks.
* One of the following: * One of the following:
* How to type into the chat and read text from it. * How to type into the chat and read text from it.
* How to open the inventory screen and press buttons on it. * How to open the inventory screen and press buttons on it.
Overview Overview
-------- --------
WorldEdit has a "region", which is simply a cuboid area defined by two markers, both of which the player can move around. Every player can have their own region with their own two markers. WorldEdit has a "region", which is simply a cuboid area defined by two markers, both of which the player can move around. Every player can have their own region with their own two markers.
WorldEdit GUI buttons and chat commands generally work inside the region selected, or around the first marker. WorldEdit GUI buttons and chat commands generally work inside the region selected, or around the first marker.
If you are using the chat commands, follow the steps under **Chat Commands**. If you are using the WorldEdit GUI, follow the steps under **WorldEdit GUI**. If you are using the chat commands, follow the steps under **Chat Commands**. If you are using the WorldEdit GUI, follow the steps under **WorldEdit GUI**.
Step 1: Selecting a region Step 1: Selecting a region
-------------------------- --------------------------
### Chat Commands ### Chat Commands
In the chat prompt, enter `//p set`. In the chat, you are prompted to punch two nodes to set the positions of the two markers. In the chat prompt, enter `//p set`. In the chat, you are prompted to punch two nodes to set the positions of the two markers.
Punch a nearby node. Be careful of breakable ones such as torches. A black cube reading "1" will appear around the node. This is the marker for WorldEdit position 1. Punch a nearby node. Be careful of breakable ones such as torches. A black cube reading "1" will appear around the node. This is the marker for WorldEdit position 1.
Walk away from the node you just punched. Now, punch another node. A black cube reading "2" will appear around the node. This is the marker for WorldEdit position 2. Walk away from the node you just punched. Now, punch another node. A black cube reading "2" will appear around the node. This is the marker for WorldEdit position 2.
### WorldEdit GUI ### WorldEdit GUI
Open the main WorldEdit GUI from your inventory screen. The icon looks like a globe with a red dot in the center. Open the main WorldEdit GUI from your inventory screen. The icon looks like a globe with a red dot in the center.
Press the "Get/Set Positions" button. On the new screen, press the "Set Position 1" button. The inventory screen should close. Press the "Get/Set Positions" button. On the new screen, press the "Set Position 1" button. The inventory screen should close.
Punch a nearby node. Be careful of breakable ones such as torches. A black cube reading "1" will appear around the node. This is the marker for WorldEdit position 1. Punch a nearby node. Be careful of breakable ones such as torches. A black cube reading "1" will appear around the node. This is the marker for WorldEdit position 1.
Walk away from the node you just punched. Open your inventory again. It should be on the same page as it was before. Walk away from the node you just punched. Open your inventory again. It should be on the same page as it was before.
Press the "Set Position 2" button. The inventory screen should close. Press the "Set Position 2" button. The inventory screen should close.
Now, punch another node. A black cube reading "2" will appear around the node. This is the marker for WorldEdit position 2. Now, punch another node. A black cube reading "2" will appear around the node. This is the marker for WorldEdit position 2.
Step 2: Region commands Step 2: Region commands
----------------------- -----------------------
### Chat Commands ### Chat Commands
In the chat prompt, enter `//set mese`. In the chat, you will see a message showing the number of nodes set after a small delay. In the chat prompt, enter `//set mese`. In the chat, you will see a message showing the number of nodes set after a small delay.
Look at the place between the two markers: it is now filled with MESE blocks! Look at the place between the two markers: it is now filled with MESE blocks!
The `//set <node>` command fills the region with whatever node you want. It is a region-oriented command, which means it works inside the WorldEdit region only. The `//set <node>` command fills the region with whatever node you want. It is a region-oriented command, which means it works inside the WorldEdit region only.
Now, try a few different variations, such as `//set torch`, `//set cobble`, and `//set water`. Now, try a few different variations, such as `//set torch`, `//set cobble`, and `//set water`.
### WorldEdit GUI ### WorldEdit GUI
Open the main WorldEdit GUI from your inventory screen. Open the main WorldEdit GUI from your inventory screen.
Press the "Set Nodes" button. You should see a new screen with various options for setting nodes. Press the "Set Nodes" button. You should see a new screen with various options for setting nodes.
Enter "mese" in the "Name" field. Press Search if you would like to see what the node you just entered looks like. Enter "mese" in the "Name" field. Press Search if you would like to see what the node you just entered looks like.
Press the "Set Nodes" button on this screen. In the chat, you will see a message showing the number of nodes set after a small delay. Press the "Set Nodes" button on this screen. In the chat, you will see a message showing the number of nodes set after a small delay.
Look at the place between the two markers: it is now filled with MESE blocks! Look at the place between the two markers: it is now filled with MESE blocks!
The "Set Nodes" function fills the region with whatever node you want. It is a region-oriented command, which means it works inside the WorldEdit region only. The "Set Nodes" function fills the region with whatever node you want. It is a region-oriented command, which means it works inside the WorldEdit region only.
Now, try a few different variations on the node name, such as "torch", "cobble", and "water". Now, try a few different variations on the node name, such as "torch", "cobble", and "water".
Step 3: Position commands Step 3: Position commands
------------------------- -------------------------
### Chat Commands ### Chat Commands
In the chat prompt, enter `//hollowdome 30 glass`. In the chat, you will see a message showing the number of nodes set after a small delay. In the chat prompt, enter `//hollowdome 30 glass`. In the chat, you will see a message showing the number of nodes set after a small delay.
Look around marker 1: it is now surrounded by a hollow glass dome! Look around marker 1: it is now surrounded by a hollow glass dome!
The `//hollowdome <radius> <node>` command creates a hollow dome centered around marker 1, made of any node you want. It is a position-oriented command, which means it works around marker 1 and can go outside the WorldEdit region. The `//hollowdome <radius> <node>` command creates a hollow dome centered around marker 1, made of any node you want. It is a position-oriented command, which means it works around marker 1 and can go outside the WorldEdit region.
### WorldEdit GUI ### WorldEdit GUI
Open the main WorldEdit GUI from your inventory screen. Open the main WorldEdit GUI from your inventory screen.
Press the "Sphere/Dome" button. You should see a new screen with various options for making spheres or domes. Press the "Sphere/Dome" button. You should see a new screen with various options for making spheres or domes.
Enter "glass" in the "Name" field. Press Search if you would like to see what the node you just entered looks like. Enter "glass" in the "Name" field. Press Search if you would like to see what the node you just entered looks like.
Enter "30" in the "Radius" field. Enter "30" in the "Radius" field.
Press the "Hollow Dome" button on this screen. In the chat, you will see a message showing the number of nodes added after a small delay. Press the "Hollow Dome" button on this screen. In the chat, you will see a message showing the number of nodes added after a small delay.
Look around marker 1: it is now surrounded by a hollow glass dome! Look around marker 1: it is now surrounded by a hollow glass dome!
The "Hollow Dome" function creates a hollow dome centered around marker 1, made of any node you want. It is a position-oriented command, which means it works around marker 1 and can go outside the WorldEdit region. The "Hollow Dome" function creates a hollow dome centered around marker 1, made of any node you want. It is a position-oriented command, which means it works around marker 1 and can go outside the WorldEdit region.
Step 4: Other commands Step 4: Other commands
---------------------- ----------------------
### Chat Commands ### Chat Commands
There are many more commands than what is shown here. See the [Chat Commands Reference](ChatCommands.md) for a detailed list of them, along with descriptions and examples for every single one. There are many more commands than what is shown here. See the [Chat Commands Reference](ChatCommands.md) for a detailed list of them, along with descriptions and examples for every single one.
If you're in-game and forgot how a command works, just use the `/help <command name>` command, without the first forward slash. For example, to see some information about the `//set <node>` command mentioned earlier, simply use `/help /set`. If you're in-game and forgot how a command works, just use the `/help <command name>` command, without the first forward slash. For example, to see some information about the `//set <node>` command mentioned earlier, simply use `/help /set`.
A very useful command to check out is the `//save <schematic>` command, which can save everything inside the WorldEdit region to a file, stored on the computer hosting the server (the player's computer, in single player mode). You can then later use `//load <schematic>` to load the data in a file into a world, even another world on another computer. A very useful command to check out is the `//save <schematic>` command, which can save everything inside the WorldEdit region to a file, stored on the computer hosting the server (the player's computer, in single player mode). You can then later use `//load <schematic>` to load the data in a file into a world, even another world on another computer.
### WorldEdit GUI ### WorldEdit GUI
This only scratches the surface of what WorldEdit is capable of. Most of the functions in the WorldEdit GUI correspond to chat commands, and so the [Chat Commands Reference](ChatCommands.md) may be useful if you get stuck. This only scratches the surface of what WorldEdit is capable of. Most of the functions in the WorldEdit GUI correspond to chat commands, and so the [Chat Commands Reference](ChatCommands.md) may be useful if you get stuck.
It is helpful to explore the various buttons in the interface and check out what they do. Learning the chat command interface is also useful if you use WorldEdit intensively - an experienced chat command user can usually work faster than an experienced WorldEdit GUI user. It is helpful to explore the various buttons in the interface and check out what they do. Learning the chat command interface is also useful if you use WorldEdit intensively - an experienced chat command user can usually work faster than an experienced WorldEdit GUI user.

View File

@ -1,219 +1,219 @@
WorldEdit API WorldEdit API
============= =============
The WorldEdit API is composed of multiple modules, each of which is independent and can be used without the other. Each module is contained within a single file. The WorldEdit API is composed of multiple modules, each of which is independent and can be used without the other. Each module is contained within a single file.
If needed, individual modules such as visualization.lua can be removed without affecting the rest of the program. The only file that cannot be removed is init.lua, which is necessary for the mod to run. If needed, individual modules such as visualization.lua can be removed without affecting the rest of the program. The only file that cannot be removed is init.lua, which is necessary for the mod to run.
For more information, see the [README](README.md). For more information, see the [README](README.md).
General General
------- -------
### value = worldedit.version ### value = worldedit.version
Contains the current version of WorldEdit in a table of the form `{major=MAJOR_INTEGER, minor=MINOR_INTEGER}`, where `MAJOR_INTEGER` is the major version (the number before the period) as an integer, and `MINOR_INTEGER` is the minor version (the number after the period) as an integer. This is intended for version checking purposes. Contains the current version of WorldEdit in a table of the form `{major=MAJOR_INTEGER, minor=MINOR_INTEGER}`, where `MAJOR_INTEGER` is the major version (the number before the period) as an integer, and `MINOR_INTEGER` is the minor version (the number after the period) as an integer. This is intended for version checking purposes.
### value = worldedit.version_string ### value = worldedit.version_string
Contains the current version of WorldEdit in the form of a string `"MAJOR_INTEGER.MINOR_INTEGER"`, where `MAJOR_INTEGER` is the major version (the number before the period) as an integer, and `MINOR_INTEGER` is the minor version (the number after the period) as an integer. This is intended for display purposes. Contains the current version of WorldEdit in the form of a string `"MAJOR_INTEGER.MINOR_INTEGER"`, where `MAJOR_INTEGER` is the major version (the number before the period) as an integer, and `MINOR_INTEGER` is the minor version (the number after the period) as an integer. This is intended for display purposes.
Manipulations Manipulations
------------- -------------
Contained in manipulations.lua, this module allows several node operations to be applied over a region. Contained in manipulations.lua, this module allows several node operations to be applied over a region.
### count = worldedit.set(pos1, pos2, node_name) ### count = worldedit.set(pos1, pos2, node_name)
Sets a region defined by positions `pos1` and `pos2` to `node_name`. To clear a region, use "air" as the value of `node_name`. Sets a region defined by positions `pos1` and `pos2` to `node_name`. To clear a region, use "air" as the value of `node_name`.
Returns the number of nodes set. Returns the number of nodes set.
### count = worldedit.replace(pos1, pos2, searchnode, replacenode) ### count = worldedit.replace(pos1, pos2, searchnode, replacenode)
Replaces all instances of `searchnode` with `replacenode` in a region defined by positions `pos1` and `pos2`. Replaces all instances of `searchnode` with `replacenode` in a region defined by positions `pos1` and `pos2`.
Returns the number of nodes replaced. Returns the number of nodes replaced.
### count = worldedit.replaceinverse(pos1, pos2, searchnode, replacenode) ### count = worldedit.replaceinverse(pos1, pos2, searchnode, replacenode)
Replaces all nodes other than `searchnode` with `replacenode` in a region defined by positions `pos1` and `pos2`. Replaces all nodes other than `searchnode` with `replacenode` in a region defined by positions `pos1` and `pos2`.
Returns the number of nodes replaced. Returns the number of nodes replaced.
### count = worldedit.copy(pos1, pos2, axis, amount) ### count = worldedit.copy(pos1, pos2, axis, amount)
Copies the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") by `amount` nodes. Copies the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") by `amount` nodes.
Returns the number of nodes copied. Returns the number of nodes copied.
### count = worldedit.move(pos1, pos2, axis, amount) ### count = worldedit.move(pos1, pos2, axis, amount)
Moves the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") by `amount` nodes. Moves the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") by `amount` nodes.
Returns the number of nodes moved. Returns the number of nodes moved.
### count = worldedit.stack(pos1, pos2, axis, count) ### count = worldedit.stack(pos1, pos2, axis, count)
Duplicates the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") `count` times. Duplicates the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") `count` times.
Returns the number of nodes stacked. Returns the number of nodes stacked.
### count = worldedit.stack2(pos1, pos2, direction, amount) ### count = worldedit.stack2(pos1, pos2, direction, amount)
Duplicates the region defined by positions `pos1` and `pos2` `amount` times with offset vector `direction`. Duplicates the region defined by positions `pos1` and `pos2` `amount` times with offset vector `direction`.
Returns the number of nodes stacked. Returns the number of nodes stacked.
### count, newpos1, newpos2 = worldedit.stretch(pos1, pos2, stretchx, stretchy, stretchz) ### count, newpos1, newpos2 = worldedit.stretch(pos1, pos2, stretchx, stretchy, stretchz)
Stretches the region defined by positions `pos1` and `pos2` by an factor of positive integers `stretchx`, `stretchy`. and `stretchz` along the X, Y, and Z axes, respectively, with `pos1` as the origin. Stretches the region defined by positions `pos1` and `pos2` by an factor of positive integers `stretchx`, `stretchy`. and `stretchz` along the X, Y, and Z axes, respectively, with `pos1` as the origin.
Returns the number of nodes stretched, the new scaled position 1, and the new scaled position 2. Returns the number of nodes stretched, the new scaled position 1, and the new scaled position 2.
### count, newpos1, newpos2 = worldedit.transpose(pos1, pos2, axis1, axis2) ### count, newpos1, newpos2 = worldedit.transpose(pos1, pos2, axis1, axis2)
Transposes a region defined by the positions `pos1` and `pos2` between the `axis1` and `axis2` axes ("x" or "y" or "z"). Transposes a region defined by the positions `pos1` and `pos2` between the `axis1` and `axis2` axes ("x" or "y" or "z").
Returns the number of nodes transposed, the new transposed position 1, and the new transposed position 2. Returns the number of nodes transposed, the new transposed position 1, and the new transposed position 2.
### count = worldedit.flip(pos1, pos2, axis) ### count = worldedit.flip(pos1, pos2, axis)
Flips a region defined by the positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z"). Flips a region defined by the positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z").
Returns the number of nodes flipped. Returns the number of nodes flipped.
### count, newpos2, newpos2 = worldedit.rotate(pos1, pos2, angle) ### count, newpos2, newpos2 = worldedit.rotate(pos1, pos2, angle)
Rotates a region defined by the positions `pos1` and `pos2` by `angle` degrees clockwise around the y axis (supporting 90 degree increments only). Rotates a region defined by the positions `pos1` and `pos2` by `angle` degrees clockwise around the y axis (supporting 90 degree increments only).
Returns the number of nodes rotated, the new position 1, and the new position 2. Returns the number of nodes rotated, the new position 1, and the new position 2.
### count = worldedit.orient(pos1, pos2, angle) ### count = worldedit.orient(pos1, pos2, angle)
Rotates all oriented nodes in a region defined by the positions `pos1` and `pos2` by `angle` degrees clockwise (90 degree increment) around the Y axis. Rotates all oriented nodes in a region defined by the positions `pos1` and `pos2` by `angle` degrees clockwise (90 degree increment) around the Y axis.
Returns the number of nodes oriented. Returns the number of nodes oriented.
### count = worldedit.fixlight(pos1, pos2) ### count = worldedit.fixlight(pos1, pos2)
Fixes the lighting in a region defined by positions `pos1` and `pos2`. Fixes the lighting in a region defined by positions `pos1` and `pos2`.
Returns the number of nodes updated. Returns the number of nodes updated.
### count = worldedit.clearobjects(pos1, pos2) ### count = worldedit.clearobjects(pos1, pos2)
Clears all objects in a region defined by the positions `pos1` and `pos2`. Clears all objects in a region defined by the positions `pos1` and `pos2`.
Returns the number of objects cleared. Returns the number of objects cleared.
Primitives Primitives
---------- ----------
Contained in primitives.lua, this module allows the creation of several geometric primitives. Contained in primitives.lua, this module allows the creation of several geometric primitives.
### count = worldedit.sphere(pos, radius, node_name, hollow) ### count = worldedit.sphere(pos, radius, node_name, hollow)
Adds a sphere centered at `pos` with radius `radius`, composed of `node_name`. Adds a sphere centered at `pos` with radius `radius`, composed of `node_name`.
Returns the number of nodes added. Returns the number of nodes added.
### count = worldedit.dome(pos, radius, node_name, hollow) ### count = worldedit.dome(pos, radius, node_name, hollow)
Adds a dome centered at `pos` with radius `radius`, composed of `node_name`. Adds a dome centered at `pos` with radius `radius`, composed of `node_name`.
Returns the number of nodes added. Returns the number of nodes added.
### count = worldedit.cylinder(pos, axis, length, radius, node_name, hollow) ### count = worldedit.cylinder(pos, axis, length, radius, node_name, hollow)
Adds a cylinder at `pos` along the `axis` axis ("x" or "y" or "z") with length `length` and radius `radius`, composed of `node_name`. Adds a cylinder at `pos` along the `axis` axis ("x" or "y" or "z") with length `length` and radius `radius`, composed of `node_name`.
Returns the number of nodes added. Returns the number of nodes added.
### count = worldedit.pyramid(pos, axis, height, node_name) ### count = worldedit.pyramid(pos, axis, height, node_name)
Adds a pyramid centered at `pos` along the `axis` axis ("x" or "y" or "z") with height `height`. Adds a pyramid centered at `pos` along the `axis` axis ("x" or "y" or "z") with height `height`.
Returns the number of nodes added. Returns the number of nodes added.
### count = worldedit.spiral(pos, length, height, spacer, node_name) ### count = worldedit.spiral(pos, length, height, spacer, node_name)
Adds a spiral centered at `pos` with side length `length`, height `height`, space between walls `spacer`, composed of `node_name`. Adds a spiral centered at `pos` with side length `length`, height `height`, space between walls `spacer`, composed of `node_name`.
Returns the number of nodes added. Returns the number of nodes added.
Visualization Visualization
------------- -------------
Contained in visualization.lua, this module allows nodes to be visualized in different ways. Contained in visualization.lua, this module allows nodes to be visualized in different ways.
### volume = worldedit.volume(pos1, pos2) ### volume = worldedit.volume(pos1, pos2)
Determines the volume of the region defined by positions `pos1` and `pos2`. Determines the volume of the region defined by positions `pos1` and `pos2`.
Returns the volume. Returns the volume.
### count = worldedit.hide(pos1, pos2) ### count = worldedit.hide(pos1, pos2)
Hides all nodes in a region defined by positions `pos1` and `pos2` by non-destructively replacing them with invisible nodes. Hides all nodes in a region defined by positions `pos1` and `pos2` by non-destructively replacing them with invisible nodes.
Returns the number of nodes hidden. Returns the number of nodes hidden.
### count = worldedit.suppress(pos1, pos2, node_name) ### count = worldedit.suppress(pos1, pos2, node_name)
Suppresses all instances of `node_name` in a region defined by positions `pos1` and `pos2` by non-destructively replacing them with invisible nodes. Suppresses all instances of `node_name` in a region defined by positions `pos1` and `pos2` by non-destructively replacing them with invisible nodes.
Returns the number of nodes suppressed. Returns the number of nodes suppressed.
### count = worldedit.highlight(pos1, pos2, node_name) ### count = worldedit.highlight(pos1, pos2, node_name)
Highlights all instances of `node_name` in a region defined by positions `pos1` and `pos2` by non-destructively hiding all other nodes. Highlights all instances of `node_name` in a region defined by positions `pos1` and `pos2` by non-destructively hiding all other nodes.
Returns the number of nodes found. Returns the number of nodes found.
### count = worldedit.restore(pos1, pos2) ### count = worldedit.restore(pos1, pos2)
Restores all nodes hidden with WorldEdit functions in a region defined by positions `pos1` and `pos2`. Restores all nodes hidden with WorldEdit functions in a region defined by positions `pos1` and `pos2`.
Returns the number of nodes restored. Returns the number of nodes restored.
Serialization Serialization
------------- -------------
Contained in serialization.lua, this module allows regions of nodes to be serialized and deserialized to formats suitable for use outside MineTest. Contained in serialization.lua, this module allows regions of nodes to be serialized and deserialized to formats suitable for use outside MineTest.
### version, extra_fields, content = worldedit.read_header(value) ### version, extra_fields, content = worldedit.read_header(value)
Reads the header from serialized data `value`. Reads the header from serialized data `value`.
Returns the version as a positive integer (nil for unknown versions), Returns the version as a positive integer (nil for unknown versions),
extra header fields (nil if not supported), and the content after the header. extra header fields (nil if not supported), and the content after the header.
### data, count = worldedit.serialize(pos1, pos2) ### data, count = worldedit.serialize(pos1, pos2)
Converts the region defined by positions `pos1` and `pos2` into a single string. Converts the region defined by positions `pos1` and `pos2` into a single string.
Returns the serialized data and the number of nodes serialized, or nil. Returns the serialized data and the number of nodes serialized, or nil.
### pos1, pos2, count = worldedit.allocate(origin_pos, value) ### pos1, pos2, count = worldedit.allocate(origin_pos, value)
Determines the volume the nodes represented by string `value` would occupy if deserialized at `origin_pos`. Determines the volume the nodes represented by string `value` would occupy if deserialized at `origin_pos`.
Returns the two corner positions and the number of nodes, or nil. Returns the two corner positions and the number of nodes, or nil.
### count = worldedit.deserialize(origin_pos, value) ### count = worldedit.deserialize(origin_pos, value)
Loads the nodes represented by string `value` at position `origin_pos`. Loads the nodes represented by string `value` at position `origin_pos`.
Returns the number of nodes deserialized or nil. Returns the number of nodes deserialized or nil.
Code Code
---- ----
Contained in code.lua, this module allows arbitrary Lua code to be used with WorldEdit. Contained in code.lua, this module allows arbitrary Lua code to be used with WorldEdit.
### error = worldedit.lua(code) ### error = worldedit.lua(code)
Executes `code` as a Lua chunk in the global namespace. Executes `code` as a Lua chunk in the global namespace.
Returns an error if the code fails or nil otherwise. Returns an error if the code fails or nil otherwise.
### error = worldedit.luatransform(pos1, pos2, code) ### error = worldedit.luatransform(pos1, pos2, code)
Executes `code` as a Lua chunk in the global namespace with the variable `pos` available, for each node in a region defined by positions `pos1` and `pos2`. Executes `code` as a Lua chunk in the global namespace with the variable `pos` available, for each node in a region defined by positions `pos1` and `pos2`.
Returns an error if the code fails or nil otherwise. Returns an error if the code fails or nil otherwise.

View File

@ -1,52 +1,52 @@
--- Lua code execution functions. --- Lua code execution functions.
-- @module worldedit.code -- @module worldedit.code
--- Executes `code` as a Lua chunk in the global namespace. --- Executes `code` as a Lua chunk in the global namespace.
-- @return An error message if the code fails, or nil on success. -- @return An error message if the code fails, or nil on success.
function worldedit.lua(code) function worldedit.lua(code)
local func, err = loadstring(code) local func, err = loadstring(code)
if not func then -- Syntax error if not func then -- Syntax error
return err return err
end end
local good, err = pcall(func) local good, err = pcall(func)
if not good then -- Runtime error if not good then -- Runtime error
return err return err
end end
return nil return nil
end end
--- Executes `code` as a Lua chunk in the global namespace with the variable --- Executes `code` as a Lua chunk in the global namespace with the variable
-- pos available, for each node in a region defined by positions `pos1` and -- pos available, for each node in a region defined by positions `pos1` and
-- `pos2`. -- `pos2`.
-- @return An error message if the code fails, or nil on success. -- @return An error message if the code fails, or nil on success.
function worldedit.luatransform(pos1, pos2, code) function worldedit.luatransform(pos1, pos2, code)
pos1, pos2 = worldedit.sort_pos(pos1, pos2) pos1, pos2 = worldedit.sort_pos(pos1, pos2)
local factory, err = loadstring("return function(pos) " .. code .. " end") local factory, err = loadstring("return function(pos) " .. code .. " end")
if not factory then -- Syntax error if not factory then -- Syntax error
return err return err
end end
local func = factory() local func = factory()
worldedit.keep_loaded(pos1, pos2) worldedit.keep_loaded(pos1, pos2)
local pos = {x=pos1.x, y=0, z=0} local pos = {x=pos1.x, y=0, z=0}
while pos.x <= pos2.x do while pos.x <= pos2.x do
pos.y = pos1.y pos.y = pos1.y
while pos.y <= pos2.y do while pos.y <= pos2.y do
pos.z = pos1.z pos.z = pos1.z
while pos.z <= pos2.z do while pos.z <= pos2.z do
local good, err = pcall(func, pos) local good, err = pcall(func, pos)
if not good then -- Runtime error if not good then -- Runtime error
return err return err
end end
pos.z = pos.z + 1 pos.z = pos.z + 1
end end
pos.y = pos.y + 1 pos.y = pos.y + 1
end end
pos.x = pos.x + 1 pos.x = pos.x + 1
end end
return nil return nil
end end

View File

@ -1,74 +1,74 @@
--- Compatibility functions. --- Compatibility functions.
-- @module worldedit.compatibility -- @module worldedit.compatibility
local function deprecated(new_func) local function deprecated(new_func)
local info = debug.getinfo(1, "n") local info = debug.getinfo(1, "n")
local msg = "worldedit." .. info.name .. "() is deprecated." local msg = "worldedit." .. info.name .. "() is deprecated."
if new_func then if new_func then
msg = msg .. " Use worldedit." .. new_func .. "() instead." msg = msg .. " Use worldedit." .. new_func .. "() instead."
end end
minetest.log("deprecated", msg) minetest.log("deprecated", msg)
end end
worldedit.allocate_old = worldedit.allocate worldedit.allocate_old = worldedit.allocate
worldedit.deserialize_old = worldedit.deserialize worldedit.deserialize_old = worldedit.deserialize
function worldedit.metasave(pos1, pos2, filename) function worldedit.metasave(pos1, pos2, filename)
deprecated("save") deprecated("save")
local file, err = io.open(filename, "wb") local file, err = io.open(filename, "wb")
if err then return 0 end if err then return 0 end
local data, count = worldedit.serialize(pos1, pos2) local data, count = worldedit.serialize(pos1, pos2)
file:write(data) file:write(data)
file:close() file:close()
return count return count
end end
function worldedit.metaload(originpos, filename) function worldedit.metaload(originpos, filename)
deprecated("load") deprecated("load")
filename = minetest.get_worldpath() .. "/schems/" .. file .. ".wem" filename = minetest.get_worldpath() .. "/schems/" .. file .. ".wem"
local file, err = io.open(filename, "wb") local file, err = io.open(filename, "wb")
if err then return 0 end if err then return 0 end
local data = file:read("*a") local data = file:read("*a")
return worldedit.deserialize(originpos, data) return worldedit.deserialize(originpos, data)
end end
function worldedit.scale(pos1, pos2, factor) function worldedit.scale(pos1, pos2, factor)
deprecated("stretch") deprecated("stretch")
return worldedit.stretch(pos1, pos2, factor, factor, factor) return worldedit.stretch(pos1, pos2, factor, factor, factor)
end end
function worldedit.valueversion(value) function worldedit.valueversion(value)
deprecated("read_header") deprecated("read_header")
local version = worldedit.read_header(value) local version = worldedit.read_header(value)
if not version or version > worldedit.LATEST_SERIALIZATION_VERSION then if not version or version > worldedit.LATEST_SERIALIZATION_VERSION then
return 0 return 0
end end
return version return version
end end
function worldedit.replaceinverse(pos1, pos2, search_node, replace_node) function worldedit.replaceinverse(pos1, pos2, search_node, replace_node)
deprecated("replace") deprecated("replace")
return worldedit.replace(pos1, pos2, search_node, replace_node, true) return worldedit.replace(pos1, pos2, search_node, replace_node, true)
end end
function worldedit.clearobjects(...) function worldedit.clearobjects(...)
deprecated("clear_objects") deprecated("clear_objects")
return worldedit.clear_objects(...) return worldedit.clear_objects(...)
end end
function worldedit.hollow_sphere(pos, radius, node_name) function worldedit.hollow_sphere(pos, radius, node_name)
deprecated("sphere") deprecated("sphere")
return worldedit.sphere(pos, radius, node_name, true) return worldedit.sphere(pos, radius, node_name, true)
end end
function worldedit.hollow_dome(pos, radius, node_name) function worldedit.hollow_dome(pos, radius, node_name)
deprecated("dome") deprecated("dome")
return worldedit.dome(pos, radius, node_name, true) return worldedit.dome(pos, radius, node_name, true)
end end
function worldedit.hollow_cylinder(pos, axis, length, radius, node_name) function worldedit.hollow_cylinder(pos, axis, length, radius, node_name)
deprecated("cylinder") deprecated("cylinder")
return worldedit.cylinder(pos, axis, length, radius, node_name, true) return worldedit.cylinder(pos, axis, length, radius, node_name, true)
end end

View File

@ -1,44 +1,44 @@
--- Worldedit. --- Worldedit.
-- @module worldedit -- @module worldedit
-- @release 1.1 -- @release 1.1
-- @copyright 2013 sfan5, Anthony Zhang (Uberi/Temperest), and Brett O'Donnell (cornernote). -- @copyright 2013 sfan5, Anthony Zhang (Uberi/Temperest), and Brett O'Donnell (cornernote).
-- @license GNU Affero General Public License version 3 (AGPLv3) -- @license GNU Affero General Public License version 3 (AGPLv3)
-- @author sfan5 -- @author sfan5
-- @author Anthony Zang (Uberi/Temperest) -- @author Anthony Zang (Uberi/Temperest)
-- @author Bret O'Donnel (cornernote) -- @author Bret O'Donnel (cornernote)
-- @author ShadowNinja -- @author ShadowNinja
worldedit = {} worldedit = {}
worldedit.version = {1, 1, major=1, minor=1} worldedit.version = {1, 1, major=1, minor=1}
worldedit.version_string = table.concat(worldedit.version, ".") worldedit.version_string = table.concat(worldedit.version, ".")
if not minetest.get_voxel_manip then if not minetest.get_voxel_manip then
local err_msg = "This version of WorldEdit requires Minetest 0.4.8 or later! You have an old version." local err_msg = "This version of WorldEdit requires Minetest 0.4.8 or later! You have an old version."
minetest.log("error", string.rep("#", 128)) minetest.log("error", string.rep("#", 128))
minetest.log("error", err_msg) minetest.log("error", err_msg)
minetest.log("error", string.rep("#", 128)) minetest.log("error", string.rep("#", 128))
error(err_msg) error(err_msg)
end end
local path = minetest.get_modpath(minetest.get_current_modname()) local path = minetest.get_modpath(minetest.get_current_modname())
local function load_module(path) local function load_module(path)
local file = io.open(path, "r") local file = io.open(path, "r")
if not file then return end if not file then return end
file:close() file:close()
return dofile(path) return dofile(path)
end end
dofile(path .. "/common.lua") dofile(path .. "/common.lua")
load_module(path .. "/manipulations.lua") load_module(path .. "/manipulations.lua")
load_module(path .. "/primitives.lua") load_module(path .. "/primitives.lua")
load_module(path .. "/visualization.lua") load_module(path .. "/visualization.lua")
load_module(path .. "/serialization.lua") load_module(path .. "/serialization.lua")
load_module(path .. "/code.lua") load_module(path .. "/code.lua")
load_module(path .. "/compatibility.lua") load_module(path .. "/compatibility.lua")
if minetest.setting_getbool("log_mods") then if minetest.setting_getbool("log_mods") then
print("[WorldEdit] Loaded!") print("[WorldEdit] Loaded!")
end end

File diff suppressed because it is too large Load Diff

View File

@ -1,273 +1,273 @@
--- Functions for creating primitive shapes. --- Functions for creating primitive shapes.
-- @module worldedit.primitives -- @module worldedit.primitives
local mh = worldedit.manip_helpers local mh = worldedit.manip_helpers
--- Adds a sphere of `node_name` centered at `pos`. --- Adds a sphere of `node_name` centered at `pos`.
-- @param pos Position to center sphere at. -- @param pos Position to center sphere at.
-- @param radius Sphere radius. -- @param radius Sphere radius.
-- @param node_name Name of node to make shere of. -- @param node_name Name of node to make shere of.
-- @param hollow Whether the sphere should be hollow. -- @param hollow Whether the sphere should be hollow.
-- @return The number of nodes added. -- @return The number of nodes added.
function worldedit.sphere(pos, radius, node_name, hollow) function worldedit.sphere(pos, radius, node_name, hollow)
local manip, area = mh.init_radius(pos, radius) local manip, area = mh.init_radius(pos, radius)
local data = mh.get_empty_data(area) local data = mh.get_empty_data(area)
-- Fill selected area with node -- Fill selected area with node
local node_id = minetest.get_content_id(node_name) local node_id = minetest.get_content_id(node_name)
local min_radius, max_radius = radius * (radius - 1), radius * (radius + 1) local min_radius, max_radius = radius * (radius - 1), radius * (radius + 1)
local offset_x, offset_y, offset_z = pos.x - area.MinEdge.x, pos.y - area.MinEdge.y, pos.z - area.MinEdge.z local offset_x, offset_y, offset_z = pos.x - area.MinEdge.x, pos.y - area.MinEdge.y, pos.z - area.MinEdge.z
local stride_z, stride_y = area.zstride, area.ystride local stride_z, stride_y = area.zstride, area.ystride
local count = 0 local count = 0
for z = -radius, radius do for z = -radius, radius do
-- Offset contributed by z plus 1 to make it 1-indexed -- Offset contributed by z plus 1 to make it 1-indexed
local new_z = (z + offset_z) * stride_z + 1 local new_z = (z + offset_z) * stride_z + 1
for y = -radius, radius do for y = -radius, radius do
local new_y = new_z + (y + offset_y) * stride_y local new_y = new_z + (y + offset_y) * stride_y
for x = -radius, radius do for x = -radius, radius do
local squared = x * x + y * y + z * z local squared = x * x + y * y + z * z
if squared <= max_radius and (not hollow or squared >= min_radius) then if squared <= max_radius and (not hollow or squared >= min_radius) then
-- Position is on surface of sphere -- Position is on surface of sphere
local i = new_y + (x + offset_x) local i = new_y + (x + offset_x)
data[i] = node_id data[i] = node_id
count = count + 1 count = count + 1
end end
end end
end end
end end
mh.finish(manip, data) mh.finish(manip, data)
return count return count
end end
--- Adds a dome. --- Adds a dome.
-- @param pos Position to center dome at. -- @param pos Position to center dome at.
-- @param radius Dome radius. Negative for concave domes. -- @param radius Dome radius. Negative for concave domes.
-- @param node_name Name of node to make dome of. -- @param node_name Name of node to make dome of.
-- @param hollow Whether the dome should be hollow. -- @param hollow Whether the dome should be hollow.
-- @return The number of nodes added. -- @return The number of nodes added.
-- TODO: Add axis option. -- TODO: Add axis option.
function worldedit.dome(pos, radius, node_name, hollow) function worldedit.dome(pos, radius, node_name, hollow)
local min_y, max_y = 0, radius local min_y, max_y = 0, radius
if radius < 0 then if radius < 0 then
radius = -radius radius = -radius
min_y, max_y = -radius, 0 min_y, max_y = -radius, 0
end end
local manip, area = mh.init_axis_radius(pos, "y", radius) local manip, area = mh.init_axis_radius(pos, "y", radius)
local data = mh.get_empty_data(area) local data = mh.get_empty_data(area)
-- Add dome -- Add dome
local node_id = minetest.get_content_id(node_name) local node_id = minetest.get_content_id(node_name)
local min_radius, max_radius = radius * (radius - 1), radius * (radius + 1) local min_radius, max_radius = radius * (radius - 1), radius * (radius + 1)
local offset_x, offset_y, offset_z = pos.x - area.MinEdge.x, pos.y - area.MinEdge.y, pos.z - area.MinEdge.z local offset_x, offset_y, offset_z = pos.x - area.MinEdge.x, pos.y - area.MinEdge.y, pos.z - area.MinEdge.z
local stride_z, stride_y = area.zstride, area.ystride local stride_z, stride_y = area.zstride, area.ystride
local count = 0 local count = 0
for z = -radius, radius do for z = -radius, radius do
local new_z = (z + offset_z) * stride_z + 1 --offset contributed by z plus 1 to make it 1-indexed local new_z = (z + offset_z) * stride_z + 1 --offset contributed by z plus 1 to make it 1-indexed
for y = min_y, max_y do for y = min_y, max_y do
local new_y = new_z + (y + offset_y) * stride_y local new_y = new_z + (y + offset_y) * stride_y
for x = -radius, radius do for x = -radius, radius do
local squared = x * x + y * y + z * z local squared = x * x + y * y + z * z
if squared <= max_radius and (not hollow or squared >= min_radius) then if squared <= max_radius and (not hollow or squared >= min_radius) then
-- Position is in dome -- Position is in dome
local i = new_y + (x + offset_x) local i = new_y + (x + offset_x)
data[i] = node_id data[i] = node_id
count = count + 1 count = count + 1
end end
end end
end end
end end
mh.finish(manip, data) mh.finish(manip, data)
return count return count
end end
--- Adds a cylinder. --- Adds a cylinder.
-- @param pos Position to center base of cylinder at. -- @param pos Position to center base of cylinder at.
-- @param axis Axis ("x", "y", or "z") -- @param axis Axis ("x", "y", or "z")
-- @param length Cylinder length. -- @param length Cylinder length.
-- @param radius Cylinder radius. -- @param radius Cylinder radius.
-- @param node_name Name of node to make cylinder of. -- @param node_name Name of node to make cylinder of.
-- @param hollow Whether the cylinder should be hollow. -- @param hollow Whether the cylinder should be hollow.
-- @return The number of nodes added. -- @return The number of nodes added.
function worldedit.cylinder(pos, axis, length, radius, node_name, hollow) function worldedit.cylinder(pos, axis, length, radius, node_name, hollow)
local other1, other2 = worldedit.get_axis_others(axis) local other1, other2 = worldedit.get_axis_others(axis)
-- Handle negative lengths -- Handle negative lengths
local current_pos = {x=pos.x, y=pos.y, z=pos.z} local current_pos = {x=pos.x, y=pos.y, z=pos.z}
if length < 0 then if length < 0 then
length = -length length = -length
current_pos[axis] = current_pos[axis] - length current_pos[axis] = current_pos[axis] - length
end end
-- Set up voxel manipulator -- Set up voxel manipulator
local manip, area = mh.init_axis_radius_length(current_pos, axis, radius, length) local manip, area = mh.init_axis_radius_length(current_pos, axis, radius, length)
local data = mh.get_empty_data(area) local data = mh.get_empty_data(area)
-- Add cylinder -- Add cylinder
local node_id = minetest.get_content_id(node_name) local node_id = minetest.get_content_id(node_name)
local min_radius, max_radius = radius * (radius - 1), radius * (radius + 1) local min_radius, max_radius = radius * (radius - 1), radius * (radius + 1)
local stride = {x=1, y=area.ystride, z=area.zstride} local stride = {x=1, y=area.ystride, z=area.zstride}
local offset = { local offset = {
x = current_pos.x - area.MinEdge.x, x = current_pos.x - area.MinEdge.x,
y = current_pos.y - area.MinEdge.y, y = current_pos.y - area.MinEdge.y,
z = current_pos.z - area.MinEdge.z, z = current_pos.z - area.MinEdge.z,
} }
local min_slice, max_slice = offset[axis], offset[axis] + length - 1 local min_slice, max_slice = offset[axis], offset[axis] + length - 1
local count = 0 local count = 0
for index2 = -radius, radius do for index2 = -radius, radius do
-- Offset contributed by other axis 1 plus 1 to make it 1-indexed -- Offset contributed by other axis 1 plus 1 to make it 1-indexed
local new_index2 = (index2 + offset[other1]) * stride[other1] + 1 local new_index2 = (index2 + offset[other1]) * stride[other1] + 1
for index3 = -radius, radius do for index3 = -radius, radius do
local new_index3 = new_index2 + (index3 + offset[other2]) * stride[other2] local new_index3 = new_index2 + (index3 + offset[other2]) * stride[other2]
local squared = index2 * index2 + index3 * index3 local squared = index2 * index2 + index3 * index3
if squared <= max_radius and (not hollow or squared >= min_radius) then if squared <= max_radius and (not hollow or squared >= min_radius) then
-- Position is in cylinder -- Position is in cylinder
-- Add column along axis -- Add column along axis
for index1 = min_slice, max_slice do for index1 = min_slice, max_slice do
local vi = new_index3 + index1 * stride[axis] local vi = new_index3 + index1 * stride[axis]
data[vi] = node_id data[vi] = node_id
end end
count = count + length count = count + length
end end
end end
end end
mh.finish(manip, data) mh.finish(manip, data)
return count return count
end end
--- Adds a pyramid. --- Adds a pyramid.
-- @param pos Position to center base of pyramid at. -- @param pos Position to center base of pyramid at.
-- @param axis Axis ("x", "y", or "z") -- @param axis Axis ("x", "y", or "z")
-- @param height Pyramid height. -- @param height Pyramid height.
-- @param node_name Name of node to make pyramid of. -- @param node_name Name of node to make pyramid of.
-- @return The number of nodes added. -- @return The number of nodes added.
function worldedit.pyramid(pos, axis, height, node_name) function worldedit.pyramid(pos, axis, height, node_name)
local other1, other2 = worldedit.get_axis_others(axis) local other1, other2 = worldedit.get_axis_others(axis)
-- Set up voxel manipulator -- Set up voxel manipulator
local manip, area = mh.init_axis_radius(pos, axis, local manip, area = mh.init_axis_radius(pos, axis,
height >= 0 and height or -height) height >= 0 and height or -height)
local data = mh.get_empty_data() local data = mh.get_empty_data()
-- Handle inverted pyramids -- Handle inverted pyramids
local start_axis, end_axis, step local start_axis, end_axis, step
if height > 0 then if height > 0 then
height = height - 1 height = height - 1
step = 1 step = 1
else else
height = height + 1 height = height + 1
step = -1 step = -1
end end
-- Add pyramid -- Add pyramid
local node_id = minetest.get_content_id(node_name) local node_id = minetest.get_content_id(node_name)
local stride = {x=1, y=area.ystride, z=area.zstride} local stride = {x=1, y=area.ystride, z=area.zstride}
local offset = { local offset = {
x = pos.x - area.MinEdge.x, x = pos.x - area.MinEdge.x,
y = pos.y - area.MinEdge.y, y = pos.y - area.MinEdge.y,
z = pos.z - area.MinEdge.z, z = pos.z - area.MinEdge.z,
} }
local size = height * step local size = height * step
local count = 0 local count = 0
-- For each level of the pyramid -- For each level of the pyramid
for index1 = 0, height, step do for index1 = 0, height, step do
-- Offset contributed by axis plus 1 to make it 1-indexed -- Offset contributed by axis plus 1 to make it 1-indexed
local new_index1 = (index1 + offset[axis]) * stride[axis] + 1 local new_index1 = (index1 + offset[axis]) * stride[axis] + 1
for index2 = -size, size do for index2 = -size, size do
local new_index2 = new_index1 + (index2 + offset[other1]) * stride[other1] local new_index2 = new_index1 + (index2 + offset[other1]) * stride[other1]
for index3 = -size, size do for index3 = -size, size do
local i = new_index2 + (index3 + offset[other2]) * stride[other2] local i = new_index2 + (index3 + offset[other2]) * stride[other2]
data[i] = node_id data[i] = node_id
end end
end end
count = count + (size * 2 + 1) ^ 2 count = count + (size * 2 + 1) ^ 2
size = size - 1 size = size - 1
end end
mh.finish(manip, data) mh.finish(manip, data)
return count return count
end end
--- Adds a spiral. --- Adds a spiral.
-- @param pos Position to center spiral at. -- @param pos Position to center spiral at.
-- @param length Spral length. -- @param length Spral length.
-- @param height Spiral height. -- @param height Spiral height.
-- @param spacer Space between walls. -- @param spacer Space between walls.
-- @param node_name Name of node to make spiral of. -- @param node_name Name of node to make spiral of.
-- @return Number of nodes added. -- @return Number of nodes added.
-- TODO: Add axis option. -- TODO: Add axis option.
function worldedit.spiral(pos, length, height, spacer, node_name) function worldedit.spiral(pos, length, height, spacer, node_name)
local extent = math.ceil(length / 2) local extent = math.ceil(length / 2)
local manip, area = mh.init_axis_radius_length(pos, "y", extent, height) local manip, area = mh.init_axis_radius_length(pos, "y", extent, height)
local data = mh.get_empty_data(area) local data = mh.get_empty_data(area)
-- Set up variables -- Set up variables
local node_id = minetest.get_content_id(node_name) local node_id = minetest.get_content_id(node_name)
local stride = {x=1, y=area.ystride, z=area.zstride} local stride = {x=1, y=area.ystride, z=area.zstride}
local offset_x, offset_y, offset_z = pos.x - area.MinEdge.x, pos.y - area.MinEdge.y, pos.z - area.MinEdge.z local offset_x, offset_y, offset_z = pos.x - area.MinEdge.x, pos.y - area.MinEdge.y, pos.z - area.MinEdge.z
local i = offset_z * stride.z + offset_y * stride.y + offset_x + 1 local i = offset_z * stride.z + offset_y * stride.y + offset_x + 1
-- Add first column -- Add first column
local count = height local count = height
local column = i local column = i
for y = 1, height do for y = 1, height do
data[column] = node_id data[column] = node_id
column = column + stride.y column = column + stride.y
end end
-- Add spiral segments -- Add spiral segments
local stride_axis, stride_other = stride.x, stride.z local stride_axis, stride_other = stride.x, stride.z
local sign = -1 local sign = -1
local segment_length = 0 local segment_length = 0
spacer = spacer + 1 spacer = spacer + 1
-- Go through each segment except the last -- Go through each segment except the last
for segment = 1, math.floor(length / spacer) * 2 do for segment = 1, math.floor(length / spacer) * 2 do
-- Change sign and length every other turn starting with the first -- Change sign and length every other turn starting with the first
if segment % 2 == 1 then if segment % 2 == 1 then
sign = -sign sign = -sign
segment_length = segment_length + spacer segment_length = segment_length + spacer
end end
-- Fill segment -- Fill segment
for index = 1, segment_length do for index = 1, segment_length do
-- Move along the direction of the segment -- Move along the direction of the segment
i = i + stride_axis * sign i = i + stride_axis * sign
local column = i local column = i
-- Add column -- Add column
for y = 1, height do for y = 1, height do
data[column] = node_id data[column] = node_id
column = column + stride.y column = column + stride.y
end end
end end
count = count + segment_length * height count = count + segment_length * height
stride_axis, stride_other = stride_other, stride_axis -- Swap axes stride_axis, stride_other = stride_other, stride_axis -- Swap axes
end end
-- Add shorter final segment -- Add shorter final segment
sign = -sign sign = -sign
for index = 1, segment_length do for index = 1, segment_length do
i = i + stride_axis * sign i = i + stride_axis * sign
local column = i local column = i
-- Add column -- Add column
for y = 1, height do for y = 1, height do
data[column] = node_id data[column] = node_id
column = column + stride.y column = column + stride.y
end end
end end
count = count + segment_length * height count = count + segment_length * height
mh.finish(manip, data) mh.finish(manip, data)
return count return count
end end

View File

@ -1,239 +1,239 @@
--- Schematic serialization and deserialiation. --- Schematic serialization and deserialiation.
-- @module worldedit.serialization -- @module worldedit.serialization
worldedit.LATEST_SERIALIZATION_VERSION = 5 worldedit.LATEST_SERIALIZATION_VERSION = 5
local LATEST_SERIALIZATION_HEADER = worldedit.LATEST_SERIALIZATION_VERSION .. ":" local LATEST_SERIALIZATION_HEADER = worldedit.LATEST_SERIALIZATION_VERSION .. ":"
--[[ --[[
Serialization version history: Serialization version history:
1: Original format. Serialized Lua table with a weird linked format... 1: Original format. Serialized Lua table with a weird linked format...
2: Position and node seperated into sub-tables in fields `1` and `2`. 2: Position and node seperated into sub-tables in fields `1` and `2`.
3: List of nodes, one per line, with fields seperated by spaces. 3: List of nodes, one per line, with fields seperated by spaces.
Format: <X> <Y> <Z> <Name> <Param1> <Param2> Format: <X> <Y> <Z> <Name> <Param1> <Param2>
4: Serialized Lua table containing a list of nodes with `x`, `y`, `z`, 4: Serialized Lua table containing a list of nodes with `x`, `y`, `z`,
`name`, `param1`, `param2`, and `meta` fields. `name`, `param1`, `param2`, and `meta` fields.
5: Added header and made `param1`, `param2`, and `meta` fields optional. 5: Added header and made `param1`, `param2`, and `meta` fields optional.
Header format: <Version>,<ExtraHeaderField1>,...:<Content> Header format: <Version>,<ExtraHeaderField1>,...:<Content>
--]] --]]
--- Reads the header of serialized data. --- Reads the header of serialized data.
-- @param value Serialized WorldEdit data. -- @param value Serialized WorldEdit data.
-- @return The version as a positive natural number, or 0 for unknown versions. -- @return The version as a positive natural number, or 0 for unknown versions.
-- @return Extra header fields as a list of strings, or nil if not supported. -- @return Extra header fields as a list of strings, or nil if not supported.
-- @return Content (data after header). -- @return Content (data after header).
function worldedit.read_header(value) function worldedit.read_header(value)
if value:find("^[0-9]+[%-:]") then if value:find("^[0-9]+[%-:]") then
local header_end = value:find(":", 1, true) local header_end = value:find(":", 1, true)
local header = value:sub(1, header_end - 1):split(",") local header = value:sub(1, header_end - 1):split(",")
local version = tonumber(header[1]) local version = tonumber(header[1])
table.remove(header, 1) table.remove(header, 1)
local content = value:sub(header_end + 1) local content = value:sub(header_end + 1)
return version, header, content return version, header, content
end end
-- Old versions that didn't include a header with a version number -- Old versions that didn't include a header with a version number
if value:find("([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)") and not value:find("%{") then -- List format if value:find("([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)") and not value:find("%{") then -- List format
return 3, nil, value return 3, nil, value
elseif value:find("^[^\"']+%{%d+%}") then elseif value:find("^[^\"']+%{%d+%}") then
if value:find("%[\"meta\"%]") then -- Meta flat table format if value:find("%[\"meta\"%]") then -- Meta flat table format
return 2, nil, value return 2, nil, value
end end
return 1, nil, value -- Flat table format return 1, nil, value -- Flat table format
elseif value:find("%{") then -- Raw nested table format elseif value:find("%{") then -- Raw nested table format
return 4, nil, value return 4, nil, value
end end
return nil return nil
end end
--- Converts the region defined by positions `pos1` and `pos2` --- Converts the region defined by positions `pos1` and `pos2`
-- into a single string. -- into a single string.
-- @return The serialized data. -- @return The serialized data.
-- @return The number of nodes serialized. -- @return The number of nodes serialized.
function worldedit.serialize(pos1, pos2) function worldedit.serialize(pos1, pos2)
pos1, pos2 = worldedit.sort_pos(pos1, pos2) pos1, pos2 = worldedit.sort_pos(pos1, pos2)
worldedit.keep_loaded(pos1, pos2) worldedit.keep_loaded(pos1, pos2)
local pos = {x=pos1.x, y=0, z=0} local pos = {x=pos1.x, y=0, z=0}
local count = 0 local count = 0
local result = {} local result = {}
local get_node, get_meta = minetest.get_node, minetest.get_meta local get_node, get_meta = minetest.get_node, minetest.get_meta
while pos.x <= pos2.x do while pos.x <= pos2.x do
pos.y = pos1.y pos.y = pos1.y
while pos.y <= pos2.y do while pos.y <= pos2.y do
pos.z = pos1.z pos.z = pos1.z
while pos.z <= pos2.z do while pos.z <= pos2.z do
local node = get_node(pos) local node = get_node(pos)
if node.name ~= "air" and node.name ~= "ignore" then if node.name ~= "air" and node.name ~= "ignore" then
count = count + 1 count = count + 1
local meta = get_meta(pos):to_table() local meta = get_meta(pos):to_table()
local meta_empty = true local meta_empty = true
-- Convert metadata item stacks to item strings -- Convert metadata item stacks to item strings
for name, inventory in pairs(meta.inventory) do for name, inventory in pairs(meta.inventory) do
for index, stack in ipairs(inventory) do for index, stack in ipairs(inventory) do
meta_empty = false meta_empty = false
inventory[index] = stack.to_string and stack:to_string() or stack inventory[index] = stack.to_string and stack:to_string() or stack
end end
end end
for k in pairs(meta) do for k in pairs(meta) do
if k ~= "inventory" then if k ~= "inventory" then
meta_empty = false meta_empty = false
break break
end end
end end
result[count] = { result[count] = {
x = pos.x - pos1.x, x = pos.x - pos1.x,
y = pos.y - pos1.y, y = pos.y - pos1.y,
z = pos.z - pos1.z, z = pos.z - pos1.z,
name = node.name, name = node.name,
param1 = node.param1 ~= 0 and node.param1 or nil, param1 = node.param1 ~= 0 and node.param1 or nil,
param2 = node.param2 ~= 0 and node.param2 or nil, param2 = node.param2 ~= 0 and node.param2 or nil,
meta = not meta_empty and meta or nil, meta = not meta_empty and meta or nil,
} }
end end
pos.z = pos.z + 1 pos.z = pos.z + 1
end end
pos.y = pos.y + 1 pos.y = pos.y + 1
end end
pos.x = pos.x + 1 pos.x = pos.x + 1
end end
-- Serialize entries -- Serialize entries
result = minetest.serialize(result) result = minetest.serialize(result)
return LATEST_SERIALIZATION_HEADER .. result, count return LATEST_SERIALIZATION_HEADER .. result, count
end end
--- Loads the schematic in `value` into a node list in the latest format. --- Loads the schematic in `value` into a node list in the latest format.
-- Contains code based on [table.save/table.load](http://lua-users.org/wiki/SaveTableToFile) -- Contains code based on [table.save/table.load](http://lua-users.org/wiki/SaveTableToFile)
-- by ChillCode, available under the MIT license. -- by ChillCode, available under the MIT license.
-- @return A node list in the latest format, or nil on failure. -- @return A node list in the latest format, or nil on failure.
local function load_schematic(value) local function load_schematic(value)
local version, header, content = worldedit.read_header(value) local version, header, content = worldedit.read_header(value)
local nodes = {} local nodes = {}
if version == 1 or version == 2 then -- Original flat table format if version == 1 or version == 2 then -- Original flat table format
local tables = minetest.deserialize(content) local tables = minetest.deserialize(content)
if not tables then return nil end if not tables then return nil end
-- Transform the node table into an array of nodes -- Transform the node table into an array of nodes
for i = 1, #tables do for i = 1, #tables do
for j, v in pairs(tables[i]) do for j, v in pairs(tables[i]) do
if type(v) == "table" then if type(v) == "table" then
tables[i][j] = tables[v[1]] tables[i][j] = tables[v[1]]
end end
end end
end end
nodes = tables[1] nodes = tables[1]
if version == 1 then --original flat table format if version == 1 then --original flat table format
for i, entry in ipairs(nodes) do for i, entry in ipairs(nodes) do
local pos = entry[1] local pos = entry[1]
entry.x, entry.y, entry.z = pos.x, pos.y, pos.z entry.x, entry.y, entry.z = pos.x, pos.y, pos.z
entry[1] = nil entry[1] = nil
local node = entry[2] local node = entry[2]
entry.name, entry.param1, entry.param2 = node.name, node.param1, node.param2 entry.name, entry.param1, entry.param2 = node.name, node.param1, node.param2
entry[2] = nil entry[2] = nil
end end
end end
elseif version == 3 then -- List format elseif version == 3 then -- List format
for x, y, z, name, param1, param2 in content:gmatch( for x, y, z, name, param1, param2 in content:gmatch(
"([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)%s+" .. "([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)%s+" ..
"([^%s]+)%s+(%d+)%s+(%d+)[^\r\n]*[\r\n]*") do "([^%s]+)%s+(%d+)%s+(%d+)[^\r\n]*[\r\n]*") do
param1, param2 = tonumber(param1), tonumber(param2) param1, param2 = tonumber(param1), tonumber(param2)
table.insert(nodes, { table.insert(nodes, {
x = originx + tonumber(x), x = originx + tonumber(x),
y = originy + tonumber(y), y = originy + tonumber(y),
z = originz + tonumber(z), z = originz + tonumber(z),
name = name, name = name,
param1 = param1 ~= 0 and param1 or nil, param1 = param1 ~= 0 and param1 or nil,
param2 = param2 ~= 0 and param2 or nil, param2 = param2 ~= 0 and param2 or nil,
}) })
end end
elseif version == 4 or version == 5 then -- Nested table format elseif version == 4 or version == 5 then -- Nested table format
if not jit then if not jit then
-- This is broken for larger tables in the current version of LuaJIT -- This is broken for larger tables in the current version of LuaJIT
nodes = minetest.deserialize(content) nodes = minetest.deserialize(content)
else else
-- XXX: This is a filthy hack that works surprisingly well - in LuaJIT, `minetest.deserialize` will fail due to the register limit -- XXX: This is a filthy hack that works surprisingly well - in LuaJIT, `minetest.deserialize` will fail due to the register limit
nodes = {} nodes = {}
content = content:gsub("return%s*{", "", 1):gsub("}%s*$", "", 1) -- remove the starting and ending values to leave only the node data content = content:gsub("return%s*{", "", 1):gsub("}%s*$", "", 1) -- remove the starting and ending values to leave only the node data
local escaped = content:gsub("\\\\", "@@"):gsub("\\\"", "@@"):gsub("(\"[^\"]*\")", function(s) return string.rep("@", #s) end) local escaped = content:gsub("\\\\", "@@"):gsub("\\\"", "@@"):gsub("(\"[^\"]*\")", function(s) return string.rep("@", #s) end)
local startpos, startpos1, endpos = 1, 1 local startpos, startpos1, endpos = 1, 1
while true do -- go through each individual node entry (except the last) while true do -- go through each individual node entry (except the last)
startpos, endpos = escaped:find("},%s*{", startpos) startpos, endpos = escaped:find("},%s*{", startpos)
if not startpos then if not startpos then
break break
end end
local current = content:sub(startpos1, startpos) local current = content:sub(startpos1, startpos)
local entry = minetest.deserialize("return " .. current) local entry = minetest.deserialize("return " .. current)
table.insert(nodes, entry) table.insert(nodes, entry)
startpos, startpos1 = endpos, endpos startpos, startpos1 = endpos, endpos
end end
local entry = minetest.deserialize("return " .. content:sub(startpos1)) -- process the last entry local entry = minetest.deserialize("return " .. content:sub(startpos1)) -- process the last entry
table.insert(nodes, entry) table.insert(nodes, entry)
end end
else else
return nil return nil
end end
return nodes return nodes
end end
--- Determines the volume the nodes represented by string `value` would occupy --- Determines the volume the nodes represented by string `value` would occupy
-- if deserialized at `origin_pos`. -- if deserialized at `origin_pos`.
-- @return Low corner position. -- @return Low corner position.
-- @return High corner position. -- @return High corner position.
-- @return The number of nodes. -- @return The number of nodes.
function worldedit.allocate(origin_pos, value) function worldedit.allocate(origin_pos, value)
local nodes = load_schematic(value) local nodes = load_schematic(value)
if not nodes then return nil end if not nodes then return nil end
return worldedit.allocate_with_nodes(origin_pos, nodes) return worldedit.allocate_with_nodes(origin_pos, nodes)
end end
-- Internal -- Internal
function worldedit.allocate_with_nodes(origin_pos, nodes) function worldedit.allocate_with_nodes(origin_pos, nodes)
local huge = math.huge local huge = math.huge
local pos1x, pos1y, pos1z = huge, huge, huge local pos1x, pos1y, pos1z = huge, huge, huge
local pos2x, pos2y, pos2z = -huge, -huge, -huge local pos2x, pos2y, pos2z = -huge, -huge, -huge
local origin_x, origin_y, origin_z = origin_pos.x, origin_pos.y, origin_pos.z local origin_x, origin_y, origin_z = origin_pos.x, origin_pos.y, origin_pos.z
for i, entry in ipairs(nodes) do for i, entry in ipairs(nodes) do
local x, y, z = origin_x + entry.x, origin_y + entry.y, origin_z + entry.z local x, y, z = origin_x + entry.x, origin_y + entry.y, origin_z + entry.z
if x < pos1x then pos1x = x end if x < pos1x then pos1x = x end
if y < pos1y then pos1y = y end if y < pos1y then pos1y = y end
if z < pos1z then pos1z = z end if z < pos1z then pos1z = z end
if x > pos2x then pos2x = x end if x > pos2x then pos2x = x end
if y > pos2y then pos2y = y end if y > pos2y then pos2y = y end
if z > pos2z then pos2z = z end if z > pos2z then pos2z = z end
end end
local pos1 = {x=pos1x, y=pos1y, z=pos1z} local pos1 = {x=pos1x, y=pos1y, z=pos1z}
local pos2 = {x=pos2x, y=pos2y, z=pos2z} local pos2 = {x=pos2x, y=pos2y, z=pos2z}
return pos1, pos2, #nodes return pos1, pos2, #nodes
end end
--- Loads the nodes represented by string `value` at position `origin_pos`. --- Loads the nodes represented by string `value` at position `origin_pos`.
-- @return The number of nodes deserialized. -- @return The number of nodes deserialized.
function worldedit.deserialize(origin_pos, value) function worldedit.deserialize(origin_pos, value)
local nodes = load_schematic(value) local nodes = load_schematic(value)
if not nodes then return nil end if not nodes then return nil end
local pos1, pos2 = worldedit.allocate_with_nodes(origin_pos, nodes) local pos1, pos2 = worldedit.allocate_with_nodes(origin_pos, nodes)
worldedit.keep_loaded(pos1, pos2) worldedit.keep_loaded(pos1, pos2)
local origin_x, origin_y, origin_z = origin_pos.x, origin_pos.y, origin_pos.z local origin_x, origin_y, origin_z = origin_pos.x, origin_pos.y, origin_pos.z
local count = 0 local count = 0
local add_node, get_meta = minetest.add_node, minetest.get_meta local add_node, get_meta = minetest.add_node, minetest.get_meta
for i, entry in ipairs(nodes) do for i, entry in ipairs(nodes) do
entry.x, entry.y, entry.z = origin_x + entry.x, origin_y + entry.y, origin_z + entry.z entry.x, entry.y, entry.z = origin_x + entry.x, origin_y + entry.y, origin_z + entry.z
-- Entry acts as both position and node -- Entry acts as both position and node
add_node(entry, entry) add_node(entry, entry)
if entry.meta then if entry.meta then
get_meta(entry):from_table(entry.meta) get_meta(entry):from_table(entry.meta)
end end
end end
return #nodes return #nodes
end end

View File

@ -1,131 +1,131 @@
--- Functions for visibly hiding nodes --- Functions for visibly hiding nodes
-- @module worldedit.visualization -- @module worldedit.visualization
minetest.register_node("worldedit:placeholder", { minetest.register_node("worldedit:placeholder", {
drawtype = "airlike", drawtype = "airlike",
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
diggable = false, diggable = false,
walkable = false, walkable = false,
groups = {not_in_creative_inventory=1}, groups = {not_in_creative_inventory=1},
}) })
--- Hides all nodes in a region defined by positions `pos1` and `pos2` by --- Hides all nodes in a region defined by positions `pos1` and `pos2` by
-- non-destructively replacing them with invisible nodes. -- non-destructively replacing them with invisible nodes.
-- @return The number of nodes hidden. -- @return The number of nodes hidden.
function worldedit.hide(pos1, pos2) function worldedit.hide(pos1, pos2)
pos1, pos2 = worldedit.sort_pos(pos1, pos2) pos1, pos2 = worldedit.sort_pos(pos1, pos2)
worldedit.keep_loaded(pos1, pos2) worldedit.keep_loaded(pos1, pos2)
local pos = {x=pos1.x, y=0, z=0} local pos = {x=pos1.x, y=0, z=0}
local get_node, get_meta, swap_node = minetest.get_node, local get_node, get_meta, swap_node = minetest.get_node,
minetest.get_meta, minetest.swap_node minetest.get_meta, minetest.swap_node
while pos.x <= pos2.x do while pos.x <= pos2.x do
pos.y = pos1.y pos.y = pos1.y
while pos.y <= pos2.y do while pos.y <= pos2.y do
pos.z = pos1.z pos.z = pos1.z
while pos.z <= pos2.z do while pos.z <= pos2.z do
local node = get_node(pos) local node = get_node(pos)
if node.name ~= "air" and node.name ~= "worldedit:placeholder" then if node.name ~= "air" and node.name ~= "worldedit:placeholder" then
-- Save the node's original name -- Save the node's original name
get_meta(pos):set_string("worldedit_placeholder", node.name) get_meta(pos):set_string("worldedit_placeholder", node.name)
-- Swap in placeholder node -- Swap in placeholder node
node.name = "worldedit:placeholder" node.name = "worldedit:placeholder"
swap_node(pos, node) swap_node(pos, node)
end end
pos.z = pos.z + 1 pos.z = pos.z + 1
end end
pos.y = pos.y + 1 pos.y = pos.y + 1
end end
pos.x = pos.x + 1 pos.x = pos.x + 1
end end
return worldedit.volume(pos1, pos2) return worldedit.volume(pos1, pos2)
end end
--- Suppresses all instances of `node_name` in a region defined by positions --- Suppresses all instances of `node_name` in a region defined by positions
-- `pos1` and `pos2` by non-destructively replacing them with invisible nodes. -- `pos1` and `pos2` by non-destructively replacing them with invisible nodes.
-- @return The number of nodes suppressed. -- @return The number of nodes suppressed.
function worldedit.suppress(pos1, pos2, node_name) function worldedit.suppress(pos1, pos2, node_name)
-- Ignore placeholder supression -- Ignore placeholder supression
if node_name == "worldedit:placeholder" then if node_name == "worldedit:placeholder" then
return 0 return 0
end end
pos1, pos2 = worldedit.sort_pos(pos1, pos2) pos1, pos2 = worldedit.sort_pos(pos1, pos2)
worldedit.keep_loaded(pos1, pos2) worldedit.keep_loaded(pos1, pos2)
local nodes = minetest.find_nodes_in_area(pos1, pos2, node_name) local nodes = minetest.find_nodes_in_area(pos1, pos2, node_name)
local get_node, get_meta, swap_node = minetest.get_node, local get_node, get_meta, swap_node = minetest.get_node,
minetest.get_meta, minetest.swap_node minetest.get_meta, minetest.swap_node
for _, pos in ipairs(nodes) do for _, pos in ipairs(nodes) do
local node = get_node(pos) local node = get_node(pos)
-- Save the node's original name -- Save the node's original name
get_meta(pos):set_string("worldedit_placeholder", node.name) get_meta(pos):set_string("worldedit_placeholder", node.name)
-- Swap in placeholder node -- Swap in placeholder node
node.name = "worldedit:placeholder" node.name = "worldedit:placeholder"
swap_node(pos, node) swap_node(pos, node)
end end
return #nodes return #nodes
end end
--- Highlights all instances of `node_name` in a region defined by positions --- Highlights all instances of `node_name` in a region defined by positions
-- `pos1` and `pos2` by non-destructively hiding all other nodes. -- `pos1` and `pos2` by non-destructively hiding all other nodes.
-- @return The number of nodes found. -- @return The number of nodes found.
function worldedit.highlight(pos1, pos2, node_name) function worldedit.highlight(pos1, pos2, node_name)
pos1, pos2 = worldedit.sort_pos(pos1, pos2) pos1, pos2 = worldedit.sort_pos(pos1, pos2)
worldedit.keep_loaded(pos1, pos2) worldedit.keep_loaded(pos1, pos2)
local pos = {x=pos1.x, y=0, z=0} local pos = {x=pos1.x, y=0, z=0}
local get_node, get_meta, swap_node = minetest.get_node, local get_node, get_meta, swap_node = minetest.get_node,
minetest.get_meta, minetest.swap_node minetest.get_meta, minetest.swap_node
local count = 0 local count = 0
while pos.x <= pos2.x do while pos.x <= pos2.x do
pos.y = pos1.y pos.y = pos1.y
while pos.y <= pos2.y do while pos.y <= pos2.y do
pos.z = pos1.z pos.z = pos1.z
while pos.z <= pos2.z do while pos.z <= pos2.z do
local node = get_node(pos) local node = get_node(pos)
if node.name == node_name then -- Node found if node.name == node_name then -- Node found
count = count + 1 count = count + 1
elseif node.name ~= "worldedit:placeholder" then -- Hide other nodes elseif node.name ~= "worldedit:placeholder" then -- Hide other nodes
-- Save the node's original name -- Save the node's original name
get_meta(pos):set_string("worldedit_placeholder", node.name) get_meta(pos):set_string("worldedit_placeholder", node.name)
-- Swap in placeholder node -- Swap in placeholder node
node.name = "worldedit:placeholder" node.name = "worldedit:placeholder"
swap_node(pos, node) swap_node(pos, node)
end end
pos.z = pos.z + 1 pos.z = pos.z + 1
end end
pos.y = pos.y + 1 pos.y = pos.y + 1
end end
pos.x = pos.x + 1 pos.x = pos.x + 1
end end
return count return count
end end
-- Restores all nodes hidden with WorldEdit functions in a region defined -- Restores all nodes hidden with WorldEdit functions in a region defined
-- by positions `pos1` and `pos2`. -- by positions `pos1` and `pos2`.
-- @return The number of nodes restored. -- @return The number of nodes restored.
function worldedit.restore(pos1, pos2) function worldedit.restore(pos1, pos2)
local pos1, pos2 = worldedit.sort_pos(pos1, pos2) local pos1, pos2 = worldedit.sort_pos(pos1, pos2)
worldedit.keep_loaded(pos1, pos2) worldedit.keep_loaded(pos1, pos2)
local nodes = minetest.find_nodes_in_area(pos1, pos2, "worldedit:placeholder") local nodes = minetest.find_nodes_in_area(pos1, pos2, "worldedit:placeholder")
local get_node, get_meta, swap_node = minetest.get_node, local get_node, get_meta, swap_node = minetest.get_node,
minetest.get_meta, minetest.swap_node minetest.get_meta, minetest.swap_node
for _, pos in ipairs(nodes) do for _, pos in ipairs(nodes) do
local node = get_node(pos) local node = get_node(pos)
local meta = get_meta(pos) local meta = get_meta(pos)
local data = meta:to_table() local data = meta:to_table()
node.name = data.fields.worldedit_placeholder node.name = data.fields.worldedit_placeholder
data.fields.worldedit_placeholder = nil data.fields.worldedit_placeholder = nil
meta:from_table(data) meta:from_table(data)
swap_node(pos, node) swap_node(pos, node)
end end
return #nodes return #nodes
end end

File diff suppressed because it is too large Load Diff

View File

@ -1,162 +1,162 @@
worldedit.marker1 = {} worldedit.marker1 = {}
worldedit.marker2 = {} worldedit.marker2 = {}
worldedit.marker_region = {} worldedit.marker_region = {}
--marks worldedit region position 1 --marks worldedit region position 1
worldedit.mark_pos1 = function(name) worldedit.mark_pos1 = function(name)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 ~= nil then if pos1 ~= nil then
--make area stay loaded --make area stay loaded
local manip = minetest.get_voxel_manip() local manip = minetest.get_voxel_manip()
manip:read_from_map(pos1, pos1) manip:read_from_map(pos1, pos1)
end end
if worldedit.marker1[name] ~= nil then --marker already exists if worldedit.marker1[name] ~= nil then --marker already exists
worldedit.marker1[name]:remove() --remove marker worldedit.marker1[name]:remove() --remove marker
worldedit.marker1[name] = nil worldedit.marker1[name] = nil
end end
if pos1 ~= nil then if pos1 ~= nil then
--add marker --add marker
worldedit.marker1[name] = minetest.add_entity(pos1, "worldedit:pos1") worldedit.marker1[name] = minetest.add_entity(pos1, "worldedit:pos1")
if worldedit.marker1[name] ~= nil then if worldedit.marker1[name] ~= nil then
worldedit.marker1[name]:get_luaentity().player_name = name worldedit.marker1[name]:get_luaentity().player_name = name
end end
end end
worldedit.mark_region(name) worldedit.mark_region(name)
end end
--marks worldedit region position 2 --marks worldedit region position 2
worldedit.mark_pos2 = function(name) worldedit.mark_pos2 = function(name)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos2 ~= nil then if pos2 ~= nil then
--make area stay loaded --make area stay loaded
local manip = minetest.get_voxel_manip() local manip = minetest.get_voxel_manip()
manip:read_from_map(pos2, pos2) manip:read_from_map(pos2, pos2)
end end
if worldedit.marker2[name] ~= nil then --marker already exists if worldedit.marker2[name] ~= nil then --marker already exists
worldedit.marker2[name]:remove() --remove marker worldedit.marker2[name]:remove() --remove marker
worldedit.marker2[name] = nil worldedit.marker2[name] = nil
end end
if pos2 ~= nil then if pos2 ~= nil then
--add marker --add marker
worldedit.marker2[name] = minetest.add_entity(pos2, "worldedit:pos2") worldedit.marker2[name] = minetest.add_entity(pos2, "worldedit:pos2")
if worldedit.marker2[name] ~= nil then if worldedit.marker2[name] ~= nil then
worldedit.marker2[name]:get_luaentity().player_name = name worldedit.marker2[name]:get_luaentity().player_name = name
end end
end end
worldedit.mark_region(name) worldedit.mark_region(name)
end end
worldedit.mark_region = function(name) worldedit.mark_region = function(name)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if worldedit.marker_region[name] ~= nil then --marker already exists if worldedit.marker_region[name] ~= nil then --marker already exists
--wip: make the area stay loaded somehow --wip: make the area stay loaded somehow
for _, entity in ipairs(worldedit.marker_region[name]) do for _, entity in ipairs(worldedit.marker_region[name]) do
entity:remove() entity:remove()
end end
worldedit.marker_region[name] = nil worldedit.marker_region[name] = nil
end end
if pos1 ~= nil and pos2 ~= nil then if pos1 ~= nil and pos2 ~= nil then
local pos1, pos2 = worldedit.sort_pos(pos1, pos2) local pos1, pos2 = worldedit.sort_pos(pos1, pos2)
local thickness = 0.2 local thickness = 0.2
local sizex, sizey, sizez = (1 + pos2.x - pos1.x) / 2, (1 + pos2.y - pos1.y) / 2, (1 + pos2.z - pos1.z) / 2 local sizex, sizey, sizez = (1 + pos2.x - pos1.x) / 2, (1 + pos2.y - pos1.y) / 2, (1 + pos2.z - pos1.z) / 2
--make area stay loaded --make area stay loaded
local manip = minetest.get_voxel_manip() local manip = minetest.get_voxel_manip()
manip:read_from_map(pos1, pos2) manip:read_from_map(pos1, pos2)
local markers = {} local markers = {}
--XY plane markers --XY plane markers
for _, z in ipairs({pos1.z - 0.5, pos2.z + 0.5}) do for _, z in ipairs({pos1.z - 0.5, pos2.z + 0.5}) do
local marker = minetest.add_entity({x=pos1.x + sizex - 0.5, y=pos1.y + sizey - 0.5, z=z}, "worldedit:region_cube") local marker = minetest.add_entity({x=pos1.x + sizex - 0.5, y=pos1.y + sizey - 0.5, z=z}, "worldedit:region_cube")
marker:set_properties({ marker:set_properties({
visual_size={x=sizex * 2, y=sizey * 2}, visual_size={x=sizex * 2, y=sizey * 2},
collisionbox = {-sizex, -sizey, -thickness, sizex, sizey, thickness}, collisionbox = {-sizex, -sizey, -thickness, sizex, sizey, thickness},
}) })
marker:get_luaentity().player_name = name marker:get_luaentity().player_name = name
table.insert(markers, marker) table.insert(markers, marker)
end end
--YZ plane markers --YZ plane markers
for _, x in ipairs({pos1.x - 0.5, pos2.x + 0.5}) do for _, x in ipairs({pos1.x - 0.5, pos2.x + 0.5}) do
local marker = minetest.add_entity({x=x, y=pos1.y + sizey - 0.5, z=pos1.z + sizez - 0.5}, "worldedit:region_cube") local marker = minetest.add_entity({x=x, y=pos1.y + sizey - 0.5, z=pos1.z + sizez - 0.5}, "worldedit:region_cube")
marker:set_properties({ marker:set_properties({
visual_size={x=sizez * 2, y=sizey * 2}, visual_size={x=sizez * 2, y=sizey * 2},
collisionbox = {-thickness, -sizey, -sizez, thickness, sizey, sizez}, collisionbox = {-thickness, -sizey, -sizez, thickness, sizey, sizez},
}) })
marker:setyaw(math.pi / 2) marker:setyaw(math.pi / 2)
marker:get_luaentity().player_name = name marker:get_luaentity().player_name = name
table.insert(markers, marker) table.insert(markers, marker)
end end
worldedit.marker_region[name] = markers worldedit.marker_region[name] = markers
end end
end end
minetest.register_entity(":worldedit:pos1", { minetest.register_entity(":worldedit:pos1", {
initial_properties = { initial_properties = {
visual = "cube", visual = "cube",
visual_size = {x=1.1, y=1.1}, visual_size = {x=1.1, y=1.1},
textures = {"worldedit_pos1.png", "worldedit_pos1.png", textures = {"worldedit_pos1.png", "worldedit_pos1.png",
"worldedit_pos1.png", "worldedit_pos1.png", "worldedit_pos1.png", "worldedit_pos1.png",
"worldedit_pos1.png", "worldedit_pos1.png"}, "worldedit_pos1.png", "worldedit_pos1.png"},
collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55}, collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55},
physical = false, physical = false,
}, },
on_step = function(self, dtime) on_step = function(self, dtime)
if worldedit.marker1[self.player_name] == nil then if worldedit.marker1[self.player_name] == nil then
self.object:remove() self.object:remove()
end end
end, end,
on_punch = function(self, hitter) on_punch = function(self, hitter)
self.object:remove() self.object:remove()
worldedit.marker1[self.player_name] = nil worldedit.marker1[self.player_name] = nil
end, end,
}) })
minetest.register_entity(":worldedit:pos2", { minetest.register_entity(":worldedit:pos2", {
initial_properties = { initial_properties = {
visual = "cube", visual = "cube",
visual_size = {x=1.1, y=1.1}, visual_size = {x=1.1, y=1.1},
textures = {"worldedit_pos2.png", "worldedit_pos2.png", textures = {"worldedit_pos2.png", "worldedit_pos2.png",
"worldedit_pos2.png", "worldedit_pos2.png", "worldedit_pos2.png", "worldedit_pos2.png",
"worldedit_pos2.png", "worldedit_pos2.png"}, "worldedit_pos2.png", "worldedit_pos2.png"},
collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55}, collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55},
physical = false, physical = false,
}, },
on_step = function(self, dtime) on_step = function(self, dtime)
if worldedit.marker2[self.player_name] == nil then if worldedit.marker2[self.player_name] == nil then
self.object:remove() self.object:remove()
end end
end, end,
on_punch = function(self, hitter) on_punch = function(self, hitter)
self.object:remove() self.object:remove()
worldedit.marker2[self.player_name] = nil worldedit.marker2[self.player_name] = nil
end, end,
}) })
minetest.register_entity(":worldedit:region_cube", { minetest.register_entity(":worldedit:region_cube", {
initial_properties = { initial_properties = {
visual = "upright_sprite", visual = "upright_sprite",
visual_size = {x=1.1, y=1.1}, visual_size = {x=1.1, y=1.1},
textures = {"worldedit_cube.png"}, textures = {"worldedit_cube.png"},
visual_size = {x=10, y=10}, visual_size = {x=10, y=10},
physical = false, physical = false,
}, },
on_step = function(self, dtime) on_step = function(self, dtime)
if worldedit.marker_region[self.player_name] == nil then if worldedit.marker_region[self.player_name] == nil then
self.object:remove() self.object:remove()
return return
end end
end, end,
on_punch = function(self, hitter) on_punch = function(self, hitter)
for _, entity in ipairs(worldedit.marker_region[self.player_name]) do for _, entity in ipairs(worldedit.marker_region[self.player_name]) do
entity:remove() entity:remove()
end end
worldedit.marker_region[self.player_name] = nil worldedit.marker_region[self.player_name] = nil
end, end,
}) })

View File

@ -1,68 +1,68 @@
local safe_region_callback = {} local safe_region_callback = {}
local safe_region_param = {} local safe_region_param = {}
local function check_region(name, param) local function check_region(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] --obtain positions local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] --obtain positions
if pos1 == nil or pos2 == nil then if pos1 == nil or pos2 == nil then
worldedit.player_notify(name, "no region selected") worldedit.player_notify(name, "no region selected")
return nil return nil
end end
return worldedit.volume(pos1, pos2) return worldedit.volume(pos1, pos2)
end end
--`callback` is a callback to run when the user confirms --`callback` is a callback to run when the user confirms
--`nodes_needed` is a function accepting `param`, `pos1`, and `pos2` to calculate the number of nodes needed --`nodes_needed` is a function accepting `param`, `pos1`, and `pos2` to calculate the number of nodes needed
local function safe_region(callback, nodes_needed) local function safe_region(callback, nodes_needed)
--default node volume calculation --default node volume calculation
nodes_needed = nodes_needed or check_region nodes_needed = nodes_needed or check_region
return function(name, param) return function(name, param)
--check if the operation applies to a safe number of nodes --check if the operation applies to a safe number of nodes
local count = nodes_needed(name, param) local count = nodes_needed(name, param)
if count == nil then return end --invalid command if count == nil then return end --invalid command
if count < 10000 then if count < 10000 then
return callback(name, param) return callback(name, param)
end end
--save callback to call later --save callback to call later
safe_region_callback[name], safe_region_param[name] = callback, param safe_region_callback[name], safe_region_param[name] = callback, param
worldedit.player_notify(name, "WARNING: this operation could affect up to " .. count .. " nodes; type //y to continue or //n to cancel") worldedit.player_notify(name, "WARNING: this operation could affect up to " .. count .. " nodes; type //y to continue or //n to cancel")
end end
end end
minetest.register_chatcommand("/y", { minetest.register_chatcommand("/y", {
params = "", params = "",
description = "Confirm a pending operation", description = "Confirm a pending operation",
func = function(name) func = function(name)
local callback, param = safe_region_callback[name], safe_region_param[name] local callback, param = safe_region_callback[name], safe_region_param[name]
if not callback then if not callback then
worldedit.player_notify(name, "no operation pending") worldedit.player_notify(name, "no operation pending")
return return
end end
--obtain positions --obtain positions
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
if pos1 == nil or pos2 == nil then if pos1 == nil or pos2 == nil then
worldedit.player_notify(name, "no region selected") worldedit.player_notify(name, "no region selected")
return return
end end
safe_region_callback[name], safe_region_param[name] = nil, nil --reset pending operation safe_region_callback[name], safe_region_param[name] = nil, nil --reset pending operation
callback(name, param, pos1, pos2) callback(name, param, pos1, pos2)
end, end,
}) })
minetest.register_chatcommand("/n", { minetest.register_chatcommand("/n", {
params = "", params = "",
description = "Confirm a pending operation", description = "Confirm a pending operation",
func = function(name) func = function(name)
if not safe_region_callback[name] then if not safe_region_callback[name] then
worldedit.player_notify(name, "no operation pending") worldedit.player_notify(name, "no operation pending")
return return
end end
safe_region_callback[name], safe_region_param[name] = nil, nil safe_region_callback[name], safe_region_param[name] = nil, nil
end, end,
}) })
return safe_region, check_region return safe_region, check_region

View File

Before

Width:  |  Height:  |  Size: 105 B

After

Width:  |  Height:  |  Size: 105 B

View File

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 123 B

View File

Before

Width:  |  Height:  |  Size: 134 B

After

Width:  |  Height:  |  Size: 134 B

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -1,103 +1,103 @@
worldedit = rawget(_G, "worldedit") or {} worldedit = rawget(_G, "worldedit") or {}
local minetest = minetest --local copy of global local minetest = minetest --local copy of global
local get_pointed = function(pos, nearest, distance) local get_pointed = function(pos, nearest, distance)
if distance > 100 then if distance > 100 then
return false return false
end end
--check for collision with node --check for collision with node
local nodename = minetest.get_node(pos).name local nodename = minetest.get_node(pos).name
if nodename ~= "air" if nodename ~= "air"
and nodename ~= "default:water_source" and nodename ~= "default:water_source"
and nodename ~= "default:water_flowing" then and nodename ~= "default:water_flowing" then
if nodename ~= "ignore" then if nodename ~= "ignore" then
return nearest return nearest
end end
return false return false
end end
end end
local use = function(itemstack, user, pointed_thing) local use = function(itemstack, user, pointed_thing)
if pointed_thing.type == "nothing" then --pointing at nothing if pointed_thing.type == "nothing" then --pointing at nothing
local placepos = worldedit.raytrace(user:getpos(), user:get_look_dir(), get_pointed) local placepos = worldedit.raytrace(user:getpos(), user:get_look_dir(), get_pointed)
if placepos then --extended reach if placepos then --extended reach
pointed_thing.type = "node" pointed_thing.type = "node"
pointed_thing.under = nil --wip pointed_thing.under = nil --wip
pointed_thing.above = nil --wip pointed_thing.above = nil --wip
end end
end end
return minetest.item_place_node(itemstack, user, pointed_thing) return minetest.item_place_node(itemstack, user, pointed_thing)
end end
-- --
worldedit.raytrace = function(pos, dir, callback) worldedit.raytrace = function(pos, dir, callback)
local base = {x=math.floor(pos.x), y=math.floor(pos.y), z=math.floor(pos.z)} local base = {x=math.floor(pos.x), y=math.floor(pos.y), z=math.floor(pos.z)}
local stepx, stepy, stepz = 0, 0, 0 local stepx, stepy, stepz = 0, 0, 0
local componentx, componenty, componentz = 0, 0, 0 local componentx, componenty, componentz = 0, 0, 0
local intersectx, intersecty, intersectz = 0, 0, 0 local intersectx, intersecty, intersectz = 0, 0, 0
if dir.x == 0 then if dir.x == 0 then
intersectx = math.huge intersectx = math.huge
elseif dir.x > 0 then elseif dir.x > 0 then
stepx = 1 stepx = 1
componentx = 1 / dir.x componentx = 1 / dir.x
intersectx = ((base.x - pos.x) + 1) * componentx intersectx = ((base.x - pos.x) + 1) * componentx
else else
stepx = -1 stepx = -1
componentx = 1 / -dir.x componentx = 1 / -dir.x
intersectx = (pos.x - base.x) * componentx intersectx = (pos.x - base.x) * componentx
end end
if dir.y == 0 then if dir.y == 0 then
intersecty = math.huge intersecty = math.huge
elseif dir.y > 0 then elseif dir.y > 0 then
stepy = 1 stepy = 1
componenty = 1 / dir.y componenty = 1 / dir.y
intersecty = ((base.y - pos.y) + 1) * componenty intersecty = ((base.y - pos.y) + 1) * componenty
else else
stepy = -1 stepy = -1
componenty = 1 / -dir.y componenty = 1 / -dir.y
intersecty = (pos.y - base.y) * componenty intersecty = (pos.y - base.y) * componenty
end end
if dir.z == 0 then if dir.z == 0 then
intersectz = math.huge intersectz = math.huge
elseif dir.z > 0 then elseif dir.z > 0 then
stepz = 1 stepz = 1
componentz = 1 / dir.z componentz = 1 / dir.z
intersectz = ((base.z - pos.z) + 1) * componentz intersectz = ((base.z - pos.z) + 1) * componentz
else else
stepz = -1 stepz = -1
componentz = 1 / -dir.z componentz = 1 / -dir.z
intersectz = (pos.z - base.z) * componentz intersectz = (pos.z - base.z) * componentz
end end
local distance = 0 local distance = 0
local nearest = {x=base.x, y=base.y, z=base.z} local nearest = {x=base.x, y=base.y, z=base.z}
while true do while true do
local values = {callback(base, nearest, distance)} local values = {callback(base, nearest, distance)}
if #values > 0 then if #values > 0 then
return unpack(values) return unpack(values)
end end
nearest.x, nearest.y, nearest.z = base.x, base.y, base.z nearest.x, nearest.y, nearest.z = base.x, base.y, base.z
if intersectx < intersecty then if intersectx < intersecty then
if intersectx < intersectz then if intersectx < intersectz then
base.x = base.x + stepx base.x = base.x + stepx
distance = intersectx distance = intersectx
intersectx = intersectx + componentx intersectx = intersectx + componentx
else else
base.z = base.z + stepz base.z = base.z + stepz
distance = intersectz distance = intersectz
intersectz = intersectz + componentz intersectz = intersectz + componentz
end end
elseif intersecty < intersectz then elseif intersecty < intersectz then
base.y = base.y + stepy base.y = base.y + stepy
distance = intersecty distance = intersecty
intersecty = intersecty + componenty intersecty = intersecty + componenty
else else
base.z = base.z + stepz base.z = base.z + stepz
distance = intersectz distance = intersectz
intersectz = intersectz + componentz intersectz = intersectz + componentz
end end
end end
end end

View File

@ -1 +1 @@
worldedit_commands worldedit_commands

View File

@ -1,50 +1,50 @@
--provides shorter names for the commands in `worldedit_commands` --provides shorter names for the commands in `worldedit_commands`
--returns true if command could not be aliased, false otherwise --returns true if command could not be aliased, false otherwise
worldedit.alias_chatcommand = function(alias, original_command) worldedit.alias_chatcommand = function(alias, original_command)
if not minetest.chatcommands[original_command] then if not minetest.chatcommands[original_command] then
minetest.log("error", "worldedit_shortcommands: original command " .. original_command .. " does not exist") minetest.log("error", "worldedit_shortcommands: original command " .. original_command .. " does not exist")
return true return true
end end
if minetest.chatcommands[alias] then if minetest.chatcommands[alias] then
minetest.log("error", "worldedit_shortcommands: alias " .. alias .. " already exists") minetest.log("error", "worldedit_shortcommands: alias " .. alias .. " already exists")
return true return true
end end
minetest.register_chatcommand(alias, minetest.chatcommands[original_command]) minetest.register_chatcommand(alias, minetest.chatcommands[original_command])
return false return false
end end
worldedit.alias_chatcommand("/i", "/inspect") worldedit.alias_chatcommand("/i", "/inspect")
worldedit.alias_chatcommand("/rst", "/reset") worldedit.alias_chatcommand("/rst", "/reset")
worldedit.alias_chatcommand("/mk", "/mark") worldedit.alias_chatcommand("/mk", "/mark")
worldedit.alias_chatcommand("/umk", "/unmark") worldedit.alias_chatcommand("/umk", "/unmark")
worldedit.alias_chatcommand("/1", "/pos1") worldedit.alias_chatcommand("/1", "/pos1")
worldedit.alias_chatcommand("/2", "/pos2") worldedit.alias_chatcommand("/2", "/pos2")
worldedit.alias_chatcommand("/fp", "/fixedpos") worldedit.alias_chatcommand("/fp", "/fixedpos")
worldedit.alias_chatcommand("/v", "/volume") worldedit.alias_chatcommand("/v", "/volume")
worldedit.alias_chatcommand("/s", "/set") worldedit.alias_chatcommand("/s", "/set")
worldedit.alias_chatcommand("/r", "/replace") worldedit.alias_chatcommand("/r", "/replace")
worldedit.alias_chatcommand("/ri", "/replaceinverse") worldedit.alias_chatcommand("/ri", "/replaceinverse")
worldedit.alias_chatcommand("/hspr", "/hollowsphere") worldedit.alias_chatcommand("/hspr", "/hollowsphere")
worldedit.alias_chatcommand("/spr", "/sphere") worldedit.alias_chatcommand("/spr", "/sphere")
worldedit.alias_chatcommand("/hdo", "/hollowdome") worldedit.alias_chatcommand("/hdo", "/hollowdome")
worldedit.alias_chatcommand("/do", "/dome") worldedit.alias_chatcommand("/do", "/dome")
worldedit.alias_chatcommand("/hcyl", "/hollowcylinder") worldedit.alias_chatcommand("/hcyl", "/hollowcylinder")
worldedit.alias_chatcommand("/cyl", "/cylinder") worldedit.alias_chatcommand("/cyl", "/cylinder")
worldedit.alias_chatcommand("/pyr", "/pyramid") worldedit.alias_chatcommand("/pyr", "/pyramid")
worldedit.alias_chatcommand("/spl", "/spiral") worldedit.alias_chatcommand("/spl", "/spiral")
worldedit.alias_chatcommand("/m", "/move") worldedit.alias_chatcommand("/m", "/move")
worldedit.alias_chatcommand("/c", "/copy") worldedit.alias_chatcommand("/c", "/copy")
worldedit.alias_chatcommand("/stk", "/stack") worldedit.alias_chatcommand("/stk", "/stack")
worldedit.alias_chatcommand("/sch", "/stretch") worldedit.alias_chatcommand("/sch", "/stretch")
worldedit.alias_chatcommand("/tps", "/transpose") worldedit.alias_chatcommand("/tps", "/transpose")
worldedit.alias_chatcommand("/fl", "/flip") worldedit.alias_chatcommand("/fl", "/flip")
worldedit.alias_chatcommand("/rot", "/rotate") worldedit.alias_chatcommand("/rot", "/rotate")
worldedit.alias_chatcommand("/ort", "/orient") worldedit.alias_chatcommand("/ort", "/orient")
worldedit.alias_chatcommand("/hi", "/hide") worldedit.alias_chatcommand("/hi", "/hide")
worldedit.alias_chatcommand("/sup", "/suppress") worldedit.alias_chatcommand("/sup", "/suppress")
worldedit.alias_chatcommand("/hlt", "/highlight") worldedit.alias_chatcommand("/hlt", "/highlight")
worldedit.alias_chatcommand("/rsr", "/restore") worldedit.alias_chatcommand("/rsr", "/restore")
worldedit.alias_chatcommand("/l", "/lua") worldedit.alias_chatcommand("/l", "/lua")
worldedit.alias_chatcommand("/lt", "/luatransform") worldedit.alias_chatcommand("/lt", "/luatransform")
worldedit.alias_chatcommand("/clro", "/clearobjects") worldedit.alias_chatcommand("/clro", "/clearobjects")

View File

View File

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Some files were not shown because too many files have changed in this diff Show More