Commit Graph

5000 Commits

Author SHA1 Message Date
SmallJoker edbc533414 Customizeable max breath for players (#6411)
* Customizeable maximal breath for players
2017-09-15 12:18:47 +02:00
paramat 7640749d68 Cavegen: Avoid unsupported biome 'top' or 'filler' nodes
For 3D noise tunnels only, replace unsupported biome 'top' and 'filler'
nodes in tunnel roof with the defined biome 'stone'.
This makes terrain created by 3D noise tunnels consistent with the rest
of mapgen, which does exactly the same in this situation.
2017-09-14 04:13:47 +01:00
Rob Blanckaert a9d43a0471 Object properties: Add 'glow', disables light's effect if negative
The 'glow' value is added to the ambient light value.
Negative 'glow' disables light's effect on object colour, for faking
self-lighting, UI-style entities, or programmatic colouring in mods.
2017-09-14 04:06:05 +01:00
SmallJoker 5e141ac920 Network: Fix logging into older worlds with base64 hashes 2017-09-12 20:26:03 +02:00
SmallJoker ee9a442ecc Network: Remove large parts of deprecated legacy code (#6404)
Also remove the setting 'send_pre_v25_init'
Keep old enum entries for obsolete commands
2017-09-12 19:48:09 +02:00
sfan5 7f2a19da11 Fix failing linter (travis) 2017-09-12 19:35:31 +02:00
Kahrl 17fd5fe935 Make INodeDefManager::getIds return a vector, not a set 2017-09-12 19:31:46 +02:00
Auke Kok 5b3fbf9cf7 Implement client node dig prediction
Dig prediction allows clients to remove dug nodes without
waiting for server acknowledgement.
This patch allows mods to override dig prediction,
it can either be turned off or a different "prediction node"
can be selected.
2017-09-11 20:54:20 +02:00
SmallJoker 5f489efc69 Object properties: Fix loss of custom selectionbox
Only adjust it to the collisionbox value when the collisionbox was really set.
2017-09-10 20:26:03 +02:00
rubenwardy 829bbafb27 Fix incorrect buffer size calculation on creation of HUD status messages
Fixes #6400
2017-09-10 02:53:23 +01:00
paramat 51002b1629 Schematic decorations: Add 'place_offset_y' placement parameter
For precise control of schematic vertical position relative to the
'place_on' node.
Avoids workarounds that add empty nodes to a schematic and therefore
reduce performance.

Also remove long-unused decoration cutoff code.
2017-09-10 01:31:30 +01:00
rubenwardy 557bbc6704 Fix empty legacy meta being persisted 2017-09-10 01:30:42 +01:00
SmallJoker 745a90dc84 Server: Calculate maximal total block sends dynamically (#6393)
The block sends per client is 1/2 when reaching the maximal player count.
2017-09-09 00:36:48 +02:00
SmallJoker 1105a14bcc Particles: Do not add digging particles for airlike nodes (#6392) 2017-09-08 18:39:24 +02:00
Loic Blot 151c95bb9b
main.cpp: server-only builds should not include client headers 2017-09-07 23:51:06 +02:00
Loic Blot a3c298e1d1
Use a Buffer instead of SharedBuffer in ConnectionCommand
This fixes #6373
2017-09-05 22:14:56 +02:00
Wuzzy f231112cc4 Make HUD status messages translatable (#5795)
* Make HUD status messages translatable

* Make strings in showStatusTextSimple translatable
2017-09-05 21:57:29 +02:00
Rui 87c5a3fb2f Remove DSTACK keybind setting (#6378) 2017-09-05 20:00:36 +02:00
paramat 115f52af86 Network protocol documentation: Add 'can_zoom' to version 36 2017-09-05 00:28:18 +01:00
Loïc Blot 40dd03e328 Implement minetest.register_can_bypass_userlimit (#6369)
* Implement minetest.register_on_userlimit_check

This new callback permits to bypass the max_users parameter with new mods condition, based on player name or IP
Only one mod needs to permit it.

Move core part for builtin privileges checks to builtin
2017-09-04 22:08:59 +02:00
Loïc Blot c05228fa6d Re-apply previous commit with a typo fix 2017-09-04 17:37:08 +02:00
Loïc Blot 31e0f0efe9 Revert "Network: fix a concurrency problem, by re-adding a copy in ConnectionCommand"
This reverts commit 5b04f5e7d2.
2017-09-04 17:28:29 +02:00
Loïc Blot 5b04f5e7d2 Network: fix a concurrency problem, by re-adding a copy in ConnectionCommand 2017-09-04 16:46:03 +02:00
paramat a383eb0eb9 World start time: Add setting for this, default unchanged 2017-09-04 05:10:52 +01:00
you ad9786c44b Add build date to minetest --version and increase readability (#6331) 2017-09-03 22:32:30 +02:00
Paramat 9f6d90aa81 Ores: Add stratum ore (#6352)
Creates a single undulating ore stratum that is continuous across mapchunk
borders and horizontally spans the world.
Due to being continuous is ideal for creating bands of alternative stone
type running through cliffs and mountains, or underground layers.

Add missing documentation of 'ore_param2' parameter.
2017-09-03 22:32:21 +02:00
Dharkael 5bef339388 Use member initialization list instead of the constructor's body (#6371)
* Use member initialization list instead of the constructor's body
2017-09-03 19:33:22 +02:00
Loic Blot eabf04bd34
Network part requires SharedBuffers to be pass as value
This can trigger unreproductible crashes due to concurrency problem on SharedBuffers

This fixes #6354
2017-09-03 19:01:53 +02:00
Vaughan Lapsley 2ac5a45faa Remove 3D noise from getSteps function (#6360) 2017-09-02 18:01:13 +02:00
Rui c0dac4d928 Remove nodeupdate completely (#6358) 2017-09-01 13:40:09 +02:00
sapier bf403b923a Fix animation frame_speed and blend loosing precision due to incorrec… (#6357)
* Fix animation frame_speed and blend loosing precision due to incorrect data type
Add lua function set_animation_frame_speed to update the frame speed without resetting the animation to start
2017-09-01 11:15:12 +02:00
paramat 561a01cc2a Zoom: Move enabling zoom to a new player object property
Default enabled for no change in default behaviour.
Remove 'zoom' privilege.
2017-08-30 19:39:05 +01:00
Loïc Blot bd6b90359c Remove DSTACK support (#6346)
Debugstacks is not useful, we don't really use it, the DebugStack is not pertinent, gdb and lldb are better if we really want to debug.
2017-08-30 08:09:41 +02:00
Loïc Blot 1d4a2a6ea7 Network proto handlers/container fixes (#6334)
* Fix HP transport + some double <-> float problems

TOCLIENT_HP transport u16 hp as a u8, use u16 HP, this prevent HP over 255 to overflow across network

* Fix more double/float problem in serverpackethandler & remove implicit struct type for TileAnimationParams

* Fix connection unittests container
2017-08-29 20:37:54 +02:00
Loic Blot 35a4082727
Pushing typo fix introduced in b7ee608e70 2017-08-29 20:21:14 +02:00
SmallJoker b7ee608e70 Bump minimal protocol version to 36 (#6319)
* Bump minimal protocol version to 36
Item/Node/TileDef, NodeBox, TileAnimation: Remove old compat code

* Accept future serialisation versions
2017-08-29 19:26:55 +02:00
Loïc Blot 1b3e4e1736 Formspec: Add options to set background color and opacity (fullscreen mode + default mode) (#5493)
* Formspec: Add options to set background color and opacity (fullscreen mode)

* Enhance previous comment: Set formspec background when regenerate UI.

* This permit to do the calcul only at regen and override it with bgcolor tag
* Add a setting for default background color into formspec, separated from fullscreen
* Add a little performance gain on formspecs using a const ref instead of copying formspec string
2017-08-29 19:25:16 +02:00
you 7e38475554 mapblock_mesh.cpp: Fix code style and simplify a bit code (#4558)
* mapblock_mesh.cpp: Fix code style and simplify a bit code
2017-08-28 20:02:51 +02:00
Loïc Blot 5f38fe33f8 Clientevent refactor (#6320)
* Refactor clientevent structure

* Move structure outside of client header

* Create client events on heap not stack, this remove the ClientEvent object copy

* Use clientEventHandler to route events
2017-08-28 20:02:23 +02:00
Loïc Blot 6fd8a27c91 Pass SharedBuffer as value to increment reference count
This should fix #6332
Refcount is not increased due to reference, it can make this refcount incorrect in a multithread context
2017-08-28 17:12:46 +02:00
Dániel Juhász 04158d0c84 Use crack animation on all tile layers (#6104) 2017-08-28 07:51:55 +02:00
Nathanaël Courant 520b481383 Statbars: fix incorrect half-images in non-standard orientations (fixes #6198) 2017-08-27 19:06:40 +02:00
you e09c7fceaa core.get_objects_inside_radius: Omit removed objects (#6318)
Fixes #6294
2017-08-27 18:38:50 +02:00
Nathanaël Courant 5a6618cc57 Add '@n' escape sequences and some documentation on translated strings. 2017-08-26 09:43:08 +02:00
Ben Deutsch fc13c00ef3 Alternative code for slipping (#6256)
* Alternative code for slipping

- does not depend on frame rate
- controllable via environment variables for now

* Adjust slipping speed for item entities too.

* Final version of framerate-independent slippery code

* Remove dead code and fix formatting

* getStandingNodePos should only look 0.05 nodes downwards

This ensures that, even if the player is standing on a partially
filled node, this node is used as the standing node and not the
node below it.

Specific use: enables slippery slabs

* Exchange global getStandingPosNode change for local inline change

Reverts previous commit

* Revert the item movement changes

* Slippery nodes now slip over cliffs and edges

Players no longer suddenly stop before falling off.
Also refactored slippery code into getSlipFactor method.

* Slipping over an edge gated by player's is_slipping state

A new flag for just this case, to reduce costly node lookups in
the normal case of leaning over a non-slippery edge.
Public access for consistency and potential future uses.

* Minor code tweaks / cosmetics

* Add temp variable to improve readability and fix indentation issues
2017-08-26 09:01:09 +02:00
Paramat 0e0643df35 Android stepheight: Only increase if 'touching ground' (#6313) 2017-08-26 08:45:09 +02:00
Paramat e55aeec2e2 Mgfractal: Use 'switch case' instead of 'if else' (#6314) 2017-08-26 08:43:50 +02:00
rubenwardy ad9677a14f Check item_drop amount clientside (#6242) 2017-08-26 08:11:59 +02:00
Loïc Blot 3cea7a349a Network cleanup (#6310)
* Move Connection threads to dedicated files + various cleanups

* ConnectionReceiveThread::processPacket now uses function pointer table to route MT packet types
* Various code style fixes

* Code style with clang-format

* Various SharedBuffer copy removal

* SharedBuffer cannot be copied anymore using Buffer
* Fix many SharedBuffer copy (thanks to delete operator)
2017-08-25 15:53:56 +02:00
Dániel Juhász f6a33a1a7a Overlays for wield and inventory images (#6107)
* Overlays for wield and inventory images
2017-08-25 13:20:53 +02:00
Ekdohibs 6761e21383 Translations: prevent remote crash with invalid translations 2017-08-25 13:06:59 +02:00
Ekdohibs b24e6433df Add clientside translations. 2017-08-24 17:54:10 +02:00
adrido 017840f9b1 Dont define min/max macros in minwindef.h (#6308) 2017-08-24 17:13:53 +02:00
Pavel Puchkin caf61f3b4d Fix OSX builds caused by __WORDSIZE again (#6307) 2017-08-24 10:02:23 +02:00
stujones11 ac4884c3d6 Make entity selection and collision boxes independently settable (#6218)
* Make entity selection and collision boxes independently settable
2017-08-24 10:01:16 +02:00
Dániel Juhász 01c319d778 Fix Android node selection distance (#6187) 2017-08-24 08:31:33 +02:00
Ben Deutsch 397a701f98 Safe digging and placing (#6127)
* Setting: Safe digging and placing

* New setting 'safe_dig_and_place' under Controls
* If set, digging and placing will not auto-repeat
* Releasing buttons unblocks the respective action again
* Useful for inexperienced users in creative mode where default
  repeat times may be too short

* Safe placing (right click repetition) does not need a guarding flag

* Added new setting to minetest.conf.example
2017-08-24 08:30:46 +02:00
Loïc Blot c7160cb629 Network cleanup (#6302)
* Cleanup network headers

* Move peerhandler to a specific header to reduce compilation times
* Move socket.cpp/h to network folder

* More work

* Network code cleanups

* Move socket.{cpp,h} to network folder
* Move Address object to network/address.{cpp,h}
* Move network exceptions to network/networkexceptions.h
* Client: use unique_ptr for Connection
* Server/ClientIface: use shared_ptr for Connection

* Format fixes

* Remove socket.cpp socket.h from clang-format whitelist

* Also fix NetworkPacket code style & make it under clang-format
2017-08-24 08:28:54 +02:00
Pavel Puchkin 928609c8bd Fix OSX builds (closes #6289, fixes #6270) (#6306)
Of course, this is not ideal solution, but we want our users to be happy in the
first place, right?
2017-08-24 07:58:12 +02:00
SmallJoker f7d50a8078 Respect object property hp_max field for players (#6287)
* Respect object property hp_max field for players
This allows modders to configure the maximal HP per player

* Statbars: Downscale bar to full 20 HP when exceeding this value
Add default max HP for players and breath constants to builtin
Document the constants

* Rename PLAYER_MAX_HP -> PLAYER_MAX_HP_DEFAULT
2017-08-23 22:32:10 +02:00
stujones11 d01b65abeb Do not add base position to player selection box (#6241) 2017-08-23 14:18:44 +02:00
Loïc Blot e2a6b7c8d2 serialize: use a temporary for SerializeException
Exception must always use temporary instead of global copied exception instances, it's not recommended and should have undefined issues
2017-08-21 16:07:39 +02:00
paramat 1dd535c0c6 Mgv6: Remove incorrectly defined and unused 'volume nodes' 2017-08-20 23:59:02 +01:00
paramat 7657fe7a50 Minimap: Add new HUD flag for minimap radar mode
Flag default is true to not change default behaviour.
The existing minimap HUD flag remains the master control for minimap.
2017-08-20 23:58:15 +01:00
Loic Blot a3441638c6
Fix a formspec crash triggered by ae9b5e0098 2017-08-20 20:24:26 +02:00
Jens Rottmann 9d8cb510b3 Change BS constant from implicit double to float (#6286)
the BS constant
implicitly promotes all position calculations it is used in to double even
though positions (= v3f) are only meant to be floats.

There are many, many similar occurrences everywhere, but I'm not willing to
hunt down all; I only fixed the little part I'm already familiar with.
2017-08-20 19:37:55 +02:00
Loïc Blot ae9b5e0098 Modernize code: very last fixes (#6290)
Last modernization fixes
2017-08-20 19:37:29 +02:00
Loïc Blot 1c1c97cbd1 Modernize source code: last part (#6285)
* Modernize source code: last par

* Use empty when needed
* Use emplace_back instead of push_back when needed
* For range-based loops
* Initializers fixes
* constructors, destructors default
* c++ C stl includes
2017-08-20 13:30:50 +02:00
Loïc Blot 50669cd282 Fix shader.h inclusion place in game.cpp 2017-08-19 22:24:30 +02:00
Loïc Blot 88b436e6a9 Code modernization: subfolders (#6283)
* Code modernization: subfolders

Modernize various code on subfolders client, network, script, threading, unittests, util

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* C++ STL header style
* Make connection.cpp readable in a pointed place + typo
2017-08-19 22:23:47 +02:00
Loïc Blot 7528986e44 Code modernization: src/p*, src/q*, src/r*, src/s* (partial) (#6282)
* Code modernization: src/p*, src/q*, src/r*, src/s* (partial)

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* C++ STL header style
* Spelling: vertice -> vertex
2017-08-19 14:25:35 +02:00
Loïc Blot 1992db1395 Code modernization: src/n*, src/o* (#6280)
* Code modernization: src/n*, src/o*

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* remove unused IWritableNodeDefManager::clone()
* C++ STL header style
* Pointer constness in some functions
2017-08-19 11:30:46 +02:00
SmallJoker 4a1265ceb5 GenericCAO: Fix light position for non-players, remove deprecated initialisation code (#6281) 2017-08-19 11:30:09 +02:00
Loïc Blot de4c2e4250 ServerMap saving: cleanups (#6274)
* remove sector meta loading/saving from files which targets dead code (differs_from_disk is always empty)
* this remove empty ServerMapSector and ClientMapSector, remove MapSector childs
2017-08-19 11:29:46 +02:00
Loïc Blot b82884aa62 ItemCAO removal (#6279)
This object is from 0.3 era and was never used since 0.4.X and GenericCAO usage
2017-08-19 09:30:43 +02:00
Loic Blot d382483fa7
Code modernization: src/m* (part 3)
* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* remove some unused headers in some cpp variable
2017-08-19 09:29:55 +02:00
Loic Blot b5f7249a7e
Code modernization: src/m* (part 2)
* empty function
* default constructor/destructor
* remove unused Map::emergeSector(a,b)
* for range-based loops
* migrate a dirs[7] table to direction tables
* remove various old unused function
2017-08-19 09:12:54 +02:00
Paramat e53d8a7536 Banmanager: Move 'creating' message from warningstream to infostream (#6277) 2017-08-19 08:06:22 +02:00
Loïc Blot fd3afbced5 Optimize headers (part 2) (#6272)
* Optimize headers (part 2)

* less debug.h in headers
* less remoteplayer.h for everybody

* Cleanup (part 2)

* camera.h: mesh.h
* mapgen.h: mapnode.h
* serverenvironment.h: mapblock.h
* nodedef.h: shader.h
2017-08-18 19:25:07 +02:00
Loïc Blot c427533389 Modernize various files (src/m*) (#6267)
* Modernize various files (src/m*)

* range-based for loops
* code style
* C++ headers instead of C headers
* Default operators
* empty function

Thanks to clang-tidy
2017-08-18 18:18:25 +02:00
Loïc Blot fb196be8cf server.cpp: unroll setting when sending mapblocks (#6265)
* server.cpp: unroll setting when sending mapblocks

* Improve a little bit performance when sending mapblocks massively
* Use a range based for
* Code style fixes
2017-08-18 12:17:30 +02:00
adrido 1d055aad0f Add missing ctime include (#6269) 2017-08-18 12:17:19 +02:00
Loic Blot 951f1201c4
Modernize various files (src/k*, src/l*)
* range-based for loops
* code style
* C++ headers instead of C headers
* Default operators
2017-08-18 08:21:01 +02:00
Loic Blot 1d086aee7c
Modernize various files (part 2)
* range-based for loops
* emplace_back instead of push_back
* code style
* C++ headers instead of C headers
* Default operators
* empty stl function
2017-08-18 08:07:59 +02:00
Loic Blot 55ab4264dc
Modernize various files
* range-based for loops
* emplace_back instead of push_back
* code style
* C++ headers instead of C headers
* Default operators
* empty stl function
2017-08-18 07:44:52 +02:00
Loïc Blot 13e995b811 Modernize src/c* src/d* and src/e* files (#6263)
* Modernize src/c* src/d* and src/e* files

* default operator
* redundant init
* delete default constructors on CraftDefinition childs (never used)
* fix some missing init values
* const ref fix reported by clang-tidy
* ranged-based for loops
* simple conditions & returns
* empty stl function instead of size
* emplace_back stl function instead of push_back + construct temp obj
* auto for some iterators
* code style fixes
* c++ stl headers instead of C stl headers (stdio.h -> cstdio)
2017-08-17 23:02:50 +02:00
Loïc Blot 921151d97a C++ modernize: Pragma once (#6264)
* Migrate cpp headers to pragma once
2017-08-17 22:19:39 +02:00
Loïc Blot c738d1eeab clientobject, clouds, collision, clientsimpleobject: code modernization (#6260)
* clientobject, clouds, collision, clientsimpleobject: code modernization

* use range-based for loops
* simplify some tests
* various code style fixes
* use emplace_back instead of push_back when necessary
* use auto on some iterators
* use default operator when needed
* unroll v3s16 creation on collisionMoveSimple
2017-08-17 20:23:54 +02:00
Loïc Blot 9bd18874a1 Reduce dedicated server step to 0.09 (#6252)
Minetest performance improvement has been huge since months, server step reduction will permit to handle client events a little bit faster without too many penalty costs due to core engine
2017-08-17 19:16:02 +02:00
Loic Blot 8432efa308
Typo fix in compat code from commit 1d8d01074f 2017-08-17 19:15:12 +02:00
Loic Blot b204bc4da9
clientmap, clientmedia: code modernization
* use range-based for loops
* simplify some tests
* various code style fixes
* remove debugprint in ClientMap::getBackgroundBrightness, debug code was not intended to be there
* remove unused fields in MapDrawControl
* use emplace_back instead of push_back when necessary
2017-08-17 08:26:52 +02:00
Loic Blot 3e80bf933f
l_server, clientenvironment, clientiface: code modernization
* use range-based for loops
* use refs on some exceptions & one setter
2017-08-17 08:11:39 +02:00
Vitaliy 9c8fec83af New lighting curve (#5279)
* New lighting curve

* Make polynomial lighting curve

* Update default lighting settings
2017-08-17 00:23:20 +02:00
Loïc Blot 1d8d01074f ClientInterface: add a function to verify (correctly) if user limit was reached (#6258)
* ClientInterface: add a function to verify (correctly) if user limit was reached

CS_HelloSent is a better indicator of active slots than CS_Created, which are session objects created after init packet reception

Switch existing checks to ClientInterface::isUserLimitReached()

Use range-based for loop for getClientIds() used function too

This will fix #6254 (not the memory overhead if init is flooded)
2017-08-16 23:48:29 +02:00
Loïc Blot 85511a642f Cleanup various headers to reduce compilation times (#6255)
* Cleanup various headers to reduce compilation times
2017-08-16 22:11:45 +02:00
Loic Blot 816bca32ac
client.cpp: modernize code
* Range based for loops
* Empty operator on stl containers
2017-08-16 08:53:52 +02:00
Loic Blot 90dfafcda2
cavegen.cpp, chat.cpp: modernize code 2017-08-16 08:26:04 +02:00
Loïc Blot 9dd0f952e0 Modernize client code (#6250)
* Various code style fixes
* Use range based for loops
* Use empty instead of empty objects
* Use C++11 default keyword for trivial constructors and destructors
* Drop some useless casts
* Use emplace_back instead of push_back to improve performance of some vectors push
2017-08-15 20:30:30 +02:00
Loic Blot 64c7a689ad
bab.cpp: code modernization
* Use for range based loops
* Simplify some tests
* Code style fixes
2017-08-15 09:39:58 +02:00
Loic Blot 342e9336ae
server.cpp: code modernization
* Use more for range based loops
* Simplify some tests
* Code style fixes
* connection.h: better PeerChange constructor instead of creating uninitalized object and then affect variables
2017-08-15 09:30:31 +02:00
Loic Blot 618e0dd417
Lint fix on localplayer.h 2017-08-15 09:15:04 +02:00
Hybrid Dog 4493d47a51 L-system: Fix leaves cutting through stems 2017-08-14 12:38:21 +01:00
Loic Blot 3eb9ff555f
Player::getSpeed/setSpeed use const refs 2017-08-14 10:56:06 +02:00
Loic Blot ab9f3b92f2
Player class: disable copy 2017-08-14 10:52:59 +02:00
Loic Blot 182bd6ab45
Various server.cpp cleanups
* Modernize many for loops
* Use constness on many loops
* use empty function on many strings tests
* various code style fixes
2017-08-14 01:06:12 +02:00
Loic Blot 5d06ecb366
Server::AsyncRunStep + Server::sendAddNode: modernize code
* Use various modern for loops
* Make some loop iterator constants, whereas there weren't
* Use empty on some size() > 0 tests
* Various little codestyle fixes
* Fix an hidden scope variable in Server::SendBlockNoLock
2017-08-14 00:44:45 +02:00
Loic Blot 725a0f56db
LocalPlayer::accelerateHorizontal: cleanups
* Properly use v3f default constructor
* v3f d_wanted = target_speed - m_speed; and d_wanted = target_speed * 0.1f - m_speed * 0.1f; can be factorized to d_wanted = (target_speed - m_speed) * 0.1f; => d_wanted *= 0.1f;
2017-08-13 23:08:17 +02:00
Loic Blot d65d6160d8
Cleanup LocalPlayer::applyControl
* Use Environment interface instead of ClientEnvironemnt
* Don't create slippery variable and then re-affect it
* itemgroup_get return a int, properly test != 0 to be clearer
2017-08-13 23:02:32 +02:00
Wuzzy 2ea26e655d Add slippery group for nodes (players/items slide) 2017-08-13 21:39:08 +01:00
SmallJoker 4381fe0a0a Trigger on_rightclick regardless on the formspec meta field
Document behaviour for older clients.
2017-08-13 21:37:30 +01:00
TeTpaAka 028c9f899f Change “Use” key name to “Special” 2017-08-13 21:35:42 +01:00
Fixer e44f13aecb Full viewing range key message clarified
To make it sound less confusing to players
2017-08-12 19:37:53 +01:00
Ben Deutsch 9ef9c72e5a Remove cloud_height setting
With the cloud API, the cloud_height setting has become obsolete
and replaceable by a mod. It, and supporting code, can be
removed.
2017-08-12 19:37:53 +01:00
paramat 3aab517775 Mgv5: Make spawn position search more reliable 2017-08-12 19:37:53 +01:00
Loic Blot bb1c711586
ServerEnvironment::step: modernize loops
Use various ranged-based for loops in ServerEnvironment::step
Also set ServerObject::getBasePosition const to be compliant
ServerEnvironment::deleteParticleSpawner: use a const iterator
2017-08-11 09:57:27 +02:00
paramat a4048e4e2e Mgv7: Raise spawn point by 1 node for no mountain case 2017-08-09 11:06:33 +01:00
paramat 3d0e8a691f Step height: Add as a player object property
Add settable player step height using the existing object property.
Breaks compatibility with old clients, add to protocol version 35.
2017-08-09 11:06:22 +01:00
Wuzzy f3394095a1 Key change menu: Expose more keys 2017-08-09 11:00:24 +01:00
Juozas 837328fbac Fix error not printed to console when no name is provided
When minetest is launched, if there was no nameprovided in
configuration or parameters, the game would not show any error in
console. if the --go parameter was also prowided, the game would
exit without an error. This is undesired behavior, so this merged
commit add the missing function that displays the missing error
message in console.
2017-08-09 02:04:06 +01:00
SmallJoker 154b61ac5e Singleplayer: Pause game in the key change dialog
Fixes #6201. @t0ny2 pointed to the right place. Thanks!
2017-08-07 15:29:46 +02:00
JRottm 8325d7f482 Start off newly generated worlds early at sunrise, 5:15am (#6211)
Gives starting singleplayer games this subtle "dawn of a new world" feel.
I would have set it even earlier (up to 4:45am), but I was worried that in
some pre-existing games the player could be overwhelmed by hostile
mobs right at the start, seriously changing gameplay.

It's just the default, individual games should be able to override it, and
for public servers it's irrelevant anyway, because only the first player to
set foot in the world will notice, and that's usually the server admin.
2017-08-05 21:08:21 +02:00
Jens Rottmann 248a1a8d65 Add tiny Y offset in collisionMoveSimple() to tweak performance
Another small general problem: the player is always standing exactly on the
bondary between 2 nodes e.g. Y=1.5 is exactly between nodes Y=1 and Y=2.
floatToInt() and myround() will round +/-n.5 always 'outwards' to +/-(n+1),
which means they behave differently depending on where you are: they round
upwards above sea level and downwards when underground. This inconsistency
comes from the way the coordinates are calculated, independent of the
specific C++ code.

The result is a tiny bit of lost performance when moving underground,
because 1 node level more than necessary is checked for collisions. This can
be amended by adding a tiny offset to minpos_f.Y, like @paramat suggested.
This is not an elegant solution, but still better than wasting CPU.
2017-08-05 12:38:11 +02:00
Jens Rottmann 0c893ea123 Fix player coordinate rounding in collisionMoveSimple() (#6197)
To determine the area (nodes) where a player movement took place
collisionMoveSimple() first took the old/new player coordinates and rounded
them to integers, then added the player character's collision box and
implicitely rounded the result. This has 2 problems:

Rounding the position and the box seperately, then adding the resulting
integers means you get twice the rounding error. And implicit rounding
always rounds towards 0.0, unlike floatToInt(), which rounds towards the
closest integer.

Previous (simplified) behavior: round(pos)+(int)box, for example player at
Y=0.9, body is 1.75m high: round(0.9)+(int)1.75 = 1+1 = 2.
==> A character's height of 1.75m always got rounded down to 1m, its width
of +/-0.3 even became 0.

Fixed by adding the floats first, then rounding properly: round(pos+box) =
round(0.9+1.75) = round(2.65) = 3.
2017-08-05 12:38:11 +02:00
Thomas--S e63df5ce80 Sort box corners correctly 2017-08-04 21:57:50 +02:00
Juozas Pocius 80ded73f68 Fix crash when using --go in command line 2017-08-03 14:03:15 +02:00
paramat b20d01a3f1 Dungeons: Use biome 'node_stone' if normal stone types not detected
Construct dungeons from the node defined as biome 'node_stone' if
'mapgen_stone', 'mapgen_desert_stone' and 'mapgen_sandstone' are not
detected.
Feature long-intended by kwolekr/hmmmm and present in code as a TODO.
2017-07-30 18:40:55 +01:00
paramat 238d752fa3 GenericCAO: Fix dark model below y = 0
Move point at which light is sampled up to 0.5 nodes above foot level,
to avoid that point sometimes passing into the node below causing the
model to go dark.
2017-07-30 18:40:45 +01:00
Lars Hofhansl d1a130488e Darkness detection: Reduce chance of false positives darkening the skybox
The getBackgroundBrightness() function detects darkness in the view direction
to decide when to make the skybox dark. The volume checked was too narrow and
missed the left and right edges of the view, too easily causing a dark skybox.

Widen the checked volume to match a FOV of 72 degrees and a 16:9 aspect ratio
game window.
2017-07-30 18:28:16 +01:00
Wuzzy 640ba77276 Make direct item selection keys freely bindable 2017-07-30 18:24:45 +01:00
TeTpaAka d504831ee2 Move the nametag back to the top of the player (#6179)
read the actual height of the collisionbox
2017-07-29 19:24:10 +02:00
SmallJoker 765fd9a0bc Noise: Prevent unittest crash caused by division by zero 2017-07-29 19:01:14 +02:00
Loïc Blot e9d7005799 Revert "Noise::perlinMap2D,3D: replace a loop init with a single memset call"
This reverts commit bc1654feed.
2017-07-27 17:12:18 +02:00
Loïc Blot 2015aaba96 Fix a warning introduced by 4eb59aeeb2 2017-07-27 16:55:32 +02:00
Loïc Blot 550c0404a8 Add LuaEntity on_death callback (#6177)
Add LuaEntity on_death callback

This fixes #5474
2017-07-27 11:32:35 +02:00
Loic Blot ba959ce27f Rename previous_was_found to previous_exists 2017-07-27 07:56:48 +02:00
Loic Blot 4eb59aeeb2 MapBlock::actuallyUpdateDayNightDiff(): little performance optimization
don't check isLightDayNightEq if checked on previous node
2017-07-27 07:56:48 +02:00
Loic Blot c27504a322 compressZlib: don't use a SharedBuffer but a raw u8 * pointer
Remove usage of the SharedBuffer in zlib compression which has two problems:
* We copied the whole memory block to compress it (not good with mapblocks)
* We copied sometimes strings to SharedBuffer to SharedBuffer (2nd time)

Use this method in MapNode::serializeBulk + optimize serialization but merging 3 identical loops in a single loop
2017-07-27 07:56:48 +02:00
Loic Blot 61e4877190 Massive performance improvement on correctBlockNodeIds
correctBlockNodeIds does 2 lookups for each loaded node, one to translate DB ID to name and a second to translate name to real ID. Name to real ID is very consumming if done on every node. As mapblocks are in most cases composed of many identical adjacent nodes, cache previous source and destination id and use them on the next node to prevent any lookup on those maps.

This reduce the function load from 15% of my CPU usage to ~0.7%, on the test, calls was reduced from 2.5M lookups to 42k lookups, it's a huge performance gain
2017-07-27 07:56:48 +02:00
Loic Blot bc1654feed
Noise::perlinMap2D,3D: replace a loop init with a single memset call 2017-07-27 00:24:14 +02:00
Loic Blot c8faee4eda
Remove one unused variable in Server::Receive function 2017-07-27 00:16:20 +02:00
Loic Blot 9d412dd075
Remove unused Map::getDayNightDiff + fix one undefined variable in mapblock.cpp 2017-07-26 23:11:46 +02:00
Loïc Blot 3e50850260 TileLayer: use shared_ptr for FrameSpec vector (#6171)
* TileLayer: use shared_ptr for vector framespec
This reduce memory copy of TileLayer from (4 to 16) * FrameSpec where FrameSpec = (sizeof(int) + 3 * sizeof(ptr)) to int + sizeof(ptr)

Callgrind difference

Before: https://lut.im/RGkiJqQb8T/LeQIEXpAuRzfl7gd.png
After: https://lut.im/bcqmwee1xu/cTwtptY5tRuS9lp0.png

* Fix one push_back to use vector::emplace_back & optimize inclusions
2017-07-26 20:12:48 +02:00
Loïc Blot 9a17b65f26 VoxelManip cleanups (const ref, const move) + function removal (#6169)
* VoxelManip cleanups (const ref, const move) permitting to improve a little bit performance

* VoxelArea: precalculate extent (performance enhancement)

This permits to reduce extend high cost to zero and drop many v3s16 object creation/removal to calculate extent
It rebalance the client thread update to updateFastFaceRow instead of MapBlockMesh generation
This will also benefits to mapgen
2017-07-26 07:35:09 +02:00
paramat f61928d3fc Mgv7: Add 'mount_zero_level' parameter
Allows setting of the mountain 'zero level' (y where density gradient is zero).

It is easy to vertically shift smooth terrain by editing noise parameter 'offset',
but vertically shifting mountain terrain was complex and imprecise, involving
making a calculation based on an average of the mountain height parameter.
2017-07-26 02:41:30 +01:00
Loic Blot 31b84ce1f2
Move MapEditEventAreaIgnorer to emerge.cpp
It's only used in emerge threads and it's a local object, don't expose it to the whole Minetest
2017-07-25 08:47:52 +02:00
Paramat 4a4eba7a6c Network protocol: Document settable player collisionbox (#6168) 2017-07-25 07:32:44 +02:00
Ben Deutsch c50a57c070 Clouds API: change speed from 'y' to 'z', ColorSpecs in Lua docs (#6164) 2017-07-24 18:04:00 +02:00
Loic Blot befc3bba3d
LBM: use range based for and fixed a loop variable overloading in applyLBMs 2017-07-24 08:26:19 +02:00
paramat dc9e4517a8 Mgv7: Add option to repeat surface biomes in floatlands 2017-07-22 00:56:55 +01:00
TeTpaAka 49920cfe8d Player collisionbox: Make settable
Breaks compatibility with old clients.
2017-07-21 02:03:22 +01:00