Modding Intro
Revision as of 21:54, 31 May 2015 by Rubenwardy (talk | contribs)
This page is under construction. See the Intro or Minetest Modding Tutorial Book
This page has been proposed for deletion for the following reason: "Obsolete" If you don't think that this page should be deleted, please explain why on the talk page. |
Intro
Minetest has a scripting API (Application Programming Interface), which is used to program mods (short for "modifications") for the game, extending its features and adding new items.
This API is accessed using an easy-to-use programming language called Lua.
The only thing you will need is basic programming knowledge. If you don't have any programming experience, you can use http://codecademy.com to learn. It will teach you the basics of programming (it is JavaScript, not Lua, but still helps).
More specifically, the version of Lua is 5.1. Reference manual, book
Example
-- Add the decowood node
minetest.register_node("tutorial:decowood", {
tiles = {"tutorial_decowood.png"},
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
})
-- Add the decostick craftitem
minetest.register_craftitem("tutorial:decostick", {
inventory_image = "tutorial_decostick.png",
groups = {stick=1},
})
-- Add the crafting recipe for decowood
minetest.register_craft({
output = 'tutorial:decowood 2',
recipe = {
{'default:wood', 'default:wood', ''},
{'default:wood', 'default:wood', ''},
{'', '', ''},
}
})
-- Add the furnace recipe for decosticks
minetest.register_craft({
type = "cooking",
recipe = "tutorial:decowood",
output = "tutorial:decostick",
})
Next
Learn how to actually set up an environment to start modding in the next section! Modding_Setup