Fix mistakes in the first 3 chapters

This commit is contained in:
rubenwardy 2018-10-06 16:56:42 +01:00
parent 6cc040fd0c
commit acf3de9deb
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
3 changed files with 24 additions and 24 deletions

View File

@ -50,7 +50,7 @@ minetest/mods.
![Find the mod's directory]({{ page.root }}/static/folder_modfolder.jpg) ![Find the mod's directory]({{ page.root }}/static/folder_modfolder.jpg)
A "mod name" is used to refer to a mod. Each mod should have a unique name. A *mod name* is used to refer to a mod. Each mod should have a unique name.
Mod names can include letters, numbers, and underscores. A good name should Mod names can include letters, numbers, and underscores. A good name should
describe what the mod does, and the directory which contains the components of a mod describe what the mod does, and the directory which contains the components of a mod
must have the same name as the mod name. must have the same name as the mod name.

View File

@ -46,7 +46,7 @@ function ctf.post(team,msg)
end end
``` ```
For example, keywords in the above snippet are highlighted such as if, then, end, return. For example, keywords in the above snippet are highlighted such as if, then, end, and return.
table.insert is a function which comes with Lua by default. table.insert is a function which comes with Lua by default.
Here is a list of common editors well suited for Lua. Here is a list of common editors well suited for Lua.
@ -65,7 +65,7 @@ One such IDE is Eclipse with the Koneki Lua plugin:
* Install Eclipse + Koneki. * Install Eclipse + Koneki.
* Create a new Lua project from existing source (specify Minetest's base directory). * Create a new Lua project from existing source (specify Minetest's base directory).
* Follow instructions from Koneki wiki how to do "Attach to remote Application" debugging (just a few steps). * Follow instructions from Koneki wiki on how to do "Attach to remote Application" debugging (just a few steps).
* It is suggested to add those lines from wiki at beginning of builtin.lua. * It is suggested to add those lines from wiki at beginning of builtin.lua.
* Start the debugger (set "Break on first line" in debugger configuration to see if it is working). * Start the debugger (set "Break on first line" in debugger configuration to see if it is working).
* Start Minetest. * Start Minetest.
@ -105,7 +105,7 @@ Local will be discussed in a bit, as it's part of a very important concept calle
The `=` means *assignment*, so `result = a + b` means set "result" to a + b. The `=` means *assignment*, so `result = a + b` means set "result" to a + b.
Variable names can be longer than one character unlike in mathematics, as seen with the "result" variable. Variable names can be longer than one character unlike in mathematics, as seen with the "result" variable.
It's also worth noting that Lua is *case-sensitive*; A is a different variable than a. It's also worth noting that Lua is *case-sensitive*; A is a different variable to a.
### Variable Types ### Variable Types
@ -137,7 +137,7 @@ Not an exhaustive list. Doesn't contain every possible operator.
### Selection ### Selection
The most basic selection is the if statement. It looks like this: The most basic selection is the *if statement*. It looks like this:
```lua ```lua
local random_number = math.random(1, 100) -- Between 1 and 100. local random_number = math.random(1, 100) -- Between 1 and 100.
@ -176,8 +176,8 @@ end
Which prints "Yay!" if A is false and B is true. Which prints "Yay!" if A is false and B is true.
Logical and arithmetic operators work exactly the same, they both accept inputs Logical and arithmetic operators work exactly the same;
and return a value which can be stored. they both accept inputs and return a value which can be stored.
```lua ```lua
local A = 5 local A = 5
@ -189,7 +189,7 @@ end
## Programming ## Programming
Programming is the action of talking a problem, such as sorting a list Programming is the action of taking a problem, such as sorting a list
of items, and then turning it into steps that a computer can understand. of items, and then turning it into steps that a computer can understand.
Teaching you the logical process of programming is beyond the scope of this book; Teaching you the logical process of programming is beyond the scope of this book;
@ -199,7 +199,7 @@ however, the following websites are quite useful in developing this:
learning to 'code', it provides an interactive tutorial experience. learning to 'code', it provides an interactive tutorial experience.
* [Scratch](https://scratch.mit.edu) is a good resource when starting from * [Scratch](https://scratch.mit.edu) is a good resource when starting from
absolute basics, learning the problem solving techniques required to program.\\ absolute basics, learning the problem solving techniques required to program.\\
Scratch is **designed to teach children** how to program, it isn't a serious Scratch is **designed to teach children** how to program, and isn't a serious
programming language. programming language.
## Local and Global Scope ## Local and Global Scope

View File

@ -26,15 +26,15 @@ basic requirements for many mods.
## What are Nodes and Items? ## What are Nodes and Items?
Nodes, Craftitems, and Tools are all Items. Nodes, craftitems, and tools are all Items.
An item is something that could be found in an inventory - An item is something that could be found in an inventory -
even though it may not be possible through normal game play. even though it may not be possible through normal game play.
A node is an item which is placable or can be found in the world. A node is an item which can be placed or be found in the world.
Every position in the world must be occupied with one and only one node - Every position in the world must be occupied with one and only one node -
seemingly blank positions are usually air nodes. seemingly blank positions are usually air nodes.
A craftitem isn't placable but is only found in inventories or as a dropped item A craftitem can't be placed and is only found in inventories or as a dropped item
in the world. in the world.
A tool has the ability to wear and typically has non-default digging capabilities. A tool has the ability to wear and typically has non-default digging capabilities.
@ -104,7 +104,7 @@ Textures in Minetest are usually 16 by 16 pixels.
They can be any resolution, but it is recommended that they are in the order of 2, They can be any resolution, but it is recommended that they are in the order of 2,
for example 16, 32, 64, or 128. for example 16, 32, 64, or 128.
This is because other resolutions may not be supported correctly on older devices, This is because other resolutions may not be supported correctly on older devices,
resulting in lowered performance. resulting in decreased performance.
## Registering a basic node ## Registering a basic node
@ -124,7 +124,7 @@ To give a different texture per-side, supply the names of 6 textures in this ord
up (+Y), down (-Y), right (+X), left (-X), back (+Z), front (-Z). up (+Y), down (-Y), right (+X), left (-X), back (+Z), front (-Z).
(+Y, -Y, +X, -X, +Z, -Z) (+Y, -Y, +X, -X, +Z, -Z)
Remember: Just like with most 3D graphics, +Y is upwards in Minetest. Remember: just like with most 3D graphics, +Y is upwards in Minetest.
```lua ```lua
minetest.register_node("mymod:diamond", { minetest.register_node("mymod:diamond", {
@ -188,7 +188,7 @@ minetest.register_craftitem("mymod:mudpie", {
}) })
``` ```
By, understanding how item_eat works by simply returning a function, it's By understanding how item_eat works by simply returning a function, it's
possible to modify it to do more complex behaviour such as play a custom sound. possible to modify it to do more complex behaviour such as play a custom sound.
## Crafting ## Crafting
@ -196,12 +196,12 @@ possible to modify it to do more complex behaviour such as play a custom sound.
There are several types of crafting recipe available, indicated by the `type` There are several types of crafting recipe available, indicated by the `type`
property. property.
* shaped - Ingredients must be in the correct position. * shaped - ingredients must be in the correct position.
* shapeless - It doesn't matter where the ingredients are, * shapeless - it doesn't matter where the ingredients are,
just that there is the right amount. just that there is the right amount.
* cooking - Recipes for the furnace to use. * cooking - recipes for the furnace to use.
* fuel - Defines items which can be burned in furnaces. * fuel - defines items which can be burned in furnaces.
* tool_repair - Defines items which can be tool repaired. * tool_repair - defines items which can be tool repaired.
Craft recipes are not items, so they do not use Item Names to uniquely Craft recipes are not items, so they do not use Item Names to uniquely
identify themselves. identify themselves.
@ -209,7 +209,7 @@ identify themselves.
### Shaped ### Shaped
Shaped recipes are when the ingredients need to be in the right shape or Shaped recipes are when the ingredients need to be in the right shape or
pattern to work. In the below example, the fragments need to be in a pattern to work. In the example below, the fragments need to be in a
chair-like pattern for the craft to work. chair-like pattern for the craft to work.
```lua ```lua
@ -323,11 +323,11 @@ minetest.register_craft({
}) })
``` ```
## Tools, Capabilities, and Dig Types ## Tools, Capabilities and Dig Types
Dig types are groups which are used to define how strong a node is when dug Dig types are groups which are used to define how strong a node is when dug
with different tools. with different tools.
A dig type group having a higher associated value means the node is easier A dig type group with a higher associated value means the node is easier
and quicker to cut. and quicker to cut.
It's possible to combine multiple dig types to allow the more efficient use It's possible to combine multiple dig types to allow the more efficient use
of multiple types of tools. of multiple types of tools.
@ -376,4 +376,4 @@ minetest.register_tool("mymod:tool", {
Groupcaps is the list of supported dig types for digging nodes. Groupcaps is the list of supported dig types for digging nodes.
Damage groups are for controlling how tools damage objects, which will be Damage groups are for controlling how tools damage objects, which will be
discussed later in the objects chapter. discussed later in the Objects, Players, and Entities chapter.