Fix indentation of lua_api.txt

This commit is contained in:
Perttu Ahola 2013-03-24 21:39:15 +02:00
parent 6767ed74f8
commit 423d69bd40

@ -203,18 +203,18 @@ from the available ones of the following files:
Examples of sound parameter tables: Examples of sound parameter tables:
-- Play locationless on all clients -- Play locationless on all clients
{ {
gain = 1.0, -- default gain = 1.0, -- default
} }
-- Play locationless to a player -- Play locationless to a player
{ {
to_player = name, to_player = name,
gain = 1.0, -- default gain = 1.0, -- default
} }
-- Play in a location -- Play in a location
{ {
pos = {x=1,y=2,z=3}, pos = {x=1,y=2,z=3},
gain = 1.0, -- default gain = 1.0, -- default
max_hear_distance = 32, -- default max_hear_distance = 32, -- default
} }
-- Play connected to an object, looped -- Play connected to an object, looped
{ {
@ -266,11 +266,11 @@ local drawtype = get_nodedef_field(nodename, "drawtype")
Example: minetest.get_item_group(name, group) has been implemented as: Example: minetest.get_item_group(name, group) has been implemented as:
function minetest.get_item_group(name, group) function minetest.get_item_group(name, group)
if not minetest.registered_items[name] or not if not minetest.registered_items[name] or not
minetest.registered_items[name].groups[group] then minetest.registered_items[name].groups[group] then
return 0 return 0
end end
return minetest.registered_items[name].groups[group] return minetest.registered_items[name].groups[group]
end end
Nodes Nodes
@ -491,7 +491,7 @@ An example: Make meat soup from any meat, any water and any bowl
} }
An another example: Make red wool from white wool and red dye An another example: Make red wool from white wool and red dye
{ {
type = 'shapeless', type = 'shapeless',
output = 'wool:red', output = 'wool:red',
recipe = {'wool:white', 'group:dye,basecolor_red'}, recipe = {'wool:white', 'group:dye,basecolor_red'},
} }
@ -502,7 +502,7 @@ Special groups
- level: Can be used to give an additional sense of progression in the game. - level: Can be used to give an additional sense of progression in the game.
- A larger level will cause eg. a weapon of a lower level make much less - A larger level will cause eg. a weapon of a lower level make much less
damage, and get weared out much faster, or not be able to get drops damage, and get weared out much faster, or not be able to get drops
from destroyed nodes. from destroyed nodes.
- 0 is something that is directly accessible at the start of gameplay - 0 is something that is directly accessible at the start of gameplay
- There is no upper limit - There is no upper limit
- dig_immediate: (player can always pick up node without tool wear) - dig_immediate: (player can always pick up node without tool wear)
@ -609,11 +609,11 @@ maximum level.
Example definition of the capabilities of a tool Example definition of the capabilities of a tool
------------------------------------------------- -------------------------------------------------
tool_capabilities = { tool_capabilities = {
full_punch_interval=1.5, full_punch_interval=1.5,
max_drop_level=1, max_drop_level=1,
groupcaps={ groupcaps={
crumbly={maxlevel=2, uses=20, times={[1]=1.60, [2]=1.20, [3]=0.80}} crumbly={maxlevel=2, uses=20, times={[1]=1.60, [2]=1.20, [3]=0.80}}
} }
} }
This makes the tool be able to dig nodes that fullfill both of these: This makes the tool be able to dig nodes that fullfill both of these:
@ -773,7 +773,7 @@ field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]
^ default is the default value of the field ^ default is the default value of the field
^ default may contain variable references such as '${text}' which ^ default may contain variable references such as '${text}' which
will fill the value from the metadata value 'text' will fill the value from the metadata value 'text'
^ Note: no extra text or more than a single variable is supported ATM. ^ Note: no extra text or more than a single variable is supported ATM.
field[<name>;<label>;<default>] field[<name>;<label>;<default>]
^ as above but without position/size units ^ as above but without position/size units
@ -1050,7 +1050,7 @@ minetest.unban_player_or_ip(name) -> unban player or IP address
Particles: Particles:
minetest.add_particle(pos, velocity, acceleration, expirationtime, minetest.add_particle(pos, velocity, acceleration, expirationtime,
size, collisiondetection, texture, playername) size, collisiondetection, texture, playername)
^ Spawn particle at pos with velocity and acceleration ^ Spawn particle at pos with velocity and acceleration
^ Disappears after expirationtime seconds ^ Disappears after expirationtime seconds
^ collisiondetection: if true collides with physical objects ^ collisiondetection: if true collides with physical objects
@ -1058,12 +1058,12 @@ minetest.add_particle(pos, velocity, acceleration, expirationtime,
^ Playername is optional, if specified spawns particle only on the player's client ^ Playername is optional, if specified spawns particle only on the player's client
minetest.add_particlespawner(amount, time, minetest.add_particlespawner(amount, time,
minpos, maxpos, minpos, maxpos,
minvel, maxvel, minvel, maxvel,
minacc, maxacc, minacc, maxacc,
minexptime, maxexptime, minexptime, maxexptime,
minsize, maxsize, minsize, maxsize,
collisiondetection, texture, playername) collisiondetection, texture, playername)
^ Add a particlespawner, an object that spawns an amount of particles over time seconds ^ Add a particlespawner, an object that spawns an amount of particles over time seconds
^ The particle's properties are random values in between the boundings: ^ The particle's properties are random values in between the boundings:
^ minpos/maxpos, minvel/maxvel (velocity), minacc/maxacc (acceleration), ^ minpos/maxpos, minvel/maxvel (velocity), minacc/maxacc (acceleration),
@ -1323,10 +1323,10 @@ Player-only: (no-op for other objects)
^ Should usually be called in on_joinplayer ^ Should usually be called in on_joinplayer
- get_inventory_formspec() -> formspec string - get_inventory_formspec() -> formspec string
- get_player_control(): returns table with player pressed keys - get_player_control(): returns table with player pressed keys
{jump=bool,right=bool,left=bool,LMB=bool,RMB=bool,sneak=bool,aux1=bool,down=bool,up=bool} {jump=bool,right=bool,left=bool,LMB=bool,RMB=bool,sneak=bool,aux1=bool,down=bool,up=bool}
- get_player_control_bits(): returns integer with bit packed player pressed keys - get_player_control_bits(): returns integer with bit packed player pressed keys
bit nr/meaning: 0/up ,1/down ,2/left ,3/right ,4/jump ,5/aux1 ,6/sneak ,7/LMB ,8/RMB bit nr/meaning: 0/up ,1/down ,2/left ,3/right ,4/jump ,5/aux1 ,6/sneak ,7/LMB ,8/RMB
InvRef: Reference to an inventory InvRef: Reference to an inventory
methods: methods:
- is_empty(listname): return true if list is empty - is_empty(listname): return true if list is empty
@ -1411,8 +1411,8 @@ Registered entities
^ puncher: ObjectRef (can be nil) ^ puncher: ObjectRef (can be nil)
^ time_from_last_punch: Meant for disallowing spamming of clicks (can be nil) ^ time_from_last_punch: Meant for disallowing spamming of clicks (can be nil)
^ tool_capabilities: capability table of used tool (can be nil) ^ tool_capabilities: capability table of used tool (can be nil)
^ dir: unit vector of direction of punch. Always defined. Points from ^ dir: unit vector of direction of punch. Always defined. Points from
the puncher to the punched. the puncher to the punched.
- on_rightclick(self, clicker) - on_rightclick(self, clicker)
- get_staticdata(self) - get_staticdata(self)
^ Should return a string that will be passed to on_activate when ^ Should return a string that will be passed to on_activate when
@ -1533,10 +1533,10 @@ Node definition (register_node)
drawtype = "normal", -- See "Node drawtypes" drawtype = "normal", -- See "Node drawtypes"
visual_scale = 1.0, visual_scale = 1.0,
tiles = {tile definition 1, def2, def3, def4, def5, def6}, tiles = {tile definition 1, def2, def3, def4, def5, def6},
^ Textures of node; +Y, -Y, +X, -X, +Z, -Z (old field name: tile_images) ^ Textures of node; +Y, -Y, +X, -X, +Z, -Z (old field name: tile_images)
^ List can be shortened to needed length ^ List can be shortened to needed length
special_tiles = {tile definition 1, Tile definition 2}, special_tiles = {tile definition 1, Tile definition 2},
^ Special textures of node; used rarely (old field name: special_materials) ^ Special textures of node; used rarely (old field name: special_materials)
^ List can be shortened to needed length ^ List can be shortened to needed length
alpha = 255, alpha = 255,
post_effect_color = {a=0, r=0, g=0, b=0}, -- If player is inside node post_effect_color = {a=0, r=0, g=0, b=0}, -- If player is inside node
@ -1592,7 +1592,7 @@ Node definition (register_node)
can_dig = function(pos,player) can_dig = function(pos,player)
^ returns true if node can be dug, or false if not ^ returns true if node can be dug, or false if not
^ default: nil ^ default: nil
on_punch = func(pos, node, puncher), on_punch = func(pos, node, puncher),
^ default: minetest.node_punch ^ default: minetest.node_punch
^ By default: does nothing ^ By default: does nothing
@ -1615,32 +1615,32 @@ Node definition (register_node)
^ Called when an UI form (eg. sign text input) returns data ^ Called when an UI form (eg. sign text input) returns data
^ default: nil ^ default: nil
allow_metadata_inventory_move = func(pos, from_list, from_index, allow_metadata_inventory_move = func(pos, from_list, from_index,
to_list, to_index, count, player), to_list, to_index, count, player),
^ Called when a player wants to move items inside the inventory ^ Called when a player wants to move items inside the inventory
^ Return value: number of items allowed to move ^ Return value: number of items allowed to move
allow_metadata_inventory_put = func(pos, listname, index, stack, player),
^ Called when a player wants to put something into the inventory
^ Return value: number of items allowed to put
^ Return value: -1: Allow and don't modify item count in inventory
allow_metadata_inventory_take = func(pos, listname, index, stack, player),
^ Called when a player wants to take something out of the inventory
^ Return value: number of items allowed to take
^ Return value: -1: Allow and don't modify item count in inventory
on_metadata_inventory_move = func(pos, from_list, from_index,
to_list, to_index, count, player),
on_metadata_inventory_put = func(pos, listname, index, stack, player),
on_metadata_inventory_take = func(pos, listname, index, stack, player),
^ Called after the actual action has happened, according to what was allowed.
^ No return value
on_blast = func(pos, intensity), allow_metadata_inventory_put = func(pos, listname, index, stack, player),
^ intensity: 1.0 = mid range of regular TNT ^ Called when a player wants to put something into the inventory
^ If defined, called when an explosion touches the node, instead of ^ Return value: number of items allowed to put
removing the node ^ Return value: -1: Allow and don't modify item count in inventory
allow_metadata_inventory_take = func(pos, listname, index, stack, player),
^ Called when a player wants to take something out of the inventory
^ Return value: number of items allowed to take
^ Return value: -1: Allow and don't modify item count in inventory
on_metadata_inventory_move = func(pos, from_list, from_index,
to_list, to_index, count, player),
on_metadata_inventory_put = func(pos, listname, index, stack, player),
on_metadata_inventory_take = func(pos, listname, index, stack, player),
^ Called after the actual action has happened, according to what was allowed.
^ No return value
on_blast = func(pos, intensity),
^ intensity: 1.0 = mid range of regular TNT
^ If defined, called when an explosion touches the node, instead of
removing the node
} }
Recipe for register_craft: (shaped) Recipe for register_craft: (shaped)
@ -1695,19 +1695,19 @@ Ore definition (register_ore)
ore = "default:stone_with_coal", ore = "default:stone_with_coal",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 8*8*8, clust_scarcity = 8*8*8,
^ Ore has a 1 out of clust_scarcity chance of spawning in a node ^ Ore has a 1 out of clust_scarcity chance of spawning in a node
^ This value should be *MUCH* higher than your intuition might tell you! ^ This value should be *MUCH* higher than your intuition might tell you!
clust_num_ores = 8, clust_num_ores = 8,
^ Number of ores in a cluster ^ Number of ores in a cluster
clust_size = 3, clust_size = 3,
^ Size of the bounding box of the cluster ^ Size of the bounding box of the cluster
^ In this example, there is a 3x3x3 cluster where 8 out of the 27 nodes are coal ore ^ In this example, there is a 3x3x3 cluster where 8 out of the 27 nodes are coal ore
height_min = -31000, height_min = -31000,
height_max = 64, height_max = 64,
noise_threshhold = 0.5, noise_threshhold = 0.5,
^ If noise is above this threshhold, ore is placed. Not needed for a uniform distribution ^ If noise is above this threshhold, ore is placed. Not needed for a uniform distribution
noise_params = {offset=0, scale=1, spread={x=100, y=100, z=100}, seed=23, octaves=3, persist=0.70} noise_params = {offset=0, scale=1, spread={x=100, y=100, z=100}, seed=23, octaves=3, persist=0.70}
^ NoiseParams structure describing the perlin noise used for ore distribution. ^ NoiseParams structure describing the perlin noise used for ore distribution.
^ Needed for sheet ore_type. Omit from scatter ore_type for a uniform ore distribution ^ Needed for sheet ore_type. Omit from scatter ore_type for a uniform ore distribution
} }
@ -1721,24 +1721,24 @@ Chatcommand definition (register_chatcommand)
Detached inventory callbacks Detached inventory callbacks
{ {
allow_move = func(inv, from_list, from_index, to_list, to_index, count, player), allow_move = func(inv, from_list, from_index, to_list, to_index, count, player),
^ Called when a player wants to move items inside the inventory ^ Called when a player wants to move items inside the inventory
^ Return value: number of items allowed to move ^ Return value: number of items allowed to move
allow_put = func(inv, listname, index, stack, player), allow_put = func(inv, listname, index, stack, player),
^ Called when a player wants to put something into the inventory ^ Called when a player wants to put something into the inventory
^ Return value: number of items allowed to put ^ Return value: number of items allowed to put
^ Return value: -1: Allow and don't modify item count in inventory ^ Return value: -1: Allow and don't modify item count in inventory
allow_take = func(inv, listname, index, stack, player), allow_take = func(inv, listname, index, stack, player),
^ Called when a player wants to take something out of the inventory ^ Called when a player wants to take something out of the inventory
^ Return value: number of items allowed to take ^ Return value: number of items allowed to take
^ Return value: -1: Allow and don't modify item count in inventory ^ Return value: -1: Allow and don't modify item count in inventory
on_move = func(inv, from_list, from_index, to_list, to_index, count, player), on_move = func(inv, from_list, from_index, to_list, to_index, count, player),
on_put = func(inv, listname, index, stack, player), on_put = func(inv, listname, index, stack, player),
on_take = func(inv, listname, index, stack, player), on_take = func(inv, listname, index, stack, player),
^ Called after the actual action has happened, according to what was allowed. ^ Called after the actual action has happened, according to what was allowed.
^ No return value ^ No return value
} }