- Lua 100%
| textures | ||
| addon-crafting.en.md | ||
| addon-crafting.md | ||
| addon-gravity.en.md | ||
| addon-gravity.md | ||
| addon-luminescence.en.md | ||
| addon-lumineszenz.md | ||
| init.en.lua | ||
| init.lua | ||
| mod.conf | ||
| mod_en.conf | ||
| README.en.md | ||
| README.md | ||
Instructions Luanti introductory mod
Welcome to this year's Hack'n'Next, in today's workshop you'll be learning how to install Luanti and how to program your first mod. Luanti is an open source voxel-game which you can modify as you wish, for instance by writing mods or games. Luanti can be played solo or also with friends. You have the option to play together on your local network at home or also on public servers all around the world.
Installing Luanti
In Debian you can install Luanti via the terminal command sudo apt install luanti or from your graphical software manager (e.g. App Center). You can find information regarding the install of Luanti on Windows and macOS on Luanti's download page download page of Luanti.
Once you've installed it, try it out for a bit to familiarize yourself with it. Try installing some mods that interest you. After you've created a world you can enable the mods you've installed for this world and try them out. Look how they're changing the game.
Questioning
What actually happens when you install a mod in Luanti? To find out go to the "About" Tab in your Luanti menu and click "Open User Data Directory". It opens the directory in which Luanti saves worlds and mods for example. Look around for a bit. Can you find your world and the mods you installed?
Your first own mod
Open the directory 'mods', remeber the path and extract the .zip archive there. Now you should see a new directory called 'einstiegsmod' next to the mods you tried before. In it, there is a file named 'mod.conf', and one named 'init.lua'. Currently, those are the German variants and you should delete those two files to avoid confusion. Then, rename 'mod_en.conf' to 'mod.conf' and 'init.en.lua' to 'init.lua'. Edit 'mod.conf' and replace 'einstiegsmod' with a name for your mod, that you can choose as you like. At least under some conditions, you may only use lower-case letters, underscores and numbers. Furthermore, you can adjust the 'title' and 'author', to make it yours.
Now start Luanti again and have a look at the tab 'Content', if your mod is listed as one of the 'Installed packages'. Click on it and see the title you defined before. You successfully installed your first own mod! Before you try it, there is a little thing to adjust.
The file 'init.lua' contains the source code of your mod. 'register_node' tells Luanti to add a new block to the game. For this to work, every occurence of 'einstiegsmod' has to be replaced by the name you chose for your mod. The one with the strict rules. If you like, you may also adjust the 'description', which will be shown in the game and can contain all the characters you want.
Search for a picture that you want to use as a 'texture' of your block, to give it a custom look. Respect the rights and licences (e.g. CC-BY-SA). Possible sources for pictures are pixabay.com or opengameart.org.
Save the image in the directory 'textures' inside your mod and give it a name that you can remember. After that, you have to edit 'init.lua' again, find the line containing 'tiles' and replace 'einstiegsmod_Pinguin.png' with your file name.
Now you can activate the mod for your world and use the search function in the inventory to find your block, if you enabled creative mode for the world. Try to place your block!
Congratulations, you developed your first mod! There are more Hack'n'Nexts to extend your mod, so you are welcome to continue.