From 309c5f3641dccaf1260953f098ccd593396dee64 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Sat, 22 Jun 2013 20:48:19 -0400 Subject: Decoration: Add support for zero probability, fix breakage from last commit --- doc/lua_api.txt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'doc') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 7be94ac03..8231364fb 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -432,14 +432,22 @@ Schematic specifier or through raw data supplied through Lua, in the form of a table. This table must specify two fields: - The 'size' field is a 3d vector containing the dimensions of the provided schematic. - The 'data' field is a flat table of MapNodes making up the schematic, in the order of [z [y [x]]]. + In the bulk MapNode data, param1, instead of the typical light values, instead represents the -probability of that node appearing in the structure. It is an integer with a value from 0-255; 0 means -that node will always appear. If the probability value p is non-zero, then there is a -(p / 256 * 100)% chance that node will appear when the schematic is placed on the map. +probability of that node appearing in the structure. +When passed to minetest.create_schematic, probability is an integer value ranging from -1 to 255: + - A probability value of 0 means that node will always appear. + - A probability value of -1 means the node will never appear. + - If the probability value p is greater than 0, then there is a (p / 256 * 100)% chance that node + will appear when the schematic is placed on the map. + +If registering a structure in the raw format, however, -1 is not a valid probability value; in order to +have a node that is not placed, it must be CONTENT_IGNORE (the name for which is "ignore"). + Important note: Node aliases cannot be used for a raw schematic provided when registering as a decoration. Schematic attributes ------------------ +--------------------- Currently supported flags: place_center_x, place_center_y, place_center_z - place_center_x Placement of this decoration is centered along the X axis. @@ -1281,7 +1289,7 @@ minetest.create_schematic(p1, p2, probability_list, filename) ^ Apply the specified probability values to the specified nodes in probability_list. ^ probability_list is an array of tables containing two fields, pos and prob. ^ pos is the 3d vector specifying the absolute coordinates of the node being modified, - ^ and prob is the integer value from 0 to 255 of the probability (see: Schematic specifier). + ^ and prob is the integer value from -1 to 255 of the probability (see: Schematic specifier). ^ If there are two or more entries with the same pos value, the last occuring in the array is used. ^ If pos is not inside the box formed by p1 and p2, it is ignored. ^ If probability_list is nil, no probabilities are applied. -- cgit v1.2.3