Commit Graph

5558 Commits

Author SHA1 Message Date
Beha
b8aaef704d Move the clamping of hp/breath when their maximums change to read_object_properties(). (#8689)
This prevents set_properties() calls that have nothing to do with hp_max or breath_max overriding the saved hp before another mod has the chance to set a player's intended hp_max (such as in on_joinplayer).
2019-07-30 17:29:45 +02:00
DS-Minetest
115ef6c09c Rename guiScrollBar to GUIScrollBar 2019-07-29 21:45:39 +02:00
SmallJoker
4aa9a669cb
ContentCAO: Fix broken attachments on join (#8701)
What happened:
1) Object data is received. Client begins to read the data
2) Client initializes all its children (gob_cmd_update_infant)
3) Children try to attach to parent (yet not added)
4) Parent initializes, is added to the environment

And somewhere in between, Irrlicht wrecks up the attachments due to the missing matrix node.

The solution here is to:
1) Use the same structure as ServerActiveObject
2) Attach all children after the parent is really initialized
2019-07-29 19:14:07 +02:00
DS-Minetest
705630e7d0 guiScrollBar: move directly to clicked pos if clicked into tray 2019-07-28 21:43:07 +02:00
SmallJoker
8efa1de835 Check for 'action' field in ABMs & LBMs 2019-07-27 21:13:47 +02:00
Paul Ouellette
fe6c666da2 Prefix RecipePriority elements with PRIORITY_ 2019-07-27 14:42:41 +02:00
Paul Ouellette
395b1b3346 Initialize priority in CraftDefinition constructors
The priority is used by getCraftResult, which may be used before
initHash is called.
2019-07-27 14:42:41 +02:00
Pierre-Yves Rollo
c3daf2a8be Fix missing item images clipping in formspecs (#8652)
* Fix clipping of itemimage

* Code style

* More code styling
2019-07-26 19:44:29 +02:00
Paramat
ce87ef397f
Initialise 'seabed_height' to avoid compilation warning (#8715) 2019-07-26 17:51:53 +01:00
Paramat
0cde6fc552
Re-order mapgens in mainmenu and 'all settings' mapgen selection (#8705)
v6 always last to discourage selection.
Special mapgens flat, fractal, singlenode, next to last. Of these, singlenode
last to discourage selection.
Of the remaining, v5 last due to age, v7 first due to being the default.
2019-07-25 20:46:28 +01:00
Paramat
245a31d6b7
Mgfractal: Make non-fractal terrain optional (#8702)
Enabled by default.
Only allow spawn on fractal, not on seabed terrain.
Various codestyle and comment improvements.
2019-07-25 19:58:35 +01:00
y
ecd20de64d Removed debug.upvaluejoin to prevent leak of insecure environment 2019-07-24 11:43:09 +02:00
Paramat
76824bac9f
Document the deprecation of hardcoded cave liquids (#8692) 2019-07-20 01:03:52 +01:00
Lars Hofhansl
9fe3246154 Optimize getting active objects a bit. #8674 2019-07-16 15:55:17 -07:00
Paramat
458f617575
Dungeons: Make multiple large rooms possible (#8678)
Re-add the random size range for large rooms.
Remove 'first_room_large' bool.
Add 'large_room_chance' parameter that can disable large rooms,
specify 1 large room, or specify a chance for large rooms.
If 1 or a chance is specified, the first generated room is large,
to take advantage of the intersection checks that are done for the
1st room only.
2019-07-16 20:39:58 +01:00
Paramat
0c31946943
Move more dungeon parameter selection to mapgens (#8653)
Move 'num_dungeons' to 'DungeonParams'.
Add new parameter 'num_rooms' to replace 'rooms_min' and 'rooms_max',
so that the mapgen has complete control over the number of rooms.
Add new bool 'first_room_large' so that the mapgen chooses this
instead of a hardcoded 1 in 4 chance.
Add new parameter 'room_size_large' to replace 'room_size_large_min'
and 'room_size_large_max', so that the mapgen has complete control
over this.
2019-07-09 20:38:51 +01:00
DS-Minetest
140aeabd87 Do predict when sneak-place to node with on_rightclick 2019-07-08 14:21:27 +02:00
Lars Hofhansl
0971a14a57 Improve ABM time budget handling. #8645 2019-07-07 23:23:00 -07:00
Paramat
bb14b7e956
Dungeongen: Remove most hardcoded dungeon nodes (#8594)
Biome-defined dungeon nodes was added as a feature to MT 5.0.0.
So now remove most of the hardcoded dungeon node code that assumes a
game has stone, sandstone, desert stone, and no other stone types.
If biome-defined dungeon nodes are not found, dungeon nodes fall back
to the 'cobble' mapgen alias if present, if not present they fall back
to biome-defined 'stone'.
Remove now-unnecessary mapgen aliases from MapgenBasic. Non-mgv6 games
now only need to define 3 to 5 mapgen aliases.

Document dungeon parameters.

Make c_lava_source fallback to c_water_source as both are used as cave
liquids.
2019-06-30 22:55:20 +01:00
Vitaliy
93f7e10e0d Optimize and unify mesh processing (#7851) 2019-06-28 03:22:16 +01:00
v-rob
5e7004e7af Add compatible, consistent coordinate system to FormSpecs. (#8524) 2019-06-27 13:40:49 +01:00
ANAND
91d244c522 Increase upper limit of display_gamma to 10 (#8618) 2019-06-27 04:04:12 +01:00
rubenwardy
429a989648 Add support for 9-sliced backgrounds (#8600)
9-slice textures are commonly used in GUIs to allow scaling them to match any resolution without distortion.

https://en.wikipedia.org/wiki/9-slice_scaling
2019-06-22 16:03:54 +02:00
SmallJoker
4e3c1916f7 Fix segfault on quitting with open node formspec (#8608) 2019-06-21 21:00:30 +02:00
Markus Mattes
e3738c2f61 Fix handling of --color and --worldlist command line arguments
They verify the provided value and error if a wrong value got provided
command line description for color was differnt on win32 but  code did not handle any differenc
extended the command line description for world and worldname that it is clear that they only start a local game if used with --go

Fixes #7875
2019-06-21 01:29:35 +01:00
Paramat
5d4850a7ce
Mapgen Carpathian: Add optional rivers (#7977)
Rivers are disabled by default and will not be added to existing worlds.
Rewrite getSpawnLevelAtPoint() to be simpler and more consistent with
generateTerrain().
2019-06-19 01:06:08 +01:00
stujones11
95a37efc31 Android: Use system provided path for default TMPFolder setting (#8505) 2019-06-15 15:12:59 +02:00
SmallJoker
f1f9361bc8 Settings: Disallow space characters entirely
Lua API:
> Setting names can't contain whitespace or any of ="{}#
2019-06-10 18:30:59 +02:00
SmallJoker
e2f8f4da83
Formspecs: Close on metadata removal (#8348)
Formspecs will now close as soon the formspec string in the node metadata turns invalid.
2019-06-10 13:01:07 +02:00
SmallJoker
e40be619f2
Add disable_jump to liquids and ladders (#7688)
Remove second nodedef check by improving the colliding node detection
Also remove the 2nd check in old_move, correct standing node a bit
2019-06-10 13:00:35 +02:00
adrido
bd6f1cca9d Add compatibility to vcpkg buildsystem (#8317) 2019-06-10 02:56:55 +01:00
SmallJoker
a687efa6df
Damage: Play no damage sound when immortal (#8350)
Add isImmortal server-side for proper enable_damage handling
Rework log messages
2019-06-09 11:25:41 +02:00
SmallJoker
cb00632e23
HTTP API: Allow binary downloads and headers (#8573)
Add minetest.features.httpfetch_binary_data
2019-06-06 19:13:29 +02:00
Paramat
7379aa74cf
Dungeons: Settable density noise, move number calculation to mapgens (#8473)
Add user-settable noise parameters for dungeon density to each mapgen,
except V6 which hardcodes this noise parameter.

Move the calculation of number of dungeons generated in a mapchunk out
of dungeongen.cpp and into mapgen code, to allow mapgens to generate
any desired number of dungeons in a mapchunk, instead of being forced
to have number of dungeons determined by a density noise.

This is more flexible and allows mapgens to use dungeon generation to
create custom structures, such as occasional mega-dungeons.
2019-06-01 20:50:43 +01:00
SmallJoker
a1459a9eac Fix persistent ^[brighten after damage again (#5739)
The old texture modifier is restored by passing `m_previous_texture_modifier`.
Either copy it manually or let the function parameter do that.

Victims so far:
8e0b80a Apr 2018
eb2bda7 May 2019
2019-05-26 09:54:26 +02:00
David G
40dadecb6e override.txt: Fix crash due to CRLF endings (#8439) 2019-05-25 18:01:55 +02:00
SmallJoker
627a96cd99 Do not drag-place stack into 'craftpreview' slot (#8514) 2019-05-25 17:41:35 +02:00
stujones11
b917ea4723 Add IGUIScrollbar implementation with variable bar sizes (#8507) 2019-05-24 16:42:05 +01:00
SmallJoker
a2848c9cde Fix forgotten PlayerSAO cast in a90f2ef 2019-05-21 21:37:47 +02:00
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
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
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
c4578aefe7 PlayerSAO::setHP - Don't call on_hpchange callbacks if HP hasn't changed 2019-04-29 14:08:34 +02:00