Commit Graph

8675 Commits

Author SHA1 Message Date
ANAND
75d44ef1e8 lua_api.txt: Add link to Minetest Modding Book (#8826) 2019-08-20 21:15:12 +02:00
SmallJoker
b8131c3415 remove_detached_inventory: Fix segfault during mod load 2019-08-20 19:42:21 +02:00
ANAND
fb6f1fdcbe Don't send position update packet if player is dead 2019-08-20 18:49:06 +02:00
ANAND
3c395d908f Disable autoforward if player is dead 2019-08-20 18:48:28 +02:00
theviper121
ded5da7800 Restore intended functionality to minimap markers (#8819) 2019-08-19 19:18:11 +02:00
Unknown
dea5a152b2 Find LuaJIT headers on vcpkg
luajit headers were moved into a subdirectory to avoid conflicts with plain lua
2019-08-18 18:25:00 +02:00
SmallJoker
d73e458db6
ClientInterface: Use recursive mutex to prevent freeze in on_newplayer() (#8808) 2019-08-17 13:27:28 +02:00
sfan5
13b22e2afb Remove unused function in ReliablePacketBuffer 2019-08-16 20:03:53 +02:00
sfan5
428a4c86e3 Minor refactor of IncomingSplitBuffer 2019-08-16 20:03:53 +02:00
sfan5
fc2f55d931 Drop m_list_size from ReliablePacketBuffer
It's not required and, worse, can lead to bugs.
2019-08-16 20:03:53 +02:00
Paramat
d7c10b66d3
Mapgen v6: Fix mudflow iteration and iterate twice (#8795)
In MapgenV6::flowMud(), the previous implementation of coordinate
inversion caused the 2 inverted mudflow iterations (out of the 3
iterations) to not loop over the area, so only 1 non-inverted
iteration occurred.

Fix this bug but only iterate mudflow twice, as mapgen v6 has only
had 1 iteration for many years. There is now a good balance of 1
non-inverted iteration and 1 inverted iteration.
2019-08-15 20:32:28 +01:00
sfan5
2db0e93f73 network: Stricter handling of split packets 2019-08-15 20:15:22 +02:00
sfan5
c4491165da network: Fix crash in ReliablePacketBuffer on mismatching packets
In the error condition the exception would be thrown before m_list_size
is decremented, causing a nullptr dereference in e.g. popFirst().
2019-08-15 19:18:54 +02:00
DS
082066e813 Fix undeclared global warning because of _ (#8798) 2019-08-14 23:35:47 +02:00
upsilon
b2065756cf Add function minetest.read_schematic 2019-08-14 13:15:41 +02:00
Jozef Behran
bf22184d6e Fix unnecessary exception use in 3 more methods (#8791)
* Fix unnecessary exception use in Server::SendBlocks

The code in this method calls getBlockNoCreate and then
messes around with try...catch to skip blocks which are not
in the memory. Additionally, it repeatedly calls
m_env.getMap() inside this loop. Speed the code up by
extracting the m_env.getMap() out of the loop and getting
rid of the try...catch.

* Fix unnecessary exception use in Server::SendBlock

Another unnecessary try...catch is slowing down
Server::SendBlock. Remove that to speed it up and get a nice
side effect of simplifying the code in question.

* Fix unnecessary exception use in MMVManip::initialEmerge

Remove another unneeded exception usage from
MMVManip::initialEmerge to speed that code up and simplify
it but be careful to not remove the braces as there is a
TimeTaker in use there.
2019-08-13 20:02:50 +02:00
Jozef Behran
72b7a957af Fix unnecessary exception use in Map::getSectorXXX (#8792)
The Map::getSectorNoGenerate throws an exception but no other
code is really dependent on that. Fix the odd instance of
misuse in ClientMap::emergeSector and remove the exception
throwing version of the method along with the "NoEx" suffixes
in the names of these methods.
2019-08-13 19:58:27 +02:00
SmallJoker
539f016c1b
Better F6 profiler (#8750)
Update the profiler names to make more sense of what they actually represent
Move the profiler code from header to its source file
Use monospace font to align lines
Format the statistics line to align better with surrounding values
Refresh the profiler each 3 seconds (roughly)
2019-08-13 19:56:55 +02:00
Jozef Behran
e9ceead81d Fix unnecessary exception use in Map::isNodeUnderground
The isNodeUnderground calls getBlockNoCreate which calls
getBlockNoCreateNoEx and throws InvalidPositionException
if the returned value is nullptr, which isNodeUnderground
then catches to return "false". Remove the try..catch in
isNodeUnderground by calling getBlockNoCreateNoEx instead
of getBlockNoCreate and checking the returned value for
nullptr.
2019-08-13 19:40:59 +02:00
Jozef Behran
833e60d8d2 Fix compare between pointer and 0 in unittests
Pointers shall be set to nullptr, not 0, according to the
coding standards. By implication they shall be compared with
nullptr, not 0, too. Fix this code to match that.
2019-08-13 14:44:32 +02:00
Beha
2f879e8bbd Clear old item groups when they are overridden. (#8753)
This fixes overridden items keeping their old groups in the group to
items mapping even after their groups have been changed in lua.
It also prevents a more widespread issue where overriding an item
will add its content ID *twice* to the mapping, resulting in odd
behaviour in features such as ABMs.
2019-08-12 19:18:52 +02:00
rubenwardy
91114b562f Add support for set_formspec_prepend in main menu (#8611) 2019-08-12 19:16:35 +02:00
Rogier
a067d40454 Handle multiple deserialization of a block's entities
This fix consists of two parts:
- Clear the list of stored entities. This has no side-effects.
- Catch the case where active entities exist and print a message.
  Clearing the active entitiy list has side-effects that should
  be handled. (those entities are known to the environment and
  to clients).

  As avoiding those side-effects is more complex, and as this
  problem is not expected to occur (with PR #4847 merged), there
  is no real incentive to implement this ATM.

This issue was a contributing factor to bug #4217. With the other
contributing factor removed (PR #4847), this commit makes sure this
factor does not go unnoticed if it ever happens again.
2019-08-12 19:14:07 +02:00
hannesa2
33fdd48a76 Update Gradle to 5.5.1 (#8771) 2019-08-12 18:59:53 +02:00
Jozef Behran
49f1006183 Fix breakage of non-GLES2 setups (#8774)
The commit 526a9e4b66abaf83eb6b1aaa3e93375acd87b830 breaks
the non-GLES2 setups because the code that is intended to
handle that is behind "elseif()" which is interpreted as
"elseif(false)" and thus the code never gets executed. Fix
that by changing the offending line to else().

Additionally, to avoid breaking the server only build
(which shall not have a dependency on GL/GLU/GLES at all),
enclose the entire block code in if(BUILD_CLIENT).
2019-08-10 23:32:46 +02:00
Paul Ouellette
120155f312 Fix some issues with minetest.clear_craft (#8712)
* Fix some issues with minetest.clear_craft

- Fix memory leak
- Fix crafts with an output count not being cleared when clearing by
  input.
- Fix recipe list being reversed when clearing by input.

* Add CraftInput::empty()
2019-08-10 23:28:00 +02:00
Jozef Behran
86d7f84b89 Merge pull request #8776 from osjc/FixGetNode
Finish getNode cleanup
2019-08-10 19:45:44 +02:00
sfan5
291e7730cf Add player knockback on punch to builtin 2019-08-10 19:44:27 +02:00
sfan5
cf64054390 Implement adding velocity to player from Lua
The intended usecase is knockback, but there's potential for more.
2019-08-10 19:44:27 +02:00
SmallJoker
b19400aa74 Builtin UI: Move box element to ensure correct draw order 2019-08-08 19:33:43 +02:00
ANAND
d1c27c7e80 Allow customizing chat message format (#8529) 2019-08-08 17:04:46 +01:00
ANAND
cc610c74a7 guiVolumeChange: Fix child not being removed 2019-08-08 18:03:35 +02:00
Paramat
37923920a0
Avoid crash caused by, and improve, 'findSpawnPos()' (#8728)
Avoid an unsuitable spawn position (which if outside mapgen limits can
cause a crash) if the main 0-3999 loop reaches its end. Fallback to a
spawn at 0,0,0.
Check the mapgen-returned 'spawn_level' value for being outside limits.
When 'air_count' reaches 2, move back down 1 to spawn in the lower
empty node.
If the spawn position is disallowed by 'objectpos_over_limit()', 'break'
from loop instead of 'continue' because positions above are probably
also over limit.
Reset 'air_count' to 0 if an obstruction is found, to make 'air_count'
consecutive empty nodes.
Allow spawn in 'airlike' drawtype nodes such as mod-added vacuum,
alien atmospheres, fog etc.
Add clarifying comments and improve codestyle.
2019-08-07 22:07:51 +01:00
SmallJoker
0c533dc436 Game: Fix double BS multiplication 2019-08-07 21:23:01 +02:00
Beha
8ffe95913b Fix usage of wrong variable in builtin chat command handling (#8762)
This was introduced in commit 8e75785 and resulted in chat commands not
returning their output text.
2019-08-07 19:32:40 +01:00
ANAND
e788ee283f Client::Interact: Use InteractAction enum instead of numeric constants
This replaces the magic numbers used as interaction modes both client-side and server-side, primarily for the sake of ease-of-readability.
2019-08-07 19:21:14 +02:00
SmallJoker
e462a9a5ef
Unify wield item handling (#8677)
This moves the wield item functions to Player and the tool utils for range calculation
Also 'local_inventory' was removed due to redundancy in Client
2019-08-07 19:16:31 +02:00
ANAND
003af74213 guiConfirmRegistration: Set focus to text field (#8761) 2019-08-07 19:15:46 +02:00
ANAND
fa6bc699bc Hide chat when console is open (#8656) 2019-08-07 19:15:33 +02:00
DS
1cef09ff10 Fix inventory_overlay for nodes without inventory_image (#8433) 2019-08-07 12:07:30 +02:00
sfan5
19426387d4 Optimize usage of TOSERVER_GOTBLOCKS packet 2019-08-07 11:32:16 +02:00
Beha
4d7f296717 Do not add group values of zero to group lists. (#8751)
This fixes an issue where when the engine looked up groups (for example,
in ABM node names), NodeDefManager's m_group_to_items would contain nodes
with a group value of zero, resulting in nodes with flammable = 0 being
burned by a fire mod with a group:flammable checking ABM.

It brings consistency to the behaviour described in the api
documentation, where zero and nil groups should be the same.
2019-08-07 10:48:04 +02:00
SmallJoker
233cb86e86
Clean up and fix freetype=false crashes (#8641)
A IGUIFont of type bitmap/vector cannot be converted to CGUITTFont
Fixes various segfaults in gameplay
Shorter font cache code, cleaned up (?)
2019-08-06 21:33:13 +02:00
rubenwardy
8e757859d6
Add luacheck to check builtin (#7895) 2019-08-06 19:30:18 +01:00
Paramat
8da35c22d1
Mapgen Flat: Fix and improve getSpawnLevelAtPoint() (#8756)
Previously, this wrongly returned ground level (a position containing
a solid node) as spawn level.
Return ground level + 2 (+ 2 to spawn above biome 'dust' nodes).
Improve codestyle and make more consistent with generateTerrain().
2019-08-06 02:30:28 +01:00
sfan5
ac856b20bf Update curl dependency in buildbot 2019-08-05 22:48:13 +02:00
sfan5
800fa2d8e7 Fix binary-string confusion in client network code 2019-08-04 20:40:35 +02:00
sfan5
d0246cfdcc Clean up FindOpenGLES2.cmake 2019-08-04 16:12:52 +02:00
sfan5
6c2ded4cac Unify GLES support in gui scaling filter 2019-08-04 16:12:52 +02:00
sfan5
ca363d3ef8 Unify OpenGL ES support 2019-08-04 16:12:52 +02:00