From ba78194636a9a498f6979cc21cd39399f23d658a Mon Sep 17 00:00:00 2001 From: kwolekr Date: Sun, 24 Feb 2013 16:00:35 -0500 Subject: Allow any character in formspec strings with escape char --- doc/lua_api.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 005d7c010..8246377e2 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -778,6 +778,9 @@ string:trim() minetest.pos_to_string({x=X,y=Y,z=Z}) -> "(X,Y,Z)" ^ Convert position to a printable string minetest.string_to_pos(string) -> position +^ Same but in reverse +minetest.formspec_escape(string) -> string +^ escapes characters like [, ], and \ that can not be used in formspecs minetest namespace reference ----------------------------- -- cgit v1.2.3 From 5af8acfa6e41e258dd7e2135e8e75f03096c1d5c Mon Sep 17 00:00:00 2001 From: RealBadAngel Date: Mon, 4 Mar 2013 01:55:16 +0100 Subject: Added method to get all registered recipes for item(node) --- doc/lua_api.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 8246377e2..809d3d9d0 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -922,12 +922,17 @@ minetest.get_craft_result(input) -> output, decremented_input ^ output.time = number, if unsuccessful: 0 ^ decremented_input = like input minetest.get_craft_recipe(output) -> input +^ returns last registered recipe for output item (node) ^ output is a node or item type such as 'default:torch' ^ input.method = 'normal' or 'cooking' or 'fuel' ^ input.width = for example 3 ^ input.items = for example { stack 1, stack 2, stack 3, stack 4, stack 5, stack 6, stack 7, stack 8, stack 9 } ^ input.items = nil if no recipe found +minetest.get_all_craft_recipes(output) -> table or nil +^ returns table with all registered recipes for output item (node) +^ returns nil if no recipe was found +^ table entries have same format as minetest.get_craft_recipe minetest.handle_node_drops(pos, drops, digger) ^ drops: list of itemstrings ^ Handles drops from nodes after digging: Default action is to put them into -- cgit v1.2.3 From fc5d2074b99d22022d2bf8e693351274bc3f6d09 Mon Sep 17 00:00:00 2001 From: Jeija Date: Mon, 11 Feb 2013 09:58:58 +0100 Subject: Allow minetest.after to take a variable number of arguments --- doc/lua_api.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 809d3d9d0..eb05d117e 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -977,9 +977,9 @@ minetest.sound_play(spec, parameters) -> handle minetest.sound_stop(handle) Timing: -minetest.after(time, func, param) +minetest.after(time, func, ...) ^ Call function after time seconds -^ param is optional; to pass multiple parameters, pass a table. +^ Optional: Variable number of arguments that are passed to func Server: minetest.request_shutdown() -> request for server shutdown -- cgit v1.2.3 From 7f51b2da28e004b82fc6835e5257e619da4666b2 Mon Sep 17 00:00:00 2001 From: RealBadAngel Date: Sun, 17 Mar 2013 12:16:57 +0100 Subject: lua methods set_look_pitch and set_look_yaw --- doc/lua_api.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index eb05d117e..7d8fa149f 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1228,6 +1228,8 @@ Player-only: (no-op for other objects) - get_look_dir(): get camera direction as a unit vector - get_look_pitch(): pitch in radians - get_look_yaw(): yaw in radians (wraps around pretty randomly as of now) +- set_look_pitch(radians): sets look pitch +- set_look_yaw(radians): sets look yaw - set_inventory_formspec(formspec) ^ Redefine player's inventory form ^ Should usually be called in on_joinplayer -- cgit v1.2.3 From adc52f3f3c041e5914f665b6f96d07f49bbb6487 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Thu, 21 Mar 2013 20:04:00 +0200 Subject: lua_api.txt: Document paths, games and common mod loading --- doc/lua_api.txt | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 7d8fa149f..19fa81473 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -27,6 +27,36 @@ Startup Mods are loaded during server startup from the mod load paths by running the init.lua scripts in a shared environment. +Paths +----- +RUN_IN_PLACE=1: (Windows release, local build) + $path_user: Linux: + Windows: + $path_share: Linux: + Windows: + +RUN_IN_PLACE=0: (Linux release) + $path_share: Linux: /usr/share/minetest + Windows: /minetest-0.4.x + $path_user: Linux: ~/.minetest + Windows: C:/users//AppData/minetest (maybe) + +Games +----- +Games are looked up from: + $path_share/games/gameid/ + $path_user/games/gameid/ +where gameid is unique to each game. + +The game directory contains the file game.conf, which contains these fields: + name = + common_mods = +eg. + name = Minetest + common_mods = bucket, default, doors, fire, stairs + +Common mods are loaded from the pseudo-game "common". + Mod load path ------------- Generic: -- cgit v1.2.3 From c2250d95c4da368d1535794a1c7f2092ce479d7a Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Thu, 21 Mar 2013 21:42:23 +0200 Subject: Support game-specific minetest.conf --- doc/lua_api.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 19fa81473..af8b1cc9a 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -57,6 +57,9 @@ eg. Common mods are loaded from the pseudo-game "common". +The game directory can contain the file minetest.conf, which will be used +to set default settings when running the particular game. + Mod load path ------------- Generic: -- cgit v1.2.3 From 6f8d40ef5d24e26a70c7a0bdf6d2992e0bea9a63 Mon Sep 17 00:00:00 2001 From: RealBadAngel Date: Sat, 23 Mar 2013 19:17:00 +0100 Subject: 6d facedir --- doc/lua_api.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index af8b1cc9a..3d47785ba 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -310,6 +310,10 @@ param2 is reserved for the engine when any of these are used: paramtype2 == "facedir" ^ The rotation of the node is stored in param2. Furnaces and chests are rotated this way. Can be made by using minetest.dir_to_facedir(). + Values range 0 - 23 + facedir modulo 4 = axisdir + 0 = y+ 1 = z+ 2 = z- 3 = x+ 4 = x- 5 = y- + facedir's two less significant bits are rotation around the axis Nodes can also contain extra data. See "Node Metadata". -- cgit v1.2.3 From e1ff5b13619666e5b987ecf4faaf294400ffd979 Mon Sep 17 00:00:00 2001 From: Jeija Date: Wed, 23 Jan 2013 18:32:02 +0100 Subject: Allow spawning particles from the server, from lua Spawn single particles or make use of ParticleSpawner for many randomly spawned particles. Accessible in Lua using minetest.spawn_particle and minetest.add_particlespawner. Increase Protocol Version to 17. Conflicts: src/clientserver.h --- doc/lua_api.txt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 3d47785ba..4edca5adb 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1028,6 +1028,37 @@ minetest.get_ban_description(ip_or_name) -> ban description (string) minetest.ban_player(name) -> ban a player minetest.unban_player_or_ip(name) -> unban player or IP address +Particles: +minetest.add_particle(pos, velocity, acceleration, expirationtime, + size, collisiondetection, texture, playername) +^ Spawn particle at pos with velocity and acceleration +^ Disappears after expirationtime seconds +^ collisiondetection: if true collides with physical objects +^ Uses texture (string) +^ Playername is optional, if specified spawns particle only on the player's client + +minetest.add_particlespawner(amount, time, + minpos, maxpos, + minvel, maxvel, + minacc, maxacc, + minexptime, maxexptime, + minsize, maxsize, + collisiondetection, texture, playername) +^ 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: +^ minpos/maxpos, minvel/maxvel (velocity), minacc/maxacc (acceleration), +^ minsize/maxsize, minexptime/maxexptime (expirationtime) +^ collisiondetection: if true uses collisiondetection +^ Uses texture (string) +^ Playername is optional, if specified spawns particle only on the player's client +^ If time is 0 has infinite lifespan and spawns the amount on a per-second base +^ Returns and id + +minetest.delete_particlespawner(id, player) +^ Delete ParticleSpawner with id (return value from add_particlespawner) +^ If playername is specified, only deletes on the player's client, +^ otherwise on all clients + Random: minetest.get_connected_players() -> list of ObjectRefs minetest.hash_node_position({x=,y=,z=}) -> 48-bit integer -- cgit v1.2.3 From 6767ed74f838bbb0c7786f85ef1e8f5b9fb88ef7 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Sun, 24 Mar 2013 15:12:29 -0400 Subject: Update lua_api.txt --- doc/lua_api.txt | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 4edca5adb..c77a1e939 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1,4 +1,4 @@ -Minetest Lua Modding API Reference 0.4.4 +Minetest Lua Modding API Reference 0.4.5 ========================================== More information at http://c55.me/minetest/ @@ -372,6 +372,25 @@ A box is defined as: A box of a regular node would look like: {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, +Ore types +--------------- +These tell in what manner the ore is generated. +All default ores are of the uniformly-distributed scatter type. + +- scatter + Randomly chooses a location and generates a cluster of ore. + If noise_params is specified, the ore will be placed if the 3d perlin noise at + that point is greater than the noise_threshhold, giving the ability to create a non-equal + distribution of ore. +- sheet + Creates a sheet of ore in a blob shape according to the 2d perlin noise described by + the noise_params structure. The height of the blob is randomly scattered, with a maximum + height of clust_size. Here, clust_scarcity and clust_num_ores are ignored. + This is essentially an improved version of the so-called "stratus" ore seen in some unofficial mods. +- claylike - NOT YET IMPLEMENTED + Places ore if there are no more than clust_scarcity number of specified nodes within a Von Neumann + neighborhood of clust_size radius. + Representations of simple things -------------------------------- Position/vector: @@ -844,6 +863,7 @@ minetest.register_tool(name, item definition) minetest.register_craftitem(name, item definition) minetest.register_alias(name, convert_to) minetest.register_craft(recipe) +minetest.register_ore(ore definition) Global callback registration functions: (Call these only at load time) minetest.register_globalstep(func(dtime)) @@ -1669,6 +1689,28 @@ Recipe for register_craft (furnace fuel) burntime = 1, } +Ore definition (register_ore) +{ + ore_type = "scatter" -- See "Ore types" + ore = "default:stone_with_coal", + wherein = "default:stone", + clust_scarcity = 8*8*8, + ^ 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! + clust_num_ores = 8, + ^ Number of ores in a cluster + clust_size = 3, + ^ 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 + height_min = -31000, + height_max = 64, + noise_threshhold = 0.5, + ^ 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} + ^ 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 +} + Chatcommand definition (register_chatcommand) { params = " ", -- short parameter description -- cgit v1.2.3 From 423d69bd4095970068b5431b4b33007a3c069576 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 24 Mar 2013 21:39:15 +0200 Subject: Fix indentation of lua_api.txt --- doc/lua_api.txt | 148 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 74 insertions(+), 74 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index c77a1e939..23f7f8568 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -203,18 +203,18 @@ from the available ones of the following files: Examples of sound parameter tables: -- Play locationless on all clients { - gain = 1.0, -- default + gain = 1.0, -- default } -- Play locationless to a player { - to_player = name, - gain = 1.0, -- default + to_player = name, + gain = 1.0, -- default } -- Play in a location { - pos = {x=1,y=2,z=3}, - gain = 1.0, -- default - max_hear_distance = 32, -- default + pos = {x=1,y=2,z=3}, + gain = 1.0, -- default + max_hear_distance = 32, -- default } -- 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: function minetest.get_item_group(name, group) - if not minetest.registered_items[name] or not - minetest.registered_items[name].groups[group] then - return 0 - end - return minetest.registered_items[name].groups[group] + if not minetest.registered_items[name] or not + minetest.registered_items[name].groups[group] then + return 0 + end + return minetest.registered_items[name].groups[group] end 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 { - type = 'shapeless', + type = 'shapeless', output = 'wool: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. - 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 - from destroyed nodes. + from destroyed nodes. - 0 is something that is directly accessible at the start of gameplay - There is no upper limit - 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 ------------------------------------------------- tool_capabilities = { - full_punch_interval=1.5, - max_drop_level=1, - groupcaps={ - crumbly={maxlevel=2, uses=20, times={[1]=1.60, [2]=1.20, [3]=0.80}} - } + full_punch_interval=1.5, + max_drop_level=1, + groupcaps={ + 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: @@ -773,7 +773,7 @@ field[,;,;;