From 1ef08a080a29f4cc9bf52a20a112766fc7f1a9ea Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 19 Mar 2016 14:25:33 +0000 Subject: [PATCH] Update lua_api.html --- lua_api.html | 270 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 200 insertions(+), 70 deletions(-) diff --git a/lua_api.html b/lua_api.html index 8f3b120..f8ac3ae 100644 --- a/lua_api.html +++ b/lua_api.html @@ -38,7 +38,7 @@ layout: default
  • Texture grouping
  • Advanced texture modifiers
  • @@ -354,7 +358,7 @@ source code patches to celeron55@gmail.com< This page was last updated 07/December/2015.
    See doc/lua_api.txt for the latest version (in plaintext).
    Generated using a Python script.

    Programming in Lua

    +This page was last updated 19/March/2016.
    See doc/lua_api.txt for the latest version (in plaintext).
    Generated using a Python script.

    Programming in Lua

    If you have any difficulty in understanding this, please read Programming in Lua.

    Startup

    @@ -552,16 +556,16 @@ texture is overlaid over cobble.png.

    Example:

    default_cobble.png^[crack:10:1
     
    -

    [combine:<w>x<h>:<x1>,<y1>=<file1>:<x2>,<y2>=<file2>

    +

    [combine:<w>x<h>:<x1>,<y1>=<file1>:<x2>,<y2>=<file2>:...

    -

    Create a texture of size <w> times <h> and blit <file1> to (<x1>,<y1>) -and blit <file2> to (<x2>,<y2>).

    +

    Creates a texture of size <w> times <h> and blits the listed files to their +specified coordinates.

    Example:

    [combine:16x32:0,0=default_cobble.png:0,16=default_wood.png
     
    @@ -896,6 +900,18 @@ changed in the future.

    wall_bottom = box, wall_side = box } +{ + -- A node that has optional boxes depending on neighbouring nodes' + -- presence and type. See also `connects_to`. + type = "connected", + fixed = box OR {box1, box2, ...} + connect_top = box OR {box1, box2, ...} + connect_bottom = box OR {box1, box2, ...} + connect_front = box OR {box1, box2, ...} + connect_left = box OR {box1, box2, ...} + connect_back = box OR {box1, box2, ...} + connect_right = box OR {box1, box2, ...} +}

    A box is defined as:

    {x1, y1, z1, x2, y2, z2}
    @@ -1613,7 +1629,7 @@ list[current_player;craftpreview;7,1;1,1;]
     

    pwdfield[<X>,<Y>;<W>,<H>;<name>;<label>]

    Entity definition (register_entity)

    @@ -3924,6 +4000,20 @@ minetest.spawn_tree(pos,apple_tree) action = func(pos, node, active_object_count, active_object_count_wider), } +

    LBM (LoadingBlockModifier) definition (register_lbm)

    +
    {
    +    name = "modname:replace_legacy_door",
    +    nodenames = {"default:lava_source"},
    +--  ^ List of node names to trigger the LBM on.
    +--    Also non-registered nodes will work.
    +--    Groups (as of group:groupname) will work as well.
    +    run_at_every_load = false,
    +--  ^ Whether to run the LBM's action every time a block gets loaded,
    +--    and not just for blocks that were saved last time before LBMs were
    +--    introduced to the world.
    +    action = func(pos, node),
    +}
    +

    Item definition (register_node, register_craftitem, register_tool)

    {
         description = "Steel Axe",
    @@ -4003,7 +4093,7 @@ minetest.spawn_tree(pos,apple_tree)
     
  • #{name="image.png", animation={Tile Animation definition}}
  • #{name="image.png", backface_culling=bool, tileable_vertical=bool, tileable_horizontal=bool}
      -
    • backface culling only supported in special tiles.
    • +
    • backface culling enabled by default for most nodes
    • tileable flags are info for shaders, how they should treat texture when displacement mapping is used Directions are from the point of view of the tile texture, @@ -4049,6 +4139,7 @@ minetest.spawn_tree(pos,apple_tree) diggable = true, -- If false, can never be dug climbable = false, -- If true, can be climbed on (ladder) buildable_to = false, -- If true, placed nodes can replace this node + floodable = false, -- If true, liquids flow into and replace this node liquidtype = "none", -- "none"/"source"/"flowing" liquid_alternative_flowing = "", -- Flowing version of source liquid liquid_alternative_source = "", -- Source version of flowing liquid @@ -4062,6 +4153,12 @@ minetest.spawn_tree(pos,apple_tree) light_source = 0, -- Amount of light emitted by node damage_per_second = 0, -- If player is inside node, this damage is caused node_box = {type="regular"}, -- See "Node boxes" + connects_to = nodenames, --[[ + * Used for nodebox nodes with the type == "connected" + * Specifies to what neighboring nodes connections will be drawn + * e.g. `{"group:fence", "default:wood"}` or `"default:stone"` ]] + connect_sides = { "top", "bottom", "front", "left", "back", "right" }, --[[ + ^ Tells connected nodebox nodes to connect only to these sides of this node. ]] mesh = "model", selection_box = {type="regular"}, -- See "Node boxes" --[[ ^ If drawtype "nodebox" is used and selection_box is nil, then node_box is used. ]] @@ -4312,11 +4409,12 @@ minetest.spawn_tree(pos,apple_tree) -- ^ Minimum and maximum `y` positions these decorations can be generated at. -- ^ This parameter refers to the `y` position of the decoration base, so -- the actual maximum height would be `height_max + size.Y`. - flags = "liquid_surface", + flags = "liquid_surface, force_placement", -- ^ Flags for all decoration types. -- ^ "liquid_surface": Instead of placement on the highest solid surface -- ^ in a mapchunk column, placement is on the highest liquid surface. -- ^ Placement is disabled if solid nodes are found above the liquid surface. +-- ^ "force_placement": Nodes other than "air" and "ignore" are replaced by the decoration. ----- Simple-type parameters decoration = "default:grass", @@ -4360,7 +4458,7 @@ minetest.spawn_tree(pos,apple_tree) }, -- ^ See 'Schematic specifier' for details. replacements = {["oldname"] = "convert_to", ...}, - flags = "place_center_x, place_center_y, place_center_z, force_placement", + flags = "place_center_x, place_center_y, place_center_z", -- ^ Flags for schematic decorations. See 'Schematic attributes'. rotation = "90" -- rotate schematic 90 degrees on placement -- ^ Rotation can be "0", "90", "180", "270", or "random". @@ -4466,4 +4564,36 @@ minetest.spawn_tree(pos,apple_tree) playername = "singleplayer" -- ^ Playername is optional, if specified spawns particle only on the player's client } +
  • +

    HTTPRequest definition (http_fetch, http_fetch_async)

    +
    {
    +    url = "http://example.org",
    +    timeout = 10,
    + -- ^ Timeout for connection in seconds. Default is 3 seconds.
    +    post_data = "Raw POST request data string" OR { field1 = "data1", field2 = "data2" },
    + -- ^ Optional, if specified a POST request with post_data is performed.
    + -- ^ Accepts both a string and a table. If a table is specified, encodes table
    + -- ^ as x-www-form-urlencoded key-value pairs.
    + -- ^ If post_data ist not specified, a GET request is performed instead.
    +    user_agent = "ExampleUserAgent",
    + -- ^ Optional, if specified replaces the default minetest user agent with given string
    +    extra_headers = { "Accept-Language: en-us", "Accept-Charset: utf-8" },
    + -- ^ Optional, if specified adds additional headers to the HTTP request. You must make sure
    + -- ^ that the header strings follow HTTP specification ("Key: Value").
    +    multipart = boolean
    + -- ^ Optional, if true performs a multipart HTTP request. Default is false.
    +}
    +
    +

    HTTPRequestResult definition (http_fetch callback, http_fetch_async_get)

    +
    {
    +    completed = true,
    + -- ^ If true, the request has finished (either succeeded, failed or timed out)
    +    succeeded = true,
    + -- ^ If true, the request was succesful
    +    timeout = false,
    + -- ^ If true, the request timed out
    +    code = 200,
    + -- ^ HTTP status code
    +    data = "response"
    +}
     
    \ No newline at end of file