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.
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"
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.
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
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.
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.
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
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`.
I could honestly not make much sense of the timer implementation
that was here. Instead I've implemented the type of timer algorithm
that I've used before, and tested it instead.
The concept is extremely simple: all timers are put in an ordered
list. We check every server tick if any of the timers have
elapsed, and execute the function associated with this timer.
We know that many timers by themselves cause new timers to be
added to this list, so we iterate *backwards* over the timer
list. This means that new timers being added while timers are
being executed, can never be executed in the same function pass,
as they are always appended to the table *after* the end of
the table, which we will never reach in the current pass over
all the table elements.
We switch time keeping to minetest.get_us_time(). dtime is
likely unreliable and we have our own high-res timer that we
can fix if it is indeed broken. This removes the need to do
any sort of time keeping.
clock_gettime() is a far better clock than gettimeofday().
Even better than clock_gettime() is that you can select either
CLOCK_MONOTONIC, or even CLOCK_MONOTONIC_RAW. These clocks offer
high precision time. And the _RAW variant will never roll back
due to NTP drift or daylight savings, or otherwise.
I've adjusted this code to select the right clock method auto-
matically based on what's available in the OS. This means that
if you're running a very old linux version, MacOS or other,
you will automatically get the best clocksource available.
I've tested all Linux clocksources by selectively compiling and
running a 10k+ timer test suite. In all cases I confirmed that
the 3 POSIX Linux clocksources worked properly, and were
selected properly.
I've modified the OS X compile path to use the high-res clock
source for all time functions, but I can't confirm it works or
that it compiles.
As for WIN32, I confirmed that the used clocksource is indeed
a Monotonic clocksource, so good news: that code section appears
to be exactly what it should be.
Backface culling is enabled by default for all tiles, as this
is how the lua parser initializes each tiledef. We revert to
always using the value from the tiledef since it is always
read and serialized.
Mods that wish to enable culling for e.g. mesh nodes, now can
specify the following to enable backface culling:
tiles = {{ name = "tex.png", backface_culling = true }},
Note the double '{' and use of 'name' key here! In the same
fashion, backface_culling can be disabled for any node now.
I've tested this against the new door models and this properly
allows me to disable culling per node. I've also tested this
against my crops mod which uses mesh nodes where culling needs
to be disabled, and tested also with plantlike drawtype nodes
where we want this to continue to be disabled.
No default setting has changed. The defaults are just migrated
from nodedef.cpp to c_content.cpp.
To terminate unwanted shadows from floatlands or realms above
Also add to LuaVoxelManip calc_lighting for use in mapgen mods
Remove the 2 argument calcLighting, mapgens now use the 5
argument form to specify the volumes for propagateSunlight and
spreadLight
In mgsinglenode replace calcLighting with setLighting and
clean-up use of tabs and spaces
* Add key settings to setting table and ignore them later
This way they are added to the auto-generated minetest.conf.example
* Add flags type
* Add input validation for int, float and flags
* Break in-game graphic settings into multiple sections
* Parse settingtpes.txt in mods and games
* Improve description for a lot of settings
* Fix typos and wording in settingtypes.txt
* Convert language setting to an enum
The callback can now be invoked with either the player object or name as
the first parameter, and with either a table or a list of strings, like
this:
minetest.check_player_privs(player_name, { shout = true, fly = true })
minetest.check_player_privs(player_name, "shout", "fly")
minetest.check_player_privs(player, { shout = true, fly = true })
minetest.check_player_privs(player, "shout", "fly")
- Add warning log level
- Change debug_log_level setting to enumeration string
- Map Irrlicht log events to MT log events
- Encapsulate log_* functions and global variables into a class, Logger
- Unify dstream with standard logging mechanism
- Unify core.debug() with standard core.log() script API
This might break some mods, but it is important for all uses of the param2 to
be documented.
This doesn't need a serialisation version or network protocol version change,
as old clients will still work on new servers, and it is bearable to have
new clients getting non rotated plants on old servers.
It returns the index used in mg->biomemap for a given biome name.
The biomemap is useless without this unless you re-register all existing biomes,
which could cause problems for anyone else trying to use biomemap.
With this, you can quickly create a lookup table of ids and names.
Because not all circles are round:
* circles using an euclidean metric are what we usually call "round"
* circles using a maximum metric look like euclidean rectangles with equal adjacent sides (squares)
* circles using a manhattan metric look like an euclidean right angled rhombus (squares, but 45° rotated to the former one)
[ci skip]
Modders are now able to select the range of ore column height,
and the midpoint at which they 'grow' starting from.
This commit adds three new parameters for the 'sheet' ore type:
column_height_min, column_height_max, and column_midpoint_factor.
clust_size is now deprecated for this ore type.
The neighbours checked are the 8 nodes horizontally surrounding the decoration base
and the 8 nodes horizontally surrounding the ground node below the decoration
Adds list-rings, a method to implement item sending between inventories via shift-click.
Nice insider feature: a ring consisting of a single inventory list serves as nice clean-up method.
Also adds them to minimal game, and the standard inventory.
Craft output slots are not supported.
This adds the ability to grab 'slices' of noise calculated by PerlinNoiseMap.
Retrieving smaller slices of noise from the computation result as needed
optimizes memory usage while maintaining a reasonable amount of CPU overhead.
NodeResolver name lists now belong to the NodeResolver object instead of
the associated NodeDefManager. In addition to minimizing unnecessary
abstraction and overhead, this move permits NodeResolvers to look up nodes
that they had previously set pending for resolution. So far, this
functionality has been used in the case of schematics for
serialization/deserialization.
- General code cleanup
- Unified object creation and loading
- Specifying objects in APIs is now orthogonal (i.e. anything can take an ID,
name string, or the raw table definition (and automatically registers if present
Just Markdown, no variant of it. File name intentionally
not changed to “lua_api.md” because of fear to break references
to that file. The file can still be renamed later.
Changes:
* Add extra documentation for remove_item.
This isn't as silly as it sounds: iterate a list containing items with
unique metadata each, and remove_item the first one you find, placing
into a different - fine, except the remove will invariably remove the
wrong one, leading to items being duplicated and others destroyed.
Arguably it's a bug, and Inventory::removeItem should actually remove
the item you tell it to. (i.e. if the passed ItemStack has metadata,
match it). But it seems reasonable to just document the behaviour
more clearly.
* Improve string_to_pos documentation.
* Clarify dig_node documentation (return value).
* Better on_step documentation.
* get_nodemeta -> get_meta.
* Other minor fixes.
See: https://github.com/minetest/minetest/issues/1525
Background
Wuzzy2: If you attempt to spawn a L-system tree with minetest.spawn_tree, you can make Minetest crash if it is attempted to pop an empty stack.
ShadowNinja: This shouldn't cause a segmentation fault, but it should throw a Lua error
Commit Description
This commit throws a Lua error instead of causing a segmentation fault. The server will still "crash" but will include a Lua backtrace.
L-Systems fix randomness
Unless a random seed is provided (via Lua treedef) seed the PRNG with a different seed for each tree
Resolves: https://github.com/minetest/minetest/issues/1469
Fix l-system crash when treedef random_level not set by Lua
Config settings:
profiling = true/false (gather statistics)
detailed_profiling = true/false (break mod times to callbacks)
Chat commands:
save_mod_profile saves current statistics in debug.txt and shows on console (on default loglevel)
Add DPI support for statbar
Move heart+bubble bar to Lua HUD
Add statbar size (based upon an idea by blue42u)
Add support for customizing breath and statbar
Don't use TOSERVER_RECEIVED_MEDIA but TOSERVER_CLIENT_READY as indicatio for client ready
Handle clients with protocol version < 23 (almost) same way as before
Make client tell server about it's version
Add client state to not send bogus player position updates prior init complete
Add access to statistics information (peer connction time,rtt,version)
Fix clients standing stalled in world while preloading item visuals (new clients only)
Add get_player_information to read client specific information from lua
On the lua side, notably minetest.env:<function>(<args>) should now
be replaced by minetest.<function>(<args>).
The old way is and will stay supported for a long time.
Also:
Update and clean up lua_api.txt (by celeron55)
Move EnvRef to lua and remove add_rat and add_firefly (by kahrl)
Add separate src/util/CMakeLists.txt, other minor fixes (by kahrl)
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
Scripts can call minetest.register_on_shutdown() to register a
shutdown hook.
Document that minetest.register_on_shutdown() callbacks may not be run
If the server crashes, it is unlikely that callbacks registered using
minetest.register_on_shutdown() will be called.
Correct lua api version number
Always update animations and attachments after the entity is added to scene client side. Fixes animations not being applied in client initialization for some reason. Attachments should be re-tested now just to be safe.
Fix a segmentation fault caused by reaching materials that didn't exist in a loop for setting texture
No longer hide players who are dead. With models, a death animation should be used instead
Some changes requested by celeron55
Rename a lot of things in the code, and use better lua api function names
Minor code corrections
Bump protocol version up, since the models / animations / attachments code creates new client<->server messages
Fix the last segmentation fault (apparently). So far attachments seem to be fully functional, although removing the parent causes children to go to origin 0,0,0 and possibly still cause such a fault (though this should already be addressed)
Fix a bug in falling code where entities get stuck
Also check if the parent has been removed server-side, and detach the child if so. Fixes children going to origin 0,0,0 when their parent is removed.
Unset all attachment properties when permanently detaching (on both the client and server). Also store less data we don't need
Create a separate function for detaching, and also update lua api documentation
When a child is detached, update its position from the server to clients. This WILL cause it to get positioned slightly differently client side, as the server attachment system only copies parent origin and knows not about mesh / bone transformation. This prevents different clients seeing the object detached in different spots which is most correct
Update the position of attached players to clients. An attached player will see himself move, but this is currently VERY ugly and laggy as it is done by the server (it probably must stay this way too)
Use a different approach for locally attached players. This allows for smooth positio transitions to work, as well at the player turning around freely. Still buggy however
New object property which allows changing the color and alpha of mesh materials. Due to the current lighting systems it doesn't work yet, but the full implementation is there
Framework for the attachment system, with no actual functionality yet
Send bone and player object to the setAttachment function in content_sao.cpp, but we need a way to translate it there and send it to the client
I will also want position and rotation offsets to be possible to apply to attachments
Network object ID from server to client. This will be used to identify the parent client-side and know what to attach to
Support for animation blending, though for some reason it doesn't work.
Don't enable animation transitions by default for many reaosons
Object property to store individual bone positions. LUA can specify a bone name followed by a bone position. No functionality yet. Bone rotation to be added in the following commit
Same system for bone rotation, plus a few other things I missed