Commit Graph

7951 Commits

Author SHA1 Message Date
DS
9d09c87f13 Make autoforward simulate the 'up' key (#8249) 2019-05-21 19:50:00 +01:00
ANAND ツ
a90f2efb12 Check for out-of-bounds breath when setting breath_max (#8493) 2019-05-21 19:37:58 +02:00
Paul Ouellette
920bd3b16f Fix API site build (#8551) 2019-05-21 19:37:10 +02:00
SmallJoker
cfef466d4e l_mapgen.cpp: Fix LINT broken since b1b40fe 2019-05-21 19:16:01 +02:00
HybridDog
12e3d3d12f Prioritise craft recipes
When multiple recipes are applicable, the recipes are prioritised in this order:
toolrepair < shapeless with groups < shapeless < shaped with groups < shaped
For cooking and fuel, items are prioritised over item groups
2019-05-20 20:59:51 +02:00
HybridDog
1604b949fd Test crafting hash type only once for a recipe 2019-05-20 20:59:36 +02:00
Paramat
b1b40fef16
Allow multiple cave liquids in a biome definition (#8481)
This allows games to specify biome cave liquids and avoid the old
hardcoded behaviour, but preserves the ability to have multiple
cave liquids in one biome, such as lava and water.

When multiple cave liquids are defined by the biome definition,
make each entire cave use a randomly chosen liquid, instead of
every small cave segment using a randomly chosen liquid.

Plus an optimisation:
Don't place nodes if cave liquid is defined as 'air'
2019-05-18 21:13:14 +01:00
Carles Pastor Badosa
6cb6aea969 Add content_rating tag to appdata (#8538)
This tag allows software stores (KDE discover, etc) to filter and know whether applications are suitable for young users.
2019-05-18 17:19:56 +02:00
Jozef Behran
eb2bda7d0b Optimize string (mis)handling (#8128)
* Optimize statbar drawing

The texture name of the statbar is a string passed by value.
That slows down the client and creates litter in the heap
as the content of the string is allocated there. Convert the
offending parameter to a const reference to avoid the
performance hit.

* Optimize texture cache

There is an unnecessary temporary created when the texture
path is being generated. This slows down the cache each time
a new texture is encountered and it needs to be loaded into
the cache. Additionally, the heap litter created by this
unnecessary temporary is particularly troublesome here as
the following code then piles another string (the resulting
full path of the texture) on top of it, followed by the
texture itself, which both are quite long term objects as
they are subsequently inserted into the cache where they can
remain for quite a while (especially if the texture turns
out to be a common one like dirt, grass or stone).

Use std::string.append to get rid of the temporary which
solves both issues (speed and heap fragmentation).

* Optimize animations in client

Each time an animated node is updated, an unnecessary copy of
the texture name is created, littering the heap with lots of
fragments. This can be specifically troublesome when looking
at oceans or large lava lakes as both of these nodes are
usually animated (the lava animation is pretty visible).
Convert the parameter of GenericCAO::updateTextures to a
const reference to get rid of the unnecessary copy.

There is a comment stating "std::string copy is mandatory as
mod can be a class member and there is a swap on those class
members ... do NOT pass by reference", reinforcing the
belief that the unnecessary copy is in fact necessary.
However one of the first things the code of the method does
is to assign the parameter to its class member, creating
another copy. By rearranging the code a little bit this
"another copy" can then be used by the subsequent code,
getting rid of the need to pass the parameter by value and
thus saving that copying effort.

* Optimize chat console history handling

The GUIChatConsole::replaceAndAddToHistory was getting the
line to work on by value which turns out to be unnecessary.
Get rid of that unnecessary copy by converting the parameter
to a const reference.

* Optimize gui texture setting

The code used to set the texture for GUI components was
getting the name of the texture by value, creating
unnecessary performance bottleneck for mods/games with
heavily textured GUIs. Get rid of the bottleneck by passing
the texture name as a const reference.

* Optimize sound playing code in GUIEngine

The GUIEngine's code receives the specification of the sound
to be played by value, which turns out to be most likely a
mistake as the underlying sound manager interface receives
the same thing by reference. Convert the offending parameter
to a const reference to get rid of the rather bulky copying
effort and the associated performance hit.

* Silence CLANG TIDY warnings for unit tests

Change "std::string" to "const std::string &" to avoid an
unnecessary local value copy, silencing the CLANG TIDY
process.

* Optimize formspec handling

The "formspec prepend" parameter was passed to the formspec
handling code by value, creating unnecessary copy of
std::string and slowing down the game if mods add things like
textured backgrounds for the player inventory and/or other
forms. Get rid of that performance bottleneck by converting
the parameter to a const reference.

* Optimize hotbar image handling

The code that sets the background images for the hotbar is
getting the name of the image by value, creating an
unnecessary std::string copying effort. Fix that by
converting the relevant parameters to const references.

* Optimize inventory deserialization

The inventory manager deserialization code gets the
serialized version of the inventory by value, slowing the
server and the client down when there are inventory updates.
This can get particularly troublesome with pipeworks which
adds nodes that can mess around with inventories
automatically or with mods that have mobs with inventories
that actively use them.

* Optimize texture scaling cache

There is an io::path parameter passed by value in the
procedure used to add images converted from textures,
leading to slowdown when the image is not yet created and
the conversion is thus needed. The performance hit is
quite significant as io::path is similar to std::string
so convert the parameter to a const reference to get rid of
it.

* Optimize translation file loader

Use "std::string::append" when calculating the final index
for the translation table to avoid unnecessary temporary
strings. This speeds the translation file loader up
significantly as std::string uses heap allocation which
tends to be rather slow. Additionally, the heap is no
longer being littered by these unnecessary string
temporaries, increasing performance of code that gets
executed after the translation file loader finishes.

* Optimize server map saving

When the directory structure for the world data is created
during server map saving, an unnecessary value passing of
the directory name slows things down. Remove that overhead
by converting the offending parameter to a const reference.
2019-05-18 17:19:13 +02:00
ANAND ︻气デ═一
568694122c Revert "Inventory: Make addItem for empty ItemStacks respect max stack size" (#8519)
Revert commit e6a9e60
2019-05-12 18:07:15 +01:00
ANAND ︻气デ═一
06a749c386 Move HTTP request logging to infostream (#8526) 2019-05-12 17:55:14 +01:00
ANAND ︻气デ═一
8e3b63bd28 Define operators == and != for ItemStack 2019-05-11 18:48:27 +02:00
ANAND
72feab081c builtin/../register.lua: Abort make_wrap_deregistration if param is invalid 2019-05-04 12:56:19 +02:00
ANAND
96f250ed8f minimal: Fix crash due to assertion fail 2019-05-03 14:44:05 +02:00
ANAND
e32a630937 Better document behavior of on_punchplayer
Esp. the fact that it's invoked even if the punched player is dead
2019-04-29 14:08:34 +02:00
ANAND
c4578aefe7 PlayerSAO::setHP - Don't call on_hpchange callbacks if HP hasn't changed 2019-04-29 14:08:34 +02:00
Paramat
ad8d68c06a
Remove unnecessary CSM warning (#8485) 2019-04-28 00:44:26 +01:00
sofar
b839a6dd54 Force send a mapblock to a player (#8140)
* Force send a mapblock to a player.

Send a single mapblock to a specific remote player.

This is badly needed for mods and games where players are teleported
into terrain which may be not generated, loaded, or modified
significantly since the last player visit.

In all these cases, the player currently ends up in void, air, or
inside blocks which not only looks bad, but has the effect that the
player might end up falling and then the server needs to correct for
the player position again later, which is a hack.

The best solution is to send at least the single mapblock that the
player will be teleported to. I've tested this with ITB which does this
all the time, and I can see it functioning as expected (it even shows
a half loaded entry hallway, as the further blocks aren't loaded yet).

The parameter is a blockpos (table of x, y, z), not a regular pos.

The function may return false if the call failed. This is most likely
due to the target position not being generated or emerged yet, or
another internal failure, such as the player not being initialized.

* Always send mapblock on teleport or respawn.

This avoids the need for mods to send a mapblock on teleport or
respawn, since any call to `player:set_pos()` will pass this code.
2019-04-28 00:42:13 +01:00
ANAND
d71e1e0949 Improve readability of debug menu by using '|' (#8488)
* Improve readability of debug menu by using '|'

* Restore whitespace to separate yaw and cardinal direction

Co-Authored-By: ClobberXD <ClobberXD@gmail.com>
2019-04-27 12:45:44 +02:00
ANAND
d0f0ceaf66 Range-limit value passed to PlayerSAO::set{HP|Breath} (#8264) 2019-04-27 12:45:20 +02:00
Muhammad Rifqi Priyo Susanto
695d9edcd4 Use player as starting point instead of camera when pointing node (#8261)
Same pointing area on both camera modes.
This fix is inapplicable for non-crosshair input.
2019-04-27 12:44:56 +02:00
SmallJoker
f409f44765 Correct the checkbox selection box position (#8246)
Remove m_btn_height dependency, replace with the text and checkbox size.
2019-04-27 00:56:31 +01:00
ANAND
66ecfb5916 CMakeLists.txt: Remove references to Minecraft and Infiniminer (#8487) 2019-04-26 19:07:32 +02:00
stujones11
cff1e9ca27 Android: Clear chat open flag on cancel or completion (#8478) 2019-04-19 12:06:47 +02:00
paramat
38b94f248a Attend to review, re-arrange blank lines, update lua_api.txt 2019-04-14 22:21:51 +01:00
Pedro Gimeno
12a63021d0 Fix regression in automatic_face_movement_max_rotation_per_sec
Values <= 0 should make the yaw change instant. This worked in 0.4.16 but was broken in 089f59458286.

Per bug report by oil_boi_minetest on IRC.
2019-04-14 22:21:51 +01:00
Jozef Behran
007ce24a11 Various network performance improvements (#8125)
* Optimize packet construction functions

Some of the functions that construct packets in
connection.cpp are using a const reference to get the raw
packet data to package and others use a value passed
parameter to do that. The ones that use the value passed
parameter suffer from performance hit as the rather bulky
packet data gets a temporary copy when the parameter is
passed before it lands at its final destination inside the
newly constructed packet. The unnecessary temporary copy
hurts quite badly as the underlying class (SharedBuffer)
actually allocates the space for the data in the heap.

Fix the performance hit by converting all of these value
passed parameters to const references. I believe that this
is what the author of the relevant code actually intended
to do as there is a couple of packet construction helper
functions that already use a const reference to get the
raw data.

* Optimize packet sender thread class

Most of the data sending methods of the packet sender thread
class use a value passed parameter for the packet data to be
sent. This causes the rather bulky data to be allocated on
the heap and copied, slowing the packet sending down. Convert
these parameters to const references to avoid the performance
hit.

* Optimize packet receiver thread class

The packet receiver and processor thread class has many
methods (mostly packet handlers) that receive the packed data
by value. This causes a performance hit that is actually
worse than the one caused by the packet sender methods
because the packet is first handed to the processPacket
method which looks at the packet type stored in the header
and then delegates the actual handling to one of the
handlers. Both, processPacket and all the handlers get the
packet data by value, leading to at least two unnecessary
copies of the data (with malloc and all the slow bells and
whistles of bulky classes).

As there already is a few methods that use a const reference
parameter for the packet data, convert all this value passed
packets to const references.
2019-04-14 21:56:38 +01:00
Paramat
4d2ad7c2b2
World start time: Move to first full light (day night ratio = 1000) (#8410)
6125 is the time of first full light according to 'get_node_light()',
and the time of first full light visually when basic shaders are on.
This is the optimum default new world start time, taking all possible
games into account.
The previous time assumed a game similar to Minetest Game. Games
should set this setting themselves according to their needs.
2019-04-13 01:46:38 +01:00
Vitaliy
faa419fc8b Add Irrlicht-specific smart pointer (#6814) 2019-04-12 17:27:39 +01:00
Paul Ouellette
bb7afd306a Add Mkdocs API site (#8133)
* Add MkDocs API site
2019-04-12 14:29:29 +02:00
Paul Ouellette
22ad820aa4 Add node field to PlayerHPChangeReason table (#8368) 2019-04-11 20:45:39 +01:00
Paramat
1e5f2e0f13
Nodedef 'drop' documentation: Improve, add tool filtering (#8458) 2019-04-09 03:20:27 +01:00
ANAND
8306f7d2e2 util/hex.h: Remove whitespace-only line (#8460) 2019-04-08 19:40:02 +01:00
Paramat
0cc85a7dc6
daynightratio.h: Improve codestyle, minor optimisations (#8453) 2019-04-08 00:37:52 +01:00
Paramat
a222ff4c02
Android settings: Use 'simple' leaves instead of 'fancy' (#8440)
'Fancy' leaves are intensive to render.
Also remove the unnecessary duplicated setting of 'chunksize'.
2019-04-07 19:20:00 +01:00
Jozef Behran
0c90ab4f6c Optimize random turns in dungeongen (#8129)
It turns out there is no need to return the new value and
preserve the old one in random_turn, the procedure can be
made to modify the value in-place. This saves quite a bunch
of parameter and return value copying.
2019-04-07 19:08:27 +02:00
adrido
25f231a0e0 Find PostgreSQL correctly (#8435) 2019-04-07 18:45:25 +02:00
starling13
1db4ae96b1 util/hex.h: Reserve result space in hex_encode()
Reserve enough space for the result of hex_encode() to eliminate reallocations
2019-04-07 12:01:42 +02:00
ANAND
3deaa7cf57 Add deprecation warnings for ObjectRef:get/set_attribute (#8443) 2019-04-07 12:00:57 +02:00
Paramat
5b8363af00
Stabilise 'day night ratio' to fix object brightness flicker (#8417)
Previously, when basic shaders were enabled, the function
time_to_daynight_ratio() returned values jumping between 149 and 150
between times 4375 and 4625, and values jumping between 999 and 1000
between times 6125 and 6375, (and the corresponding times at sunset)
due to tiny float errors in the interpolation code.

This caused the light level returned by blend_light() to jump between
14 and 15, which became noticeable recently as those light levels were
given different visual brightnesses.

Add early returns to avoid the problematic interpolation, and to
avoid unnecessary running of the loop.
2019-04-04 23:30:10 +01:00
ANAND
d111865890 Change sign of pitch angle in debug menu (#8438)
Co-Authored-By: ClobberXD <ClobberXD@gmail.com>
2019-04-04 22:42:18 +01:00
rubenwardy
4f7674d448 Change pitch fly binding to 'P', add to change keys menu (#8314) 2019-04-03 21:37:30 +01:00
Loic Blot
a4677496f3 Fix comments 2019-03-31 20:49:39 +02:00
Loïc Blot
64bdd4b509 Create ServerThread earlier in the startup process 2019-03-31 20:49:39 +02:00
Loïc Blot
b55fc3d773 mapgen: drop mapgen id from child mapgens.
This id must be owned by the child mapgen and never be set to a misc value by a developer

Also use nullptr in some places
2019-03-31 20:49:39 +02:00
Loïc Blot
b3716a03a6 EmergeManager::initMapgens use FATAL_ERROR if and drop boolean return
We never handle the boolean return, also init twice is a coding error, not a runtime error
2019-03-31 20:49:39 +02:00
HybridDog
ab322fc5aa Use unordered_map instead of map for craft definitions (#8432) 2019-03-31 19:26:17 +02:00
DS
ad75dba87b Optimize core.after in a simple way (#8351) 2019-03-27 21:05:50 +01:00
Paramat
42e1a12714
Require 'waving = 3' in a nodedef to apply the liquid waving shader (#8418)
Makes the liquid waving shader per-nodedef like waving leaves/plants,
instead of being applied to all liquids.
Like the waving leaves/plants shaders, the liquid waving shader can
also be applied to meshes and nodeboxes.

Derived from a PR by t0ny2.
2019-03-27 00:18:43 +00:00
Paramat
5e7662ca16
Dungeons: Do not remove nodes that have 'is_ground_content = false' (#8423)
Like randomwalk caves, preserve nodes that have 'is_ground_content = false',
to avoid dungeons that generate out beyond the edge of a mapchunk destroying
nodes added by mods in 'register_on_generated()'.

Issue discovered by, and original PR by, argyle77.
2019-03-26 03:56:57 +00:00