Commit Graph

4252 Commits

Author SHA1 Message Date
Lars Hofhansl 739ef175aa Sky: Draw bottom of the sky box in 'cloudy fog color'
To be identical to the lower half of the skybox sides.
Now needed as the skybox base is often seen due to increasingly vertical
mapgens.
2016-11-08 15:20:01 +00:00
Lars Hofhansl e7c62edec9 Retrieve mapblocks from the server in a sphere, not a cube
Use unused range argument in 'isBlockInSight()' to limit mapblock sends
to a sphere of radius 'max block send distance'.
2016-11-08 15:15:27 +00:00
Lars Hofhansl 2b21cac1d8 Occlusion culling: Fix 'end offset' distance, half this for centre point
'endoff', the maximum diagonal of a mapblock, was incorrectly calculated.
Half this value for the centre point of the mapblock.
2016-11-08 15:12:08 +00:00
Lars Hofhansl 45eab340b9 Don't use reduced vertical limits for mapblock send and generation 2016-11-07 21:55:17 +00:00
adrido 295232667e Windows: Add manifest file and set "High DPI Aware" true
This resolves washy font and incorrect mouse handling on Windows if
a screen with high DPI is used.
2016-11-07 21:55:01 +00:00
SmallJoker ad4bf2ccf9 MSVC: Generate debug information for release builds (#4674)
Replace parameters with the equivalent /Ox
2016-11-06 11:14:36 -05:00
Ner'zhul 66bb295436 PlayerSAO saving fix (#4734)
PlayerSAO::disconnected() function was historical and remove the link between SAO and RemotePlayer session. With previous attributes linked to RemotePlayer saving was working. But now attributes are read from SAO not RemotePlayer and the current serialize function verify SAO exists to save the player attributes.

Because PlayerSAO::disconnected marks playersao for removal, only mark playerSAO for removal and let PlayerSAO::removingFromEnvironment do the correct saving behaviour and all the disconnection process instead of doing a partial removal and let the server loop doing the RemotePlayer cleanup and remove some saved attributes...
2016-11-05 10:25:30 +01:00
Zeno- b5c84c34ce Fix memory leak in ::safeLoadFile (#4730) 2016-11-05 15:10:49 +10:00
lhofhansl 6bb4347208 Remove unused shader matrices. (#4723) 2016-11-04 18:12:45 +01:00
lhofhansl dde66a82ed Cycle directly to nothing shown instead of showing the profiler graph again
Fix for previous commit.
2016-11-04 05:08:23 +01:00
lhofhansl f8fd432dca Add debug priv, and allow player to display the scene as wire-frame. (#4709) 2016-11-04 03:14:32 +01:00
Brandon bf315c05f1 Add minetest.get_server_uptime() function to Lua API (#4702)
Add minetest.get_server_uptime() function to Lua API
2016-11-02 09:36:58 -07:00
ShadowNinja 7607b0ac20 Add version API 2016-10-31 21:53:00 -07:00
paramat 70e2df4f86 Lua voxelmanip: Add optional buffer param for 'get param2 data'
Update lua_api.txt.
2016-10-31 10:59:38 +00:00
lhofhansl e1842ed370 Optionally disable optimization that causes underwater and cave rendering glitches. (#4686) 2016-10-30 23:35:55 -04:00
Loic Blot 595932a860 Fix overloading problems mentioned by clang 2016-10-30 16:30:55 +01:00
Ner'zhul 9d25242c5c PlayerSAO/LocalPlayer refactor: (#4612)
* Create UnitSAO, a common part between PlayerSAO & LuaEntitySAO
* Move breath to PlayerSAO & LocalPlayer
* Migrate m_yaw from (Remote)Player & LuaEntitySAO to UnitSAO
* Migrate m_yaw from Player to LocalPlayer for client
* Move some functions outside of player class to PlayerSAO/RemotePlayer or LocalPlayer depending on which class needs it
* Move pitch to LocalPlayer & PlayerSAO
* Move m_position from Player to LocalPlayer
* Move camera_barely_in_ceiling to LocalPlayer as it's used only there
* use PlayerSAO::m_base_position for Server side positions
* remove a unused variable
* ServerActiveObject::setPos now uses const ref
* use ServerEnv::loadPlayer unconditionnaly as it creates RemotePlayer only if it's not already loaded
* Move hp from Player to LocalPlayer
* Move m_hp from LuaEntitySAO to UnitSAO
* Use m_hp from PlayerSAO/UnitSAO instead of RemotePlayer
2016-10-30 14:53:26 +01:00
Hugo Locurcio d43326021a Rename testsounds/ directory to sounds/ (#1984) 2016-10-30 14:36:57 +10:00
sfan5 6d7b95d763 Add missing keyname_to_keycode function (needed on Android)
When rewriting keycode.cpp I overlooked this function, fixes #4683 completely
2016-10-28 15:50:23 +02:00
Ner'zhul 361e687f3a Add unittests to test player saving/loading (#4679) 2016-10-27 09:45:01 +02:00
Dániel Juhász bcb06aeb85 Cleanup 2016-10-27 08:04:42 +02:00
Dániel Juhász be39f61359 Use node lighting for liquid spreading
This commit modifies the liquid transforming procedure to light and
unlight nodes instead of whole map blocks.
2016-10-27 08:04:42 +02:00
Dániel Juhász c071efaa43 Improved lighting
This commit rewrites the procedure that is responsible for light
updating.

this commit
-provides iterative solutions for unlighting and light spreading
-introduces a new priority queue-like container for the iteration
-creates per-node MapBlock caching to reduce retrieving MapBlocks from
the map
-calculates with map block positions and in-block relative node
coordinates
-skips light updating if it is not necessary since the node's new light
will be the same as its old light was
2016-10-27 08:04:42 +02:00
Foghrye4 6eb6e75fff Adding LuaError on attempt to assign vectors with values out of range 2016-10-25 21:10:51 +02:00
Gael-de-Sailly 3db2f08ff9 ParticleSpawner: fix offset being added twice 2016-10-25 20:39:39 +02:00
adrido a1e1323d6e Windows: dont link to libraries that are already linked by cmake
This solves the problem whith building where build fails if the libaries have different names.
2016-10-25 13:54:24 +02:00
paramat 0c76303186 Damage flash: Reduce maximum alpha. Avoid fade overload
Flash alpha maximum is reduced from 180 to 127 to avoid player blindness
in combat. Flash alpha minimum is unchanged.
The 'damage_flash' value is now limited to max alpha, to avoid multiple
hits creating a huge value that causes flash to stay at maximum alpha
for a long period. Now alpha always starts to fade immediately after
taking damage.
Both problems can be seen in Minetest let's play videos.
Simplify and optimise some code.
2016-10-21 05:48:53 +01:00
paramat 63a3bb229a Changes to static object storage limit and error message
Move static object storage force-delete message from errorstream to
warningstream.
Increase 'max objects per block' setting to 64.
Add missing spaces in warning code.
2016-10-20 03:40:47 +01:00
Foghrye4 91250c1078 Fix crash on attaching player to entity
Rename "refresh" to "processInitData"
2016-10-19 08:40:43 +02:00
Lars Hofhansl a291cd6132 Revert changes to toggleNoClip and toggleFreeMove 2016-10-17 20:26:48 +02:00
Lars Hofhansl 3253b6bd22 Don't use day light sky unless noclip and free_move are enabled 2016-10-17 20:26:48 +02:00
ShadowNinja 2ff054d041 Enable mod security by default 2016-10-16 01:14:54 +01:00
Rogier 4b17105dc4 Emergeblocks: Fix occasional crash
Modification of the emergeblocks internal state was not protected
by a lock, causing a race condition.
This can be reproduced by repeatedly running emergeblocks for an
already-generated section of the map (with multiple emerge threads).
2016-10-16 01:13:16 +01:00
Lars Hofhansl 0ad40fd484 Use range-based fog instead of z-plane based. 2016-10-13 23:30:15 +02:00
raymoo c9e7a27eeb Attached particle spawners 2016-10-13 17:33:16 +02:00
sfan5 0b27a70b29 Don't use unordered maps for ProfilerGraph (fixes flickering) 2016-10-12 18:42:18 +02:00
Rogier a4a9ee94f3 Disable cmake message concerning WIN32 on non-windows systems 2016-10-11 07:29:04 +02:00
Loic Blot 1b450861f0 A little cleanup since previous commit 2016-10-09 16:31:43 +02:00
Loic Blot 70f104be07 Environment cleanup
* Move client list to ServerEnvironment and use RemotePlayer members instead of Player
* ClientEnvironment only use setLocalPlayer to specify the current player
* Remove ClientEnvironment dead code on player list (in fact other players are CAO not Player objects)
* Drop LocalPlayer::getPlayer(xxx) functions which aren't used.
* Improve a little bit performance by using const ref list for ClientEnvironment::getPlayerNames() & Client::getConnectedPlayerNames()
* Drop isLocal() function from (Local)Player which is not needed anymore because of previous changes

This change permits to cleanup shared client list which is very old code.
ClientEnvironment doesn't use player list anymore, it only contains the local player, as addPlayer is only called from Client constructor client side.
Clients are only CAO on client side, this cleanup permit to remove confusion about player list.
2016-10-09 15:17:10 +02:00
Rui b3fc133442 Remove unused parameter of GUIVolumeChange 2016-10-09 10:35:51 +02:00
Loic Blot 569b89b36f Move RemotePlayer code to its own cpp/header 2016-10-08 22:27:44 +02:00
Loic Blot 7bbd716426 RemotePlayer/LocalPlayer Player base class proper separation (code cleanup) (patch 3 of X)
* remove IGameDef from Player class, only LocalPlayer has it now
* move many attributes/functions only used by LocalPlayer from Player to LocalPlayer
* move many attributes/functions only used by RemotePlayer from Player to RemotePlayer
* make some functions const
* hudGetHotbarSelectedImage now returns const ref
* RemotePlayer getHotbarSelectedImage now returns const ref
* various code style fixes
2016-10-08 22:27:44 +02:00
Loic Blot edba6e50d9 Optimize ClientIface::getPlayerNames(): return const ref instead a copy of all names 2016-10-08 22:27:44 +02:00
Loic Blot fd5a130b86 More code cleanup (UNORDERED + RemotePlayer/LocalPlayer)
* ClientEnvironment now uses UNORDERED MAP for active objects
* Use RemotePlayer and LocalPlayer everywhere it's possible
* Minor code style fixes
* Drop Client::getBreath() unused function
2016-10-08 22:27:44 +02:00
rubenwardy 067766eec2 Fix backwards compatibility issue introduced by close_on_enter 2016-10-08 18:58:28 +02:00
SmallJoker 0baea8c25c Ensure std::unordered_ be used on MSVC 2010 too (#4600) 2016-10-09 00:25:34 +10:00
Loic Blot 656faf7373 Player/LocalPlayer/RemotePlayer inheritance cleanup (part 2 on X)
* Server/Client Environments now have an helper to cast Player object in the right type to use it
* Server: use RemotePlayer everywhere and remove previous added casts
* Client: use LocalPlayer where needed
* Environment: remove unused functions (getPlayers(), getRandomConnectedPlayer(), getNearestConnectedPlayer())
2016-10-08 15:57:50 +02:00
gregorycu 9393e4a0a8 Speed up emerge thread by using unordered map in a few places. Looking at 25% speedup in Emerge thread on Just Test. 2016-10-08 15:57:36 +02:00
gregorycu 3de9ae4e60 Ensure std::unordered_ will be used on supported MSVC compilers 2016-10-08 15:05:36 +02:00
Foghrye4 ad163ee5c3 Prevent attached models from disappearing during parent reload (#4128) 2016-10-08 14:51:25 +02:00
Loic Blot 09cefc3dfd Remove some unused attributes/class functions in server.cpp/h 2016-10-08 11:36:28 +02:00
Loic Blot 8bcd10b872 Player/LocalPlayer/RemotePlayer inheritance cleanup (part 1 on X)
* LocalPlayer take ownership of maxHudId as it's the only caller
* RemotePlayer take ownership of day night ratio as it's the only user
* Pass getPlayerControl as const reference to prevent object copy on each call (perf improvement in ObjectRef::l_get_player_control call)
* getPlayerSAO is now only RemotePlayer call
* get/setHotbarItemCount is now RemotePlayer owned
* Server: Use RemotePlayer instead of Player object on concerned call to properly fix the object type
* PlayerSAO now uses RemotePlayer instead of Player because it's only server side
* ObjectRef::getplayer also returns RemotePlayer as it's linked with PlayerSAO
2016-10-08 11:36:28 +02:00
SmallJoker d4a2e23793 Textures: Ignore unknown node in override.txt 2016-10-08 00:08:50 +01:00
sfan5 0a16e53b40 Fix C++11 Windows build of threading code
The initial problem was that mutex_auto_lock.h tries to use std::unique_lock<std::mutex>
	despite mutex.h not using C++11's std::mutex on Windows. The problem here is the mismatch
	between C++11 usage conditions of the two headers. This commit moves the decision logic
	to threads.h and makes sure mutex.h, mutex_auto_lock.h and event.h all use the same features.
2016-10-06 22:37:30 +02:00
Loic Blot 155288ee98 use unordered containers where possible (patch 4 on X)
Also remove some unused parameters/functions
2016-10-06 22:37:26 +02:00
SmallJoker b66a5d2f88 Fix narrow string compiling issue on MSVC2010 2016-10-06 13:57:40 +02:00
Loic Blot 667975fe3a Use more unordered_maps to improve performance in c++11 builds 2016-10-06 12:33:35 +02:00
SmallJoker 997fc59c7e Use relative position for nametags 2016-10-06 12:13:37 +02:00
est31 de83c29ba0 Fix crash regression when chatting in the ncurses console
Fixes #4579, a regression introduced by commit

d4c76258e3 "Chat: new settings to prevent spam"
2016-10-06 07:45:50 +02:00
Loic Blot 61d1751dff Travis: build matrix improvements + CPP11 build 2016-10-06 00:28:24 +02:00
Loic Blot 7fab86a49d Compilation fix 2016-10-05 20:58:05 +02:00
Loic Blot 613797a304 Replace various std::map with UNORDERED_MAP + various cleanups
This is part 2 for 5f084cd98d

Other improvements:

* Use the defined ItemGroupList when used
* make Client::checkPrivilege const
* inline some trivial functions
* Add ActiveObjectMap typedef
* Add SettingsEntries typedef
2016-10-05 10:53:19 +02:00
Loic Blot 5f084cd98d Make some maps unordered to improve performance
* This permit to improve performance on C++11 builds
* use some existing typedefs in tools maps
* minor code style changes
2016-10-05 07:30:32 +02:00
Loic Blot d4c76258e3 Chat: new settings to prevent spam
Added the following chat coreside features
* Chat messages length limit
* Message rate limiting
* Message rate kicking

Note:
* handleChat now takes RemotePlayer pointer instead of u16 to remove useless
  lookups
2016-10-05 00:13:37 +02:00
paramat 1079aeaa13 Mapblock_mesh_generate_special: Improve performance
Remove uses of std::map.
Make sure we use ContentFeatures reference not value.
Original commit by gregorycu.
2016-10-04 00:06:28 +01:00
est31 fcfa418c4c Fix build/warning on non X11 platforms 2016-10-03 15:55:47 +02:00
rubenwardy 077b6cfa21 Formspec: Add container[] and container_end[] elements 2016-10-03 01:53:13 +01:00
sfan5 eb0e9d5661 Allow nothing to be selected from formspec parameters 2016-10-02 15:49:18 +02:00
paramat 56ea77ea96 Mgv7: Avoid mid-air spawn on disabled mountain terrain, optimise function
'getSpawnLevelAtPoint()' did not account for disabled mountains, it
was possible to be spawned in mid-air where a mountain surface would
have been.

Avoid check for river area if rivers are disabled.
2016-09-30 18:56:39 +01:00
est31 33a606c034 Fix android build
Fixes #4493.
2016-09-30 15:27:36 +02:00
sfan5 45a9145a4b Only include keycode unittests in client build (fixes #4559) 2016-09-29 16:31:31 +02:00
sfan5 cc0b3c1cd1 Add keycode.cpp unittests 2016-09-25 17:26:38 +02:00
sfan5 c3e1ab859e Rewrite keycode.cpp (Keycode handling & names) 2016-09-25 17:26:38 +02:00
sfan5 af4c2107e0 Don't use ZLIB_WINAPI if the required DLL is not provided to CMake
This allows you to use an stdcall zlib (zlib1.dll instead of zlibwapi.dll)
when building Minetest for win32.
2016-09-21 20:16:31 +02:00
sfan5 3a57e52500 Do not serialize empty NodeMetadata
This commit fixes #4516, though note that this will gradually fix MapBlocks
as they are used/modified and thus re-serialized.
2016-09-21 10:29:17 +02:00
James Stevenson 679c8de63f Increase default font size by 1 2016-09-21 08:04:11 +02:00
paramat 3aefa5d3ce Register.lua: Throw error if node 'light_source' > core.LIGHT_MAX
Add 'core.LIGHT_MAX = 14' to builtin/game/constants.lua with the intention
to replace misplaced 'default.LIGHT_MAX = 14' in Minetest Game.
Add comment in light.h requiring the constant be changed in both places.
Add lighting bug warning to note in lua_api.txt.
There are hundreds of mod uses of 15 which causes a lighting bug.
2016-09-17 09:33:25 +01:00
Thomas--S 1475c1b1c8 Add an [invert:<mode> texture modifier
Inverts the given channels of the base image.
Mode may contain the characters "r", "g", "b", "a".
Only the channels that are mentioned in the mode string will be inverted.
2016-09-15 05:25:38 +01:00
ShadowNinja 6e30dd05f4 Collision: Improve performance by combining 6 vectors into 1 using a struct 2016-09-15 05:25:12 +01:00
paramat b88595050f Decorations: Generalise 'spawn by' to be used by all decoration types
In lua_api.txt, make clear that 'place on' and 'spawn by' can be lists.
2016-09-14 09:19:54 +01:00
sfan5 b77cee146b Allow escaping of texture names when passed as an argument to a modifier 2016-09-14 09:19:36 +01:00
Eric Mountain 9dd22aebc7 Fix "unknown CMake command "check_library_exists" (#4517)
Adds CMakeLists.txt include to fix this issue:

$ cmake . -DBUILD_SERVER=TRUE -DBUILD_CLIENT=FALSE \
   -DCMAKE_BUILD_TYPE=Release -DENABLE_CURL=TRUE -DENABLE_CURSES=FALSE \
   -DENABLE_FREETYPE=TRUE -DENABLE_GETTEXT=FALSE \
   -DENABLE_POSTGRESQL=FALSE -DENABLE_SOUND=FALSE -DENABLE_LUAJIT=TRUE \
   -DIRRLICHT_SOURCE_DIR=$HOME/irrlicht-1.8.4 -LH
...
CMake Error at src/CMakeLists.txt:339 (check_library_exists):
  Unknown CMake command "check_library_exists".
...
2016-09-13 23:05:21 -04:00
Auke Kok d83bcf2c50 Plantlike meshoptions: fix degrotate. (#4512)
This snuck in with the meshoptions patch and accidentally kills
degrotate plants. Thanks to @hybriddog for finding this.
2016-09-12 16:04:13 -07:00
James Stevenson 403dada85a Return nil on empty get_area() (#4508) 2016-09-10 01:47:13 +10:00
SmallJoker c0cd7aa351 Anticheat: Use the physics_override modifiers aswell 2016-09-09 01:03:36 -04:00
SmallJoker 2de8c22a99 Make getStackMax return the correct maximal stack size 2016-09-08 03:37:03 -04:00
paly2 aa33166386 Add minetest.unregister_item and minetest.register_alias_force 2016-09-08 03:26:52 -04:00
Rui 3b0f7659c7 Document keymap_autorun in settingtypes.txt and minetest.conf.example (#4486) 2016-08-30 05:40:48 +02:00
est31 1f2ff860f5 Update minetest.conf.example and settings_translation_file.cpp 2016-08-30 04:40:54 +02:00
rubenwardy 78ff5c1936 Fix background formspec elements from interfering with each other
Fixes #4397
2016-08-29 01:15:31 +01:00
rubenwardy e10fee0001 Allow fields to choose whether they close on enter press 2016-08-27 13:05:01 +01:00
rubenwardy 4330c63ea4 Submit name of field on enter key press 2016-08-27 13:02:45 +01:00
paramat fb20b45100 Camera: Higher frequency limit for view/hand bobbing and footsteps
Rebased and tuned version of Calinou's original pull request.

'm_view_bobbing_speed' controls the frequency of view bobbing,
hand bobbing and footsteps, it was limited to a maximum of 40 (walking
frequency) so did not increase if player speed was modified by a
'speed buff', a sprinting mod or modified in .conf or advanced
settngs.

This commit raises the limit to 70 which is suitable for sprinting.
2016-08-26 05:26:52 +01:00
Auke Kok e58a55aa82 Make plantlike drawtype more fun
Adds several new ways that the plantlike drawtype mesh can be changed.

This requires paramtype2 = "meshoptions" to be set in the node
definition. The drawtype for these nodes should be "plantlike".

These modifications are all done using param2. This field is now
a complex bitfield that allows some or more of the combinations to
be chosen, and the mesh draw code will choose the options based as
neeeded for each plantlike node.

bit layout:
bits 0, 1 and 2 (values 0x1 through 0x7) are for choosing the plant
mesh shape:
  0 - ordinary plantlike plant ("x" shaped)
  1 - ordinary plant, but rotated 45 degrees ("+" shaped)
  2 - a plant with 3 faces ("*" shaped)
  3 - a plant with 4 faces ("#" shaped)
  4 - a plant with 4 faces ("#" shaped, leaning outwards)
  5 through 7 are unused and reserved for future mesh shapes.

bit 3 (0x8) causes the plant to be randomly offset in the x,z
plane. The plant should fall within the 1x1x1 nodebox if regularly
sized.

bit 4 (0x10) causes the plant mesh to grow by sqrt(2), and will cause
the plant mesh to fill out 1x1x1, and appear slightly larger. Texture
makers will want to make their plant texture 23x16 pixels to have the
best visual fit in 1x1x1 size.

bit 5 (0x20) causes each face of the plant to have a slight negative
Y offset in position, descending up to 0.125 downwards into the node
below. Because this is per face, this causes the plant model to be
less symmetric.

bit 6 (0x40) through bit 7 (0x80) are unused and reserved for
future use.

!(https://youtu.be/qWuI664krsI)
2016-08-26 05:26:08 +01:00
est31 d767f025cb Client: disable pre v25 init sending by default
Disable the ability to connect to old servers by default to
improve password security.

If people still want to connect to old (0.4.12 and earlier)
servers, they can flip the send_pre_v25_init setting.

Add the ability to detect if we've tried to connect
to a server which only supports the pre v25 init protocol,
and show an apropriate error message. Most times the error
will already be catched at the serverlist level, the
detection mechanism only acts as last resort, because the
"Connection timed out" error message that would be shown
otherwise would be very confusing.

Automatic "fixing" of this condition is not desired,
as it would allow for downgrade attacks.

As already 161 of the 167 servers on the serverlist
support the new srp based auth protocol (> 96%),
the breakage should be minimal.

Follow up of commit

af30183124 "Add option to not send pre v25 init packet"

Also change the pessimistic assumption of masterlist
server versions to optimistic, in order to avoid buggy
behaviour (favourites not in the serverlist would be
denied to connect to, etc).
2016-08-22 20:23:28 +02:00
Xunto 0b0075e6ad Move on join and on leave messages to lua (#4460) 2016-08-22 20:21:48 +02:00
kahrl cafa400fa5 gettext.h: include <locale> before defining the gettext macro (#4452)
Fixes #4446: a syntax error that happens if something else (such as
<iomanip> or <locale> in certain libstdc++ versions) includes
<libintl.h> later, which contains a function declaration for gettext
that gets mangled by the macro.

See the added comment in gettext.h and the discussion in #4446/#4452
for details.
2016-08-21 02:40:23 +02:00
est31 f092dac979 Also support X11 icon for minetest copies installed via make install (#4407)
Fixes #4323.
2016-08-20 21:26:44 +02:00
Tim 6590140260 Tidy up generate_from_settingtypes.lua a bit.
* Multiline strings
* Table-concat instead of String-concats
* string.rep instead of loop-concat
* string.format %q instead of manual quotation by gsub
* Assert writeable files
* Generate new settings_translation_file
2016-08-20 15:48:47 +02:00
obneq 7f4c6f32da Mapblock mesh: Fix updateFastFaceRow tiling issue
Increase maximum length of tiled node rows from 2 to mapblock size.
2016-08-18 20:45:18 +01:00