634 Commits

Author SHA1 Message Date
est31
2f6c8a1c19 HTTP lua API docs: correct some function references 2016-07-12 22:47:14 +02:00
Tim
8ceaf9cc13 Builtin/profiler: Replace game profiler (#4245)
Use the setting "profiler.load" to enable profiling.
Other settings can be found in settingtypes.txt.

* /profiler print [filter] - report statistics to in-game console
* /profiler dump [filter] - report statistics to STDOUT and debug.txt
* /profiler save [format [filter]] - saves statistics to a file in your worldpath
	* txt (default) - same treetable format as used by the dump and print commands
	* csv - ready for spreadsheet import
	* json - useful for adhoc D3 visualizations
	* json_pretty - line wrapped and intended json for humans
	* lua - serialized lua table of the profile-data, for adhoc scripts
* /profiler reset - reset all gathered profile data.
	This can be helpful to discard of any startup measurements that often spike during loading or to get more useful min-values.

[filter] allows limiting the output of the data via substring/pattern matching against the modname.

Note: Serialized data structures might be subject to change with changed or added measurements.
	csv might be the most stable, due to flat structure.

Changes to the previous version include:

* Updated and extended API monitoring
* Correct calculation of average (mean) values (undistorted by idleness)
* Reduce instrumentation overhead.
* Fix crashes related to missing parameters for the future and occasional DIV/0's.
* Prevent issues caused by timetravel (overflow, timejump, NTP corrections)
* Prevent modname clashes with internal names.
* Measure each instrumentation individually and label based on registration order.
* Labeling of ABM's and LBM's for easier classification.
  Giving several ABM's or LBM's the same label will treat them as one.
  Missing labels will be autogenerated based on name or registration order.
* Configurable instrumentation and reporting. Skip e.g. builtin if you don't need it.
* Profile the profiler to measure instrumentation overhead.
2016-07-12 21:51:10 +02:00
Duane
82fadf2fe4 Lua_api.txt: Fix description of node drop behaviour 2016-07-12 20:23:46 +01:00
Foghrye4
242d1d9076 Adding minetest.clear_craft
Modifications by est31: grammar fixes in doc + error messages and
a little style fix, no functional change.
2016-07-05 21:40:13 +02:00
kwolekr
7af0dede5f Add MapSettingsManager and new mapgen setting script API functions
This commit refactors the majority of the Mapgen settings system.
- MapgenParams is now owned by MapSettingsManager, itself a part of ServerMap,
  instead of the EmergeManager.
- New Script API functions added:
    core.get_mapgen_setting
    core.get_mapgen_setting_noiseparams,
    core.set_mapgen_setting, and
    core.set_mapgen_setting_noiseparams.
- minetest.get/set_mapgen_params are deprecated by the above new functions.
- It is now possible to view and modify any arbitrary mapgen setting from a mod,
  rather than the base MapgenParams structure.
- MapgenSpecificParams has been removed.
2016-07-03 15:38:36 -04:00
raymoo
be9acaf9df Player: New get_look, set_look API
Deprecate get_look / set_look pitch / yaw
2016-06-24 02:13:09 +01:00
Auke Kok
5ed0d77c58 Builtin/game/item: Add place_param2 nodedef field
This allows a nodedef to specify a fixed value for param2 to be
used for all normal placements.

There are several uses for this:

- nodes that require param2 to be set to a non-zero value for
  internal mod use. E.g. leafdecay could use this to detect that
  leaves are played by players.
- force wallmounted or facedir value at placement at placement

This overrides any player look direction or other on-the-fly
param2 setting during placement.
2016-06-17 04:41:20 +01:00
Diego Martinez
34b9126292 Server: Add reason for leave to on_leaveplayer callbacks 2016-06-11 04:17:04 +01:00
paramat
6c9d1c187e Lua_api.txt: Split long lines. Capitalise 'Biome API'. Minor edits 2016-06-07 04:45:41 +01:00
paramat
3616e70c58 Biome API: Add per-biome riverbed material and depth
Mgvalleys: Remove riverbed sand placement from base terrain generation
Riverbed material placement moved to MapgenBasic::generateBiomes()
Document fields and add note that the biome API is still unstable
2016-06-05 16:37:02 +01:00
kwolekr
60173ed48e PcgRandom: Fix/improve documentation 2016-06-04 02:16:06 -04:00
Ekdohibs
e7b84d7db6 Add colored text (not only colored chat).
Add documentation, move files to a proper place and avoid memory leaks.
Make it work with most kind of texts, and allow backgrounds too.
2016-05-31 17:34:29 +02:00
est31
9f3636a238 Add minetest.check_password_entry callback
Gives a convenient way to check a player's password.

This entirely bypasses the SRP protocol, so should be used
with great care.

This function is not intended to be used
in-game, but solely by external protocols, where no
authentication of the minetest engine is provided, and
also only for protocols, in which the user already gives the
server the plaintext password.

Examples for good use are the classical http form, or irc,
an example for a bad use is a password change dialog inside
formspec.

Users should be aware that they lose the advantages of the SRP
protocol if they enter their passwords for servers outside the
normal entry box, like in in-game formspec menus,
or through irc /msg s,

This patch also fixes an auth.h mistake which has mixed up the
order of params inside the decode_srp_verifier_and_salt function.

Zeno-: Added errorstream message for invalid format when I committed
2016-05-30 23:28:08 +10:00
Auke Kok
9cb1159917 Particles: Add option to remove particles on collision
Adds the particle option `collision_removal = bool`

Some particles are hard to use right now since they either go through
solid blocks (without collision detection), and with collision
detection enabled they (e.g. raindrops) would just stop dead on the
floor and sit there until they expire, or worse, scrape along a wall
or ceiling.

We can solve the problem by adding a boolean flag that tells the
particle to be removed if it ever collides with something. This will
make it easier to add rain that doesn't fall through your roof or stick
on the top of it. Or clouds and smoke that don't go through trees.

Particles that collide with this flag are marked expired
unconditionally, causing them to be treated like normal expired
particles and cleaned up normally.

Documentation is adjusted accordingly.

An added bonus of this patch is that particles can potentially collide
many times with nodes, and this reduces the amount of collisions to 1
(max), which may end up reducing particle load on the client.
2016-05-28 00:08:23 -04:00
red-001
1e4b9eb2d9 Add base64 encoding and decoding to the lua api. (#3919) 2016-05-27 23:37:28 -04:00
Maksim Gamarnik
b771d4a9f8 Update to Minetest 0.4.14 2016-05-15 16:30:09 +03:00
sfan5
234652ad61 Bump version to 0.4.14 2016-05-15 14:49:15 +02:00
paramat
a241a668dd Lua_api.txt: Fix documentation for facedir rotation 2016-05-10 02:21:53 +01:00
SmallJoker
4daf22d7fe Add [resize texture modifier Resizes the texture to the given dimensions. 2016-05-09 20:48:42 +02:00
Maksim Gamarnik
0e40320816 Merge 2016-05-07 23:57:42 +03:00
paramat
a238027e59 Lua_api.txt: Add warnings of l-system lighting bug 2016-05-06 00:29:16 +01:00
Maksim Gamarnik
d5854e5cf7 Merge minetest commits / WIP!
Java part WIP, pls, use prev commits!
2016-04-29 10:11:25 +03:00
rubenwardy
21e176b7a0 Builtin: Add basic_privs setting 2016-04-28 07:19:07 +01:00
SmallJoker
6569e39099 tile.cpp: Automatically upscale lower resolution texture 2016-04-25 06:39:32 +01:00
Maksim Gamarnik
6d3bdc5a7d Merge 2016-04-12 21:28:50 +03:00
rubenwardy
cbff06cadc Hud: Fix offset being ignored by inventory bar 2016-04-10 23:54:23 -04:00
raymoo
900d0fdfb6 Document hpchange callback ordering thing (#3981)
Document hpchange callback ordering thing

Callbacks registered by register_on_player_hpchange are ordered so that non-modifiers are called after modifiers are called. Credit to @TeTpaAka who mentioned this previously-undocumented feature in #3799.

See also commit

aa13baa30a45b0f834c23bd5c0407895eb8ec0ee "Add minetest.register_on_player_hpchange"
2016-04-10 13:52:18 +02:00
Samuel Sieb
12a67a4f51 Clearer explanation of [colorize with alpha 2016-04-07 03:55:17 -04:00
Samuel Sieb
b378092691 Add an option to colorize to respect the destination alpha
Also, rework the colorizing code to be more efficient.
2016-04-03 04:24:28 -04:00
Maksim Gamarnik
f56e578960 Merge remote-tracking branch 'upstream1/master' 2016-03-21 01:45:56 +02:00
est31
869c043af8 lua_api.txt: improve vector documentation
Before it rendered very badly in HTML.
Also point out what vector.round does.
2016-03-19 15:34:51 +01:00
Maksim Gamarnik
8f6ddcc57c Merge branch 'upstream/master' 2016-03-14 11:44:17 +02:00
Auke Kok
14a15265db Allow nodes to specify which sides to connect to.
NDT_CONNECTED attempts to connect to any side of nodes that it can
connect to, which is troublesome for FACEDIR type nodes that generally
may only have one usable face, and can be rotated.

We introduce a node parameter `connect_sides` that is valid for
any node type. If specified, it lists faces of the node (in "top",
"bottom", "front", "left", "back", "right", form, as array) that
connecting nodeboxes can connect to. "front" corresponds to the south
facing side of a node with facedir = 0.

If the node is rotatable using *simple* FACEDIR, then the attached
face is properly rotated before checking. This allows e.g. a chest
to be attached to only from the rear side.
2016-03-12 12:08:17 -05:00
Auke Kok
f11d473497 Nodebox: Allow nodeboxes to "connect"
We introduce a new nodebox type "connected", and allow these nodes to
have optional nodeboxes that connect it to other connecting nodeboxes.

This is all done at scenedraw time in the client. The client will
inspect the surrounding nodes and if they are to be connected to,
it will draw the appropriate connecting nodeboxes to make those
connections.

In the node_box definition, we have to specify separate nodeboxes for
each valid connection. This allows us to make nodes that connect only
horizontally (the common case) by providing optional nodeboxes for +x,
-x, +z, -z directions. Or this allows us to make wires that can connect
up and down, by providing nodeboxes that connect it up and down (+y,
-y) as well.

The optional nodeboxes can be arrays. They are named "connect_top,
"connect_bottom", "connect_front", "connect_left", "connect_back" and
"connect_right". Here, "front" means the south facing side of the node
that has facedir = 0.

Additionally, a "fixed" nodebox list present will always be drawn,
so one can make a central post, for instance. This "fixed" nodebox
can be omitted, or it can be an array of nodeboxes.

Collision boxes are also updated in exactly the same fashion, which
allows you to walk over the upper extremities of the individual
node boxes, or stand really close to them. You can also walk up
node noxes that are small in height, all as expected, and unlike the
NDT_FENCELIKE nodes.

I've posted a screenshot demonstrating the flexibility at
    http://i.imgur.com/zaJq8jo.png
In the screenshot, all connecting nodes are of this new subtype.

Transparent textures render incorrectly, Which I don't think is
related to this text, as other nodeboxes also have issues with this.

A protocol bump is performed in order to be able to send older clients
a nodeblock that is usable for them. In order to avoid abuse of users
we send older clients a "full-size" node, so that it's impossible for
them to try and walk through a fence or wall that's created in this
fashion. This was tested with a pre-bump client connected against a
server running the new protocol.

These nodes connect to other nodes, and you can select which ones
those are by specifying node names (or group names) in the
connects_to string array:
      connects_to = { "group:fence", "default:wood" }
By default, nodes do not connect to anything, allowing you to create
nodes that always have to be paired in order to connect. lua_api.txt
is updated to reflect the extension to the node_box API.

Example lua code needed to generate these nodes can be found here:
    https://gist.github.com/sofar/b381c8c192c8e53e6062
2016-03-12 12:08:17 -05:00
Auke Kok
9cf7a3ef96 Add consistent monotonic day counter - get_day_count()
I've written several experimental bits of code that revolve around the
need for a consistent calendar, but implementing one is extremely hard
in mods due to time changes and mods overriding core.get_timeofday(),
which will conflict.

The second part of the problem is that doing this from a mod requires
constant maintenance of a settings file.

An implementation in core is trivial, however, and solves all of
these problems at virtually no cost: No extra branches in server
steps, and a single branch when minetest.set_time_of_day(), which is
entirely reasonable.

We store the day_count value in env_meta.txt.

The use case is obvious: This change allows mods to create an actual
virtual calendar, or properly account for seasonal changes, etc..

We add a "/days" chatcommand that displays the current day count. No
permissions are needed. It can only retrieve the day count, not
modify it.
2016-03-09 01:45:23 +01:00
ShadowNinja
3e9b7d3da7 Add AreaStore custom ID API 2016-03-07 16:33:20 -05:00
ShadowNinja
e666e6c109 Implement AreaStore serialization 2016-03-07 16:33:20 -05:00
ShadowNinja
9ae267cae5 Simplify AreaStore ID management 2016-03-07 16:33:20 -05:00
est31
fd7cbba94b Add minetest.register_lbm() to run code on block load only 2016-03-07 19:54:26 +01:00
Maksim Gamarnik
00b6a43c2e Merge 2016-03-04 16:30:16 +02:00
paramat
367d489b5e Decoration API: Allow force_placement of simple decorations 2016-03-04 02:38:55 +00:00
Jeija
9f33a11cea Require minetest.request_http_api to be called from the mod's main scope
Fixes #3764
2016-03-03 22:42:00 +01:00
Maksim Gamarnik
76ef29709c v. 1.1.2-pre | build1 2016-02-23 06:40:14 +02:00
Maksim Gamarnik
40b3667bd2 Merge remote-tracking branch 'upstream/master' 2016-02-23 00:38:30 +02:00
Jeija
6128dc7a07 Add Lua interface to HTTPFetchRequest
This allows mods to perform both asynchronous and synchronous HTTP
requests. Mods are only granted access to HTTP APIs if either mod
security is disabled or if they are whitelisted in any of the
the secure.http_mods and secure.trusted_mods settings.

Adds httpfetch_caller_alloc_secure to generate random, non-predictable
caller IDs so that lua mods cannot spy on each others HTTP queries.
2016-02-22 15:39:41 +01:00
ShadowNinja
6cf6c8f25d Require request_insecure_environment to be called from the mod's main scope
Previously you could steal a secure environment from a trusted mod by wrapping
request_insecure_environment with some code like this:

local rie_cp = minetest.request_insecure_environment
local stolen_ie
function minetest.request_insecure_environment()
	local ie = rie_cp()
	stolen_ie = stolen_ie or ie
	return ie
end
2016-02-19 14:52:10 +00:00
Maksim Gamarnik
d7c0fad71f Merge Minetest commits 2016-02-11 22:35:23 +02:00
Diego Martinez
5c79a36617 Initialize facedir and wallmounted tables only once.
This makes the functions a bit faster since they don't
have to recreate the tables every invocation, and makes
the code more readable.

Also, document `wallmounted_to_dir`.

The function was implemented but not documented in `lua_api.txt`.
2016-02-11 04:23:17 +00:00
Kahrl
02cbda530b Add '/clearobjects quick' 2016-02-11 04:22:58 +00:00
Maksim Gamarnik
2520ca3ed1 Merge branch 'master' of https://github.com/minetest/minetest 2016-01-31 20:57:03 +02:00