Difference between revisions of "Modding Intro"

From Minetest Developer Wiki
Jump to navigation Jump to search
(Created page with "{{ModdingIntro}} == Intro == Minetest has a scripting [http://en.wikipedia.org/wiki/Application_programming_interface API] ('''A'''pplication '''P'''rogramming '''I'''nterfa...")
 
Line 44: Line 44:
 
== Next ==
 
== Next ==
 
Learn how to actually set up an environment to start modding in the next section! [[Modding_Setup]]
 
Learn how to actually set up an environment to start modding in the next section! [[Modding_Setup]]
 +
[[Category:Mods]]

Revision as of 21:32, 14 February 2015

Mbox warning.png 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