89 Commits

Author SHA1 Message Date
tenplus1
0d64d63591 Avoid teleporting player if /teleport coords are out-of-range 2016-04-29 00:00:35 +10:00
rubenwardy
21e176b7a0 Builtin: Add basic_privs setting 2016-04-28 07:19:07 +01:00
Auke Kok
447e6d4160 Fix timer initialization.
This fixes the problem that the first timer tick is an
overrun and causes all timers to expire immediately.

replaces #4003
2016-04-21 10:14:59 +01:00
Auke Kok
43673c52ad falling: walk 4 additional diagonally down directions.
This seems very little cost and matches the old behavior more
closely. This will cause some more falling nodes to get added
to falling clusters. With the efficiency of the algorithm, this
really doesn't do much damage.
2016-04-20 06:51:11 +01:00
Auke Kok
eb6aed6f3e Convert nodeupdate to non-recursive
This took me a while to figure out. We no longer visit all 9 block
around and with the touched node, but instead visit adjacent plus
self. We then walk -non- recursively through all neigbors and if
they cause a nodeupdate, we just keep walking until it ends. On
the way back we prune the tail.

I've tested this with 8000+ sand nodes. Video result is here:

  https://youtu.be/liKKgLefhFQ

Took ~ 10 seconds to process and return to normal.
2016-04-11 00:01:28 -04:00
tenplus1
a7311fa0e0 stop falling.lua error
2016-03-27 15:47:01: ERROR[Main]: ServerError: Lua: Runtime error from mod '*builtin*' in callback luaentity_Step(): Node name is not set or is not a string!
2016-03-27 15:47:01: ERROR[Main]: stack traceback:
2016-03-27 15:47:01: ERROR[Main]: 	[C]: in function 'add_node'
2016-03-27 15:47:01: ERROR[Main]: 	/usr/share/minetest/builtin/game/falling.lua:96: in function </usr/share/minetest/builtin/game/falling.lua:43>
2016-03-29 23:56:23 +02:00
Rui
5285fe8c03 Falling: Set acceleration on step again
Commit

65c09a96f41705bb8e75fc5ff4276342be91ed11 "Set acceleration only once in falling node"

has made the acceleration being set only once.
But this has introduced a regression.

Fix #3884.
2016-03-25 15:19:39 +01:00
Auke Kok
d8e01b5a2c Make options local here.
Undoubtably this may cause problems later if unchecked.

```
2016-03-22 21:57:52: WARNING[Server]: Assignment to undeclared global "options" inside a function at .../sofar/git/minetest/bin/../builtin/game/chatcommands.lua:862.
```
2016-03-24 16:52:26 +01:00
paramat
cf1d3f14f6 Builtin/game/falling: Re-add comma removed by recent commit 2016-03-19 18:46:08 +00:00
Rui914
c65b5f3bea Set acceleration only once in falling node 2016-03-19 17:56:46 +00:00
Auke Kok
ac65ce9c1c Introduce "protection_bypass" privilege.
This privilege allows map protection bypassing for server operators
and world moderators.

Initially I had thought that bypassing protection mods would have been
something that could entirely be done inside mods and minetest_game,
but the concept of protection is defined in core, in the code of
core.is_protected().

I don't feel that it would be logical to introduce a protection
concept in core, but not some way around that for server operators
to maintain map parts that need fixing, de-griefing or cleanup.

Others had noticed the same problems, and proposed a patch to
minetest_game. That patch is fine by itself, but it fails to add
protection bypass functionality for digging normal nodes and placing
nodes.

So, instead, we indroduce the new priv "protection_bypass" in core,
and modify 'on_place_node' and 'node_dig' to allow bypassing node
protections if the player holds this priv.

This priv was tested with protector redo by tenplus1.

A followup patch to Minetest Game will include allowing special checks
for doors, trapdoors, chests in Minetest Game.

Protection mods will likely want to mimic the changes in their relevant
code sections.
2016-03-11 21:09:53 +00: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
est31
fd7cbba94b Add minetest.register_lbm() to run code on block load only 2016-03-07 19:54:26 +01:00
Rui914
7a9e8367db Faster insertion into table 2016-03-06 23:42:04 +00: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
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
c1946cc258 Log /clearobjects mode 2016-02-11 04:22:58 +00:00
Kahrl
02cbda530b Add '/clearobjects quick' 2016-02-11 04:22:58 +00:00
Splizard
3f429363a2 Add admin command which says who the administator is for the server. 2016-02-04 13:23:02 +01:00
Auke Kok
b37d266632 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.
2016-01-29 01:04:51 -05:00
RealBadAngel
40ce082cfb Show infotext with description for item entities 2016-01-18 17:21:41 +00:00
paramat
ce609f9e68 Liquids: Flow into and destroy 'floodable' nodes
Add new node property 'floodable', default false
Define "air" as floodable = true in C++ and lua
2016-01-07 05:57:19 +00:00
HybridDog
907dfc9317 Fix missing localization for obj 2015-12-20 16:25:33 +01:00
Alex Ford
3d8a7bc124 Add on_secondary_use when right clicking an item in the air 2015-12-02 02:18:44 +00:00
Robert Zenz
06dcc1cf5e Simplify regex used in check_modname_prefix and other improvements.
Simplified the regex used, added comments and changed the error message
to contain the correct mod name.
2015-11-24 01:49:59 +01:00
Rui
1c53992d19 Log static_spawn error only once 2015-11-21 00:13:28 +01:00
Robert Zenz
5177c073c0 Add the player name to dropped items
The player name is now added in the field "dropped_by" on the created
entity.
2015-11-12 00:47:11 +01:00
kwolekr
897caf3178 Improve LuaVoxelManip documentation 2015-11-07 11:59:24 -05:00
kwolekr
4072700558 Add callback parameter for core.emerge_area() 2015-11-02 18:43:09 -05:00
Rui914
f4e29e66bb minetest. to core. 2015-10-31 02:28:06 +01:00
BlockMen
b966a46591 Check if hitter has inventory when punching item
Fixes #3280
2015-10-25 18:15:31 +01:00
Robert Zenz
b52fd16e28 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")
2015-10-22 19:55:48 +02:00
ShadowNinja
677ab7463d Refactor logging
- 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
2015-10-14 01:03:54 -04:00
Rui
8a77a994bb Localize digprop_err function 2015-10-12 02:05:11 +02:00
Fernando Carmona Varo
a9b58d826c Added minetest.wallmounted_to_dir 2015-10-04 03:19:18 +02:00
est31
2a2707e629 Some map border related fixes
1. Check for entity addition success in spawn_item implementation
2. Check for success in item_drop callback, so that the player
doesn't lose the item if they are outside bounds and try to drop it.
3. When existing player joins game, check that their position is inside
map bounds. If not, set their position to the return value of findSpawnPos().
4. Make findSpawnPos() respect the border

2 fixes a lua crash if a player drops an item outside map bounds.
3 fixes an assertion crash if a player leaves when being outside map bounds,
and then rejoins.
2015-09-29 23:06:15 +02:00
kwolekr
23316c9f92 Add /emergeblocks command and core.emerge_area() Lua API 2015-09-23 15:56:24 -04:00
Rui
394dc38650 Small fixes of minetest.has_feature 2015-09-03 06:10:17 +02:00
Rui
c55c7875b4 Minor tweaks __builtin:falling_node 2015-09-01 19:14:08 +02:00
kwolekr
2fb4917d8e SAPI: Track last executed mod and include in error messages 2015-08-12 23:56:12 -04:00
Marcin
7527fea2ae Add ability to specify coordinates for /spawnentity 2015-07-18 08:35:36 +02:00
Craig Davison
e49c838c0b Remove reference to deprecated privilege 2015-06-14 23:53:30 +02:00
TeTpaAka
14b9820f48 Add minetest.register_on_player_hpchange 2015-06-13 19:40:31 +02:00
HybridDog
d4f46baafa 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
2015-06-06 21:00:38 +02:00
est31
51c32c262f Nicer time setting logging
Now logs

ACTION[ServerThread]: player sets time to 6:03

instead of

ACTION[ServerThread]: player sets time to 6:3
2015-06-02 06:49:05 +02:00
LeMagnesium
6aecfb8151 Added hour:minute format to time command
* The time command now accepts parameters in the form <hour>:<minute>,
    and if invoked with no parameters returns the current time in said format.
2015-05-16 18:15:34 -04:00
Brandon
aeaeed77e7 Add minetest.register_on_punchplayer 2015-05-15 11:09:55 +02:00
tenplus1
7f61ce3ca2 Don't crash if an item gets dropped into unloaded space
Items dropped into unloaded map space will crash game so here's a fix...
2015-05-15 00:15:25 +02:00
est31
d3d4f0e78e Item entity merging refactor
Don't ident too much, and add a comment.
2015-05-15 00:06:18 +02:00