Minetest-WorldEditAdditions/.docs/Tutorial.md
2021-06-26 13:06:35 +01:00

6.8 KiB

layout title tags date
content-generic.njk Tutorial navigable 2004-01-01

WorldEditAdditions Beginner's Tutorial

Welcome to the WorldEditAdditions beginners tutorial! There are a number of conventions used in the chat command reference that may not be immediately obvious - this guide serves to explain in detail.

It is assumed that:

  • You are already familiar the basics of Minetest (try the tutorial game if you're unsure)
  • You have both WorldEdit and WorldEditAdditions installed (see the Download section)

Minetest supports the execution of Chat Commands to manipulate the Minetest world. While in a Minetest world, simply type /help (the first forward slash / will automatically cause the chat window to appear) and hit enter to display a list of chat commands that are currently registered grouped by mod for example.

WorldEdit commands are, by convention, prefixed with an additional forward slash /. Here are some examples of WorldEdit chat commands:

//1
//2
//set dirt

Explaining core WorldEdit commands is out of scope of this tutorial, but you can find a complete list of them here: https://github.com/Uberi/Minetest-WorldEdit/blob/master/ChatCommands.md.

The purpose of WorldEditAdditions is to extend WorldEdit by adding additional commands. Example commands that have been implemented that are not present in core WorldEdit include (but certainly aren't limited to):

See a full list with complete explanations in the chat command reference.

Regions

WorldEdit allows you to define a region by specifying 2 points in the world - we number these points 1 and 2. By using the WorldEdit wand (or WorldEditAdditions Far Wand), one can left click to set the position of point 1, and right click to set point 2:

{% image "images/tutorial_pos1_2.jpeg" "A screenshot showing WorldEdit points 1 and 2 in a desert with a cactus" %}

Point 1 is on the cactus, and point 2 is on the ground in the bottom left.

Most WorldEdit and WorldEditAdditions commands require either 1 or 2 points to be set in order to work.

  • If 1 point is required, it's the origin point used by the command
  • If 2 points are required, the defined region specifies the area in which the command is operate

Command syntax

When explaining the syntax (ref a, b) of a command, a number of different conventions are used to concisely explain said syntax. Understanding enables you to quickly understand the output of /help /maze for example, or the list of commands in the reference.

  • <thing>: A placeholder for a value that you can change. Do not include the < angle brackets > when replacing it with your actual value.
  • a | b: 1 thing or another, but not both.
  • [optional_thing]: Something that's optional. Specifying it enables greater control over the behaviour of the command, but it can be left out for convenience.
  • <thing|other_thing>: Pick 1 item from the list and replace the entire group, removing the < angle brackets > as with <thing>. For example <snowballs|river> could become either snowballs or river, but not both at the same time.
  • <thing=default_value>: Most commonly seen in [ square brackets ] indicating an optional thing. Indicates the default value of something that you can replace (or omit).
  • ...: Indicates that the previous items can be repeated.

Let's illustrate this with a practical example. Consider the following:

//example <height> <apple|orange> | <height> <width> <pear|maple> [<extra_value>]

The following different invocations of the above would be valid:

//example 10 apple
//example 45 30 maple
//example 30 12 pear something_else

Now let's apply this to a more practical example:

//erode [<snowballs|river> [<key_1> [<value_1>]] [<key_2> [<value_2>]] ...]

The <snowballs|river> explains that either a value of snowballs or river is acceptable. Then, a key - value list of options can be specified - allowing an arbitrary number of options.

From this, we can infer the following usage:

//erode snowballs speed 1 count 50000

Anything else?

  • Make sure we have covered everything

Advanced Concepts

A number of additional concepts that are not required to use WorldEditAdditions are explained here, as they can be helpful for understanding some of the more advanced concepts and commands provided by WorldEditAdditions.

Meta commands

WorldEditAdditions provides a number of meta commands. Such commands don't do anything on their own, but call other commands in various different ways. Examples of meta commands include:

  • //subdivide: split a region into chunks, and execute the command once for each chunk
  • //many: Execute a command multiple times
  • [//multi](/!node_modules, !_sitemulti): Execute multiple commands in sequence

Of course, this isn't an exhaustive list - check the reference for a full list.

Memory usage

Memory (or RAM - Random Access Memory) is used by all the processes running on a system to hold data that they are currently working with. This is especially important for WorldEdit and WorldEditAdditions, since the larger the region you define the more memory that will be required to run commands on it.

Depending on your system, Minetest and your system can slow to a crawl or even crash if you execute a command on a region that's too big.

To work around this, the //subdivide command was implemented. It splits the defined region into chunks, and calls the specified command over and over again for each chunk.

It's not suitable for all commands (since it requires that said command takes 2 points) though, but because it splits the defined region into multiple chunks, it can be executed on enormous regions that can't fit into memory all at the same time.

Conclusion

This short tutorial has explained a few key concepts that are useful for understanding WorldEditAdditions, from executing chat commands to the syntax used in the reference to concisely describe commands.

If there's a concept that you don't understand after reading this and the reference, please open an issue with a detailed explanation of what it is that you're finding difficult to understand.