Commit Graph

34 Commits

Author SHA1 Message Date
sfan5 36adf45697
Move core.get_connected_players() implementation to C++
Keeping the ObjectRefs around in a table isn't ideal and this allows
removing the somewhat nonsensical is_player_connected() added in 86ef7147.
2022-05-21 16:17:30 +02:00
rubenwardy d5c162fb03
Add luacheck to check builtin (#7895) 2022-05-21 16:17:08 +02:00
SmallJoker c08b05bb36
Builtin: Replace deprecated function calls (#7561) 2022-05-21 16:16:09 +02:00
ANAND a66fee83c3
Builtin/../misc.lua: Replace minetest. with core., improve codestyle (#7540) 2022-05-21 16:16:07 +02:00
SmallJoker cb6d408a48
Make the server status message customizable (#7357)
Remove now redundant setting show_statusline_on_connect
Improve documentation of `minetest.get_server_status`
2022-05-21 16:16:07 +02:00
SmallJoker 878458be68
is_area_protected: Rename from intersects_protection (#7073)
* is_area_protected: Rename from intersects_protection
Return first protected position
Clarify docs: Mods may overwrite the function
2022-05-21 16:15:51 +02:00
HybridDog f28fb6ff6b
Add minetest.is_player (#7013)
* Add minetest.is_player

* First use for is_player
2022-05-21 16:15:45 +02:00
paramat 318484fcaf
Intersects_protection(): Move from Minetest Game to builtin (#6952)
A useful function that applies 'core.is_protected()' to a 3D lattice of
points evenly spaced throughout a defined volume, with a parameter for
the maximum spacing of points.
2022-05-21 16:15:42 +02:00
red-001 5f8c3768b3
Allow the join/leave message to be overridden by mods. 2022-05-21 16:15:19 +02:00
ShadowNinja 5030ce5f4b
Use a settings object for the main settings
This unifies the settings APIs.

This also unifies the sync and async registration APIs, since the async
registration API did not support adding non-functions to the API table.
2022-05-21 16:14:45 +02:00
Loïc Blot bed4f29a19
Implement delayed server shutdown with cancelation (#4664) 2022-05-21 16:14:40 +02:00
red-001 d210b6d2cf
Give CSM access to use `core.colorize()` (#5113) 2022-05-21 16:14:30 +02:00
Loïc Blot b38c00d90f
sound_play & sound_stop support + client_lua_api doc (#5096)
* squashed: CSM: Implement register_globalstep
  * Re-use fatal error mechanism from server to disconnect client on CSM error
  * Little client functions cleanups

* squashed: CSM: add core.after function
  * core.after is shared code between client & server
  * ModApiUtil get_us_time feature enabled for client
2022-05-21 16:14:27 +02:00
rubenwardy 14a4e9994c
Add minetest.player_exists() (#5064) 2022-05-21 16:14:16 +02:00
red-001 0299519ca9
Don't send a join message in singleplayer mode. 2022-05-21 16:14:04 +02:00
orwell96 9c764263a7
Make supplying empty formspec strings close the formspec (#4737)
This will only happen if the formname matches or if formname is "".
2022-05-21 16:14:03 +02:00
Rui 1344513303
Fix typo in core.after (#4560) 2022-05-21 16:13:52 +02:00
Xunto bf33a189da
Move on join and on leave messages to lua (#4460) 2022-05-21 16:13:47 +02:00
Tim d03f226194
Builtin: Fix check for a player object in core.check_player_privs
core.check_player_privs accepts as first argument a name or player object, but just tested for a string.
This caused crashes inside builtin, when being passed any unexpected types.

This provides a better (duck-typing like) test, better error reporting.
2022-05-21 16:13:44 +02:00
Nathanaël Courant 4c2af14cef
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.
2022-05-21 16:13:41 +02:00
TriBlade9 4108d1bd6b
Colored chat working as expected for both freetype and non-freetype builds. @nerzhul improvements * Add unit tests * Fix coding style * move guiChatConsole.hpp to client/ 2022-05-21 16:13:41 +02:00
Auke Kok 807cec58aa
Fix timer initialization.
This fixes the problem that the first timer tick is an
overrun and causes all timers to expire immediately.

replaces #4003
2022-05-21 16:13:33 +02:00
Rui914 32752d2bc5
Faster insertion into table 2022-05-21 16:13:23 +02:00
Jeija d0a7fe455e
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.
2022-05-21 16:13:20 +02:00
Auke Kok 3cef28e731
New timer design.
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.
2022-05-21 16:13:14 +02:00
Robert Zenz 9ad5562efb
Add more ways to pass data to check_player_privs
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")
2022-05-21 16:12:55 +02:00
kwolekr 37a94ffa9d
Add /emergeblocks command and core.emerge_area() Lua API 2022-05-21 16:12:52 +02:00
kwolekr 3120d9e8e2
SAPI: Track last executed mod and include in error messages 2022-05-21 16:12:46 +02:00
HybridDog 80e032e167
Decrease minetest.after globalstep lag
* abort if theres no active timer
* only reduce the timer.time of all timers when its necessary
* move updating timers_to_add into a seperate function
2022-05-21 16:12:35 +02:00
Nathanaël Courant 2f8a628334
Add code to support raillike group names 2022-05-21 16:12:31 +02:00
kwolekr 5d9c758b13
Simplify deleteblocks chat command argument parsing
Add optional core.pos_to_string decimal place rounding
Move core.string_to_pos to builtin/common/misc_helpers.lua for consistency
2022-05-21 16:12:17 +02:00
Zefram e5c4318f4e
Fix indexing error in timer processing 2022-05-21 16:11:53 +02:00
ShadowNinja 37c32c715f
Use "core" namespace internally 2022-05-21 16:11:41 +02:00
ShadowNinja 148b74312e
Organize builtin into subdirectories 2022-05-21 16:11:40 +02:00