Commit Graph

4818 Commits

Author SHA1 Message Date
Rui 49d6e5f4ab Fix deserialization of ItemDefinition (#5995) 2017-06-16 07:17:30 +02:00
paramat 212945c7a3 Mgv6 mudflow: Also check for 'ignore' nodes
Previously, when removing decorations we searched upwards and removed until we
found air or water. However, the node above the decoration can be 'ignore' if
a stacked decoration extends into the volume above the mapchunk. The result
could be a problematic column of air placed in the volume of 'ignore'. The
unnecessary placing of air also slows the function.

Add a check for 'ignore' nodes when removing decorations.
2017-06-16 02:17:25 +01:00
paramat f55816f93a Mgv6 mudflow: Avoid partially removed stacked decorations
Recently we started to remove decorations if the dirt below was flowed away,
but this did not check for stacked decorations, causing them to have only
their lowest node removed.
Also, placed mud could partially bury stacked decorations.

Remove 'old_is_water' bool which on testing is never true.
Add new function 'moveMud()' to reduce indentation.
Remove stacked decoration nodes above a removed decoration.
Remove stacked decorations partially buried in placed mud.
2017-06-15 00:38:08 +01:00
Rui bbe3dd9a7a Fix no sound bug (#5968) 2017-06-14 17:21:08 +02:00
Loïc Blot ddcd026344 Remove legacy content_abm.{cpp,h} 2017-06-14 16:23:08 +02:00
Rui 683ab3a154 Fix the serialization error by ff73c7a (#5964) 2017-06-11 21:20:50 +02:00
Loïc Blot 65819f3b9f Use thread_local instead from some static settings (#5955)
thread_local permits to limit variable lifetime to thread duration. Use it on each setting place which uses static to cache variable result only for thread lifetime. This permits to keep the same performance level & reconfigure server from MT gui in those various variables places.

Add thread_local to undersampling calculation too.
2017-06-11 13:58:43 +02:00
Rui ff73c7a5da Sound: Add pitch option (#5960)
* Sound: Add pitch option
2017-06-11 13:58:26 +02:00
red-001 26e2eb019a Improve the path select GUI (#5852)
- Allow lua to chose whatever directories or files can be selected
- Fix selecting directories
- Rename dialog to `guiPathSelectMenu` from `guiFileSelectMenu`
- Rename lua function for opening the menu from `show_file_open_dialog` to `show_path_select_dialog`
- Remove duplicate code and fix code style.

Related changes
- fix `clang-format` whitelist.
- Regenerate minetest.conf.example
2017-06-11 09:43:31 +02:00
ShadowNinja 6c5e5e2023 Remove threads.h and replace its definitions with their C++11 equivalents (#5957)
This also changes threadProc's signature, since C++11 supports arbitrary
thread function signatures.
2017-06-11 09:43:05 +02:00
QrchackOfficial 5cc8ad946e Remove superfluous pointer null checks 2017-06-10 21:04:47 -04:00
number Zero 7bfd53ba58 Plantlike meshoptions: Fix inverted random vertical offset 2017-06-11 02:12:33 +01:00
paramat 842acbfad2 (Re)spawn players within 'mapgen_limit'
Previously, findSpawnPos() did not take the 'mapgen_limit' setting into account,
a small limit often resulted in a spawn out in the void.
Use the recently added 'calcMapgenEdges()' to get max spawn range through a new
mapgenParams function 'getSpawnRangeMax()'.

Previously, when a player respawned into a world, 'objectpos_over_limit()' was
used as a check, which was inaccurate.
Use the recently added 'saoPosOverLimit()' to get exact mapgen edges.

Also fix default value of 'm_sao_limit_min'.
2017-06-11 02:11:08 +01:00
red-001 25ae0739ed Add a server-sided way to remove color codes from incoming chat messages (#5948)
These code be generated by CSM, a modded client or just copy and pasted by the player.

Changes
- Update configuration example and setting translation file.
- Remove colour codes before logging chat.
- Add setting to remove colour codes before processing the chat.
2017-06-10 13:49:44 +02:00
Loïc Blot ab128e03ff C++11 patchset 6: forbid object copy using assigment/copy function deleters (#5945)
C++11 implement function deleting, it's generally used to prevent some object copy
In script API use this function removal on ScriptApiBase instead of ScriptApiClient/Server/MainMenu, this affect all ScriptApis
Move DISABLE_CLASS_COPY with constructor, the deleted function permit to replace function in its original place
2017-06-10 13:49:15 +02:00
Thomas--S 9c497aa71f Order es_DrawType exactly like enum NodeDrawType in nodedef.h (#5946)
This will help to avoid some strange bugs.
2017-06-10 13:24:05 +02:00
red-001 740b4bec07 Fix sending color codes to clients that don't support them. (#5950)
Also remove `disable_escape_sequences` since it's not needed anymore.
2017-06-09 21:39:25 +02:00
DS 44495ea719 CSM: Fix documentation error for register_on_*_chat_messages (#5917) 2017-06-09 15:48:04 +02:00
red-001 4221c1b441 Have the server send the player list to the client (#5924)
* Have the server send the player list to the client

Currently the client generates the player list based on the Client active object list, the issue with this is that we can't be sure all player active objects will be sent to the client, so this could result in players showing up when someone run `/status` but auto complete not working with their nick and CSM not being aware of the player
2017-06-08 15:30:09 +02:00
Loïc Blot 5bd33a1586 C++11 patchset 5: use std::threads and remove old compat layer (#5928)
* C++11 patchset 5: use std::threads and remove old compat layer

* use pragma once in modified headers
* use C++11 function delete for object copy
2017-06-08 10:40:11 +02:00
Paramat 0a5c3c2852 Autorun: Change to 'autoforward' (#5926)
Minetest does not have 'run'.
Automatic forwards is very often used while flying or swimming, so a general
word is more suitable.
2017-06-08 09:57:00 +02:00
red-001 47bcf2f7ac Use a settings object when generating world.mt and set player_backend to sqlite. (#5940)
* Use a settings object when generating world.mt and set player_backend to sqlite.

* Update subgame.cpp
2017-06-08 09:50:51 +02:00
red-001 c91a8c7061 [CSM] Add function to get player privileges (#5933)
* [CSM] Add function to get player privileges + move related help functions to common

* Added @Zeno- const
2017-06-07 09:09:06 +02:00
Loic Blot 6c55874417
DragonflyBSD & NetBSD build fix 2017-06-06 23:02:03 +02:00
Loïc Blot d4c0f91275 Use C++11 mutexes only (remove compat code) (#5922)
* Fix event LINT & remove default constructor/destructors
* remove compat code & modernize autolock header
2017-06-06 16:29:28 +02:00
Loïc Blot 8bdde45895 Revert "Remove deprecated code segments (#5891)"
This reverts commit 599e13e95e.
2017-06-06 16:19:04 +02:00
Elijah Duffy fee5171298 Main Menu: Add get_clientmodpath API (#5912)
Add `core.get_clientmodpath` to main menu API (also possible in async calls).
2017-06-06 14:34:31 +02:00
Loïc Blot b3dfe5332c C++11 patchset 3: remove Atomic/GenericAtomic and use std::atomic (#5906) 2017-06-06 14:34:14 +02:00
red-001 a6678d6e5a Remove old network code (#5921) 2017-06-06 07:57:35 +02:00
Loic Blot 718121df91
Remove SharedPtr, it's not used and will be never used, we use C++11 2017-06-05 09:36:13 +02:00
Thomas--S 599e13e95e Remove deprecated code segments (#5891) 2017-06-04 21:42:32 +02:00
Loïc Blot a98baef5e4 C++11 patchset 2: remove util/cpp11.h and util/cpp11_container.h (#5821) 2017-06-04 21:00:04 +02:00
Loic Blot bf6569b570 Minetest for C++11 (CMakeLists + Travis)
* Move GCC to GCC 6 & GCC 7
* Move Clang to Clang 3.6 & Clang 4.0
* LINT moves from Clang 3.9 to Clang 4.0
* Move XCode 7.3 to 8.0
* Use more travis tricks to install compilers instead of adding complexity to our build script
* Clang format fixes on checked files (compat Cpp11 instead of Cpp03)
* Mingw GCC update from 4.8.4 to 5.3 (Ubuntu Xenial)
* Drop mingw cmake generated files and add them to gitignore
2017-06-04 09:57:08 +02:00
Casimir 0e58168fe5 Mapgen v6: Use snow blocks in tundra and remove them from taiga (#5827)
* Mapgen v6: Use snow blocks in tundra and remove them from taiga

* Use snowblocks in tundra above dirt with snow
2017-06-04 09:37:30 +02:00
ShadowNinja 7786521f15 Fix segmentation fault with tool capabilities (#5899) 2017-06-03 23:59:17 +02:00
Vincent Glize dd0a058e1f Snake case for screen options in minetest.conf (#5792) 2017-06-03 22:02:07 +02:00
Loïc Blot c6d5441105 Properly remove SAO when worldedges are overtaken (#5889)
* LuaEntitySAO: Remove beyond outermost mapchunk edges

Based on a commit by, and with help from, nerzhul.
Add 2 functions to class Mapgen:
A function to calculate actual mapgen edges, called from the Mapgen constructor.
A function called indirectly from content_sao.cpp per entity step to check SAO
position is within mapgen edges.

* Calculate borders from params not mapgen, which is not available everytime
2017-06-03 19:57:02 +02:00
SmallJoker 7a2b9df970 Tooltips: Unify the tooltip[] and list[] description tooltip display functions (#5848)
* Tooltips: Unify the tooltip[] and list[] description tooltip display functions
2017-06-03 08:55:26 +02:00
Dániel Juhász 001de6ffba Do not shade inventory items with textures (#5869)
This commit restores the old behavior: if an inventory item has an own
inventory texture, it will not be shaded.
2017-06-01 23:18:55 +02:00
Loïc Blot 1c69476d9f Show singlenode mapgen to menu (#5868)
Fix #5867
2017-06-01 23:18:24 +02:00
red-001 a7787bb9d2 Fix dropdown menu selection (#5847)
This fixes a bug that occurred when the selection list of a drop down menu was changed but the name was still the same.
2017-06-01 08:00:26 +02:00
red-001 6444963fb1 Nametag: remove colour codes before calculating alignment. (#5862) 2017-05-31 20:07:33 +02:00
stujones11 1681a009bc Don't add damage flash while punch texture modifier is active (#5767) 2017-05-29 23:26:25 +02:00
Loïc Blot ef152428ef guiVolumeChange: prevent wrong value position by using 1 label instead of 2 (#5839)
* Use only one label instead of two for the soundText, this permit to ensure both label & values are aligned
* Add '%' character too, to reflect it's a percentage volume
* Remove rect on regenerateGui (upper part) which shadows outer part and which is not needed outside of the DesiredRect affectation

Fix issue #5837
2017-05-28 15:23:30 +02:00
paramat 210a339dce Mapgen files: Update and correct copyright credits 2017-05-26 20:46:03 +01:00
SmallJoker d99b6fed55 Time: Change old `u32` timestamps to 64-bit (#5818)
MacOSX build fix + cleanups
2017-05-26 14:03:36 +02:00
Loïc Blot 4d5ce8478c Enhance ABM performance a little bit by removing two std::set copy (#5815)
* Enhance ABM performance a little bit by removing two std::set copy

* ActiveBlockModifier::getTriggerContents now returns a const ref
* ActiveBlockModifier::getRequiredNeighbors now returns a const ref
* ActiveBlockModifier::getRequiredNeighbors is now purely virtual

* Little code style fix
2017-05-25 16:43:55 +02:00
Paramat 5b338638e0 Mgv6 mudflow: Remove decoration if 'dirt with grass' below flows away (#5798)
Mudflow of a neighbouring mapchunk extends into a mapchunk's edge, and could
remove 'dirt with grass' from under a decoration, creating unsupported
decorations.

Remove any decoration above if a 'dirt with grass' node is removed by mudflow.
2017-05-25 12:46:34 +02:00
red-001 2f291e6685 Close formspec on client shutdown. (#5811)
This ensures the shutting down progress bar is correctly rendered. This fixes #3050.
2017-05-25 12:46:24 +02:00
Loïc Blot 099624a513 Revert 1469424 and fix wrong char position when doing mouse selection on intlGUIEditBox (#5806)
* Revert 1469424075 and fix wrong char position when doing mouse selection on intlGUIEditBox

position should look at current line not the whole text and shift 1 character on the last line (due to \0 string delimiter)

* Finish the fix and prevent values under zero for getCursorPos which crash the program if found

* Forget to remove old comment

* fix zero to NULL

* Fix typo
2017-05-24 08:56:40 +02:00
Loic Blot c445a3d958
Fix wrong return value in get_sky Lua call since ad9fcf859e
Fix #5803
2017-05-23 19:59:47 +02:00
Paramat 9ff5302c8b Client crashfix: load meta after digging (#5801)
Fixes a crash caused in MTGame by breaking and right-clicking a chest.

If loading meta, digging, node can disappear and we looked at meta, which is wrong because meta became NULL.

Pointer is invalidated and we read wrong memory area
2017-05-23 19:54:37 +02:00
Loic Blot 05309229b8
LINT fix & check all files with clang-format
Seems the diff mode doesn't work well, PR are detected as working whereas in master it's shown it's problematic (and really problematic). Use same check everywhere
2017-05-22 07:28:35 +02:00
Pierre-Adrien Langrognet 39f4a2f607 [CSM] Add send_chat_message and run_server_chatcommand API functions (#5747)
* [CSM] Add send_chat_message and run_server_chatcommand API functions

* Add client-side chat message rate limiting

* Limit out chat queue size

* [CSM] Add minetest.clear_out_chat_queue API function and .clear_chat_queue chatcommand

* Last fixes/cleanups before merge
2017-05-21 23:06:51 +02:00
Loic Blot de840fe271
Fix LINT broken by dfa0c15ce0 2017-05-21 17:30:00 +02:00
bigfoot547 dfa0c15ce0 [CSM] Add function to get the definition of items (#5732)
Add node def and item def documentation.

Please be ready for merge!
2017-05-21 14:40:55 +02:00
red-001 ae483f1bd0 Prevent fall damage from overflowing when falling from a large height. (#5791) 2017-05-21 11:18:38 +02:00
Loïc Blot 90808a4f34 Real control fix (#5787)
* Allow enabling and disabling mods.

* Re-fix 605599b6f1

This breaks some chars like € in chat.

Instead verify is char is a non control char -> iswcntrl
2017-05-20 22:29:15 +02:00
you 358074b296 Fix instant digging (#5785)
Use runData.dig_time_complete instead of params.time to find out whether it's instant digging.
runData.dig_time_complete is set to something very big if the node can't be dug, whereas param.time is 0 when digging is impossible or it's instant digging. So not using param.time fixes #5728.
2017-05-20 20:43:13 +02:00
Loic Blot a2bb776ea8
Fix wchar_t type on 605599b6f1
event.KeyInput.Char is a wchar_t, iswprint should be used
2017-05-20 20:13:29 +02:00
Paramat 60baf8120c Particle spawner: Do not spawn particles distant from player (#5766)
Previously, every particle was rendered by (even if not actually visible to)
the client regardless of distance. This significantly reduced client FPS.

Acts clientside, particle spawners are always sent to clients, but each
particle is checked for distance from the player.
As with 'add particle' the distance limit is set to 'max block send distance'
as this determines how far a client can see.
2017-05-20 16:46:35 +02:00
SmallJoker af2f02552f [CSM] Correct the log destination of print() (#5784) 2017-05-20 16:46:12 +02:00
red-001 772944daf6 Fix CSM crash (#5779)
Caused by dc5bc6c and them made worse by 5ebf8f9
2017-05-20 16:45:49 +02:00
Loïc Blot 8797a0aa4b chat.cpp fix wchar_t isspace -> iswspace & wrong isspace on an index (#5783) 2017-05-20 12:56:02 +02:00
numberZero 7779bac3a5 Cleanup in content_mapblock (#5746)
NDT_LIQUID is being drawn by MapBlockMesh since a long time ago...
2017-05-20 12:29:54 +02:00
red-001 1ff5ee0b69 Improve password change menu (#5757)
- Fix the GUI getting messed up when resizing
- Save the input when resizing
2017-05-20 12:29:44 +02:00
Craig Davison 605599b6f1 Fix shift key producing space in console (#5777)
* Fix shift key producing space in console
2017-05-20 12:29:31 +02:00
red-001 00972d42d7 this might fix #5661, needs testing (#5775) 2017-05-20 10:48:44 +02:00
Loic Blot 1469424075
Fix input regression introduced by a4a377ecad
Fix #5776
2017-05-20 10:12:54 +02:00
Zeno- d176dabeb4 Fix mem leak in mesh cache (#5781) 2017-05-20 08:16:16 +02:00
Loïc Blot ce9802266e Various code cleanup & little performance improvement on HTTP download (#5772)
* Disable or remove unused enum members/functions
* Tiny code style fixes
* Make some functions const
* Replace ClientMediaDownloader std::unordered_map with std::map
2017-05-20 08:15:56 +02:00
you 35267406aa Do not create dummy normalmaps (#4180)
fixes #1811
2017-05-19 08:08:12 +02:00
you a4a377ecad Fix textarea bug: clicking right of the end of a line caused the cursor to be in one of the next lines (#3474) 2017-05-19 07:57:21 +02:00
Dániel Juhász 75c393c915 Fix alpha for liquid nodes (#5494) 2017-05-19 07:46:10 +02:00
SmallJoker 674400523e Mainmenu: Fix issues while trying to enable all mods (#5770) 2017-05-19 07:45:47 +02:00
Loïc Blot e25a38e3fb When minimap is disabled in configuration, really disable it (#5771)
* When minimap is disabled in configuration, really disable it
2017-05-19 07:25:27 +02:00
Loic Blot 1c6d2f596d
Fix a warning pointed by GCC 7.1
lua_tonumber overflow in snprintf (12 bytes and only 10 can be written)
2017-05-18 20:55:27 +02:00
Paramat 0443620c5e Particles: Do not send single particles to distant clients (#5760)
Previously, every individual particle on a server is sent to, and rendered by
(even if not actually visible), every client regardless of distance. This
significantly reduces client FPS and creates unnecessary network traffic.
Maximum distance is set by 'max block send distance' as this determines how far
a client is able to see.
2017-05-17 10:37:28 +02:00
paramat fd32005b0f Caverns: Remove unnecessary liquid excavation
Also disable CavesRandomWalk at a safer distance from caverns.

Excavating liquids in cavern code is unnecessary as in practice we are already
successfully disabling the generation of liquid caves that could intersect
with caverns and cause excessive amounts of spreading liquids in caverns.

However to be safer this commit now disables liquid caves at a larger distance
from caverns, to compensate for liquid caves being able to generate up to a
mapblock beyond a mapchunk border.

Not excavating liquids in cavern code also allows a feature i am working on in
experimental new core mapgens, but also allows for more flexibility in future.
2017-05-16 21:56:51 +01:00
Loic Blot 582ee15d8e
Fix a memleak pointed by @Zeno- in MeshUpdateQueue
This leak was introduced when added cache to MeshUpdateQueue and only occurs when leaving world.
2017-05-16 08:27:18 +02:00
Zeno- 1bf9b25fb4 Fix uninitalised variable in event.cpp (#5764) 2017-05-15 20:10:29 +10:00
ezhh 018217f6b2 Add option to use neither node highlighting nor outlining 2017-05-15 19:51:40 +10:00
SmallJoker febd07fc0d No cursor lock when window inactive (#5754) 2017-05-13 17:42:42 +02:00
Loïc Blot 6673aff685 Limit properly the sound setting at updateSound runtime step (#5753)
* Limit properly the sound setting at updateSound runtime step

Fix #5026

* Add a comment
2017-05-13 12:03:11 +02:00
Loïc Blot 9b8ca3a746 Move KeyList & InputHandler from game.h to client/inputhandler.h (#5752)
* Move KeyList & InputHandler from game.h to client/inputhandler.h

We have a header for inputs, move inputhandler class & related keylist object to it

Also introduce a cpp file for MyEventReceiver::OnEvent function in inputhandler.h because a so huge function doesn't needs to be inlined

* Pass clang-format on inputhandler.{cpp,h} (compatible)
2017-05-13 11:05:16 +02:00
Loic Blot 5cb7f6a9b7
Android build fix 2017-05-13 09:10:43 +02:00
red-001 98327a59c4 Minor pause/escape menu improvements (#5751)
- Split movement keys into separate entries.
- Increase buffer size due to the above change.
- Change capitalisation.
- Remove code-style violating white spaces.
2017-05-13 08:50:19 +02:00
red-001 0e0c824ea7 Rework escape/pause menu (#5719)
* Rework escape/pause menu

- Remove build information
- Use current controls instead of default controls
- Add information about the current server in place of the build information
- Add text saying the game is paused to if in singleplayer mode.
rework pause/escape menu

* improve consistency + display server_name
2017-05-11 10:39:37 +02:00
sfan5 071e114ffa Private nodemeta (#5702)
* Private node metadata that isn't sent to the client
2017-05-10 15:29:21 +02:00
red-001 8729e7daec Add cancel button to password change menu. (#5720)
* Add cancel button to password change menu.
2017-05-09 11:04:45 +02:00
paramat da88a18676 Revert custom player collision box and step height commits
These caused inability to pass through 2 node high spaces or step up onto slabs
or steps when a new client connected to an older server.
2017-05-09 03:52:28 +01:00
Loïc Blot c07c642ab0 read_schematic_replacements: ensure fields are strings (#5726)
* read_schematic_replacements: ensure fields are strings

add a type check before reading strings on read_schematic_replacements deserializer

* throw LuaError instead of asserting the whole client
2017-05-08 20:43:03 +02:00
paramat 5e04f1a335 Custom step height: Fix implementation
Recent commit 45ab62d6a3 had a coding error that
made climbing out of water difficult due to an incorrect value of the step height
when not 'touching ground'.
It also incorrectly multiplied the custom stepheight by BS, resulting in being
able to step-up 2 nodes if set to the default of 0.6, or even 0.3.
Also the implementation was wrong because it customised the step height when
not 'touching ground', this step height is for a slight rise when catching the
edge of a node during a jump, and should always remain at 0.2 * BS.
2017-05-08 05:59:19 +01:00
paramat 3342dcc4bc Shaders: Remove unused water surface shader
Also remove hardcoded MTGame node.

The 'water surface shader' was duplicated shader code in preparation for
intended new water surface shaders. For development purposes the MTGame node
'default:water_source' had it's top tile assigned to 'water surface shader'.
Due to shader duplication this commit does not cause any change to shader
behaviour.
2017-05-08 05:58:59 +01:00
Loïc Blot c1b3ed4180 Player attrs: permits to remove an attribute by setting value to nil (#5716)
* Player attrs: permits to remove an attribute by setting value to nil

When doing player:set_attribute("attr", nil) remove attribute

Also remove a useless check on C++ API part (already done by checkplayer)

Fix #5709
2017-05-07 12:13:15 +02:00
Loic Blot 0d7c37943b
LINT fix since d067894816 2017-05-07 11:07:17 +02:00
paramat 2d5bd7f414 Player properties: Set correct default collisionbox
Recent commit b6f4a9c7e1 removed a hardcoded
player collisionbox which resulted on falling back to an incorrect default.
This stopped players walking through 2-node high spaces and made the player
slightly wider.

Improve docs for custom player collisionbox feature and reformat nearby lines.
2017-05-07 06:10:13 +01:00
T0ny2 d067894816 Replace occurrence of luaL_reg in l_camera.cpp
Related to commit 41c5483. Replace an occurrence of luaL_reg in
src/script/lua_api/l_camera.cpp (added by commit de028fc).
2017-05-07 06:09:30 +01:00
ShadowNinja c6e96c645b Fix myfloor(0.0) 2017-05-06 16:10:03 -04:00
ShadowNinja 77597c4ff3 Clean up numeric.h and split FacePositionCache from it
I also optiized FacePositionCache a bit: I removed a map
lookup and vector copy from both branches of getFacePosition.
2017-05-06 16:09:45 -04:00
TeTpaAka b6f4a9c7e1 Make the player collisionbox settable 2017-05-06 15:41:05 -04:00
ShadowNinja 43d1f375d1 Use a settings object for the main settings
This unifies the settings APIs.

This also unifies the sync and async registration APIs, since the async
registration API did not support adding non-functions to the API table.
2017-05-06 15:33:19 -04:00
Loic Blot a024042bf5
Fix codestyle since CSM Camera API 2017-05-06 21:30:27 +02:00
Wuzzy 07c17db114 Add configurable key bindings for hotbar scrolling, and for changing volume. 2017-05-06 21:21:59 +02:00
Sapier 45ab62d6a3 Use stepheight from CAO instead of hardcoded value 2017-05-06 21:18:17 +02:00
red-001 5ebf8f9450 [CSM] add `on_item_use` (#5544) 2017-05-06 21:12:44 +02:00
TeTpaAka 6658ad3d94 Make players respect makes_footstep_sound in the object properties 2017-05-06 20:16:16 +02:00
bigfoot547 de028fc056 [CSM] Add camera API (#5609)
* [CSM] Add camera API
roper rebase & squash

* Address nerzhul's review
2017-05-05 22:07:36 +02:00
Paramat e8b00fdf98 Clouds API: Fix yellow clouds at dawn and dusk (#5707) 2017-05-05 22:07:25 +02:00
Loic Blot 7c82f1e5dd
Add missing server sending rule for bd921a7916 2017-05-05 20:21:04 +02:00
Wayward One fe247f38f7 Fix Android build (#5706)
* Fix Android build
2017-05-05 17:27:50 +02:00
Loïc Blot 21e0a049f8 Save minetest screen width/height options when modified (#5683)
* Save minetest screen width/height options when modified

* Add autosave_screensize setting (default true)

* Fix @SmallJoker comments
2017-05-05 13:47:11 +02:00
red-001 d6cf5450a8 Add option to also check the center to `find_node_near` (#5255)
* Add option to also check the center to `find_node_near`
2017-05-04 22:52:58 +02:00
Vaughan Lapsley c874bfa5c3 Remove CMAKE -ffast-math flag from OSX/FreeBSD
Fixes issue: #4274

I have tested on MacOS 10.12.4

Requires testing on:
FreeBSD, Windows and Linux which I do not have access to.
2017-05-04 13:24:36 +02:00
Loic Blot 9a9ae7d65c
LINT fix since cloud API merge 2017-05-04 07:52:31 +02:00
paramat dd591119a3 Directional coloured fog: Fix order of SColor components
'video::SColor pointcolor' was initialised with order RGBA instead of ARGB.
No change in behaviour as 'm_bgcolor' has alpha 255.
2017-05-04 04:26:06 +01:00
paramat 76ec6b8313 Clouds: Fix reddish clouds. Add missing alpha update
Fix accidental swap of red and blue components that caused reddish clouds
Add missing update of alpha in remoteplayer.cpp
2017-05-04 04:26:06 +01:00
red-001 ae0d8f74d7 Add function to get server info. 2017-05-04 04:25:45 +01:00
SmallJoker 468eeb618e Fading soungs: Fix client crash on older servers 2017-05-03 13:48:46 +02:00
paramat ad9fcf859e Set sky API: Add bool for clouds in front of custom skybox
Default true.
Add 'm_clouds_enabled' bool to sky.h, set from new bool in 'set sky' API.
Make 'getCloudsVisible()' depend on 'm_clouds_enabled' instead of
'm_visible' (whether normal sky is visible).
2017-05-02 20:42:35 -07:00
SmallJoker f9fdb48dc8 Sneak: Improve and fix various things
Remove useless `got_teleported`.
Fix jitter when walking against the sneak limits.
Fix damage evading on sneak ladders.
2017-05-03 03:16:20 +01:00
Brandon bd921a7916 Sound API: Add fading sounds 2017-05-03 03:12:45 +01:00
Ben Deutsch f1d7a26b7c Add clouds API 2017-04-30 00:06:13 +01:00
Loïc Blot 95409da87d Optimize updateFastFaceRow processing by removing some TileSpec copy (#5678)
* Optimize updateFastFaceRow processing by removing some TileSpec copy

It permit to decrease this function from 54% runtime to 45% and reduce copy from 14% runtime to 12.5%
getTileInfo also reduced from 27% to 23%

* makeFastFace should use a const ref too

this trigger a const pointer need in the underlying function

Also fix some code style and prevent calculating 4 times the same position at a point

* Reduce a comparison cost for lights in updateFastFaceRow
2017-04-29 20:36:09 +02:00
shivajiva101 c729543ec4 Fix visual slide issue with set_detach, fixes #5620 2017-04-29 18:18:46 +02:00
Loïc Blot 3251e44938 content_cao: fix getPlayerControl structure copy on each step (#5677)
Also fix some codestyle issues around it.
2017-04-29 18:16:58 +02:00
Loïc Blot 3db66b4531 Client & ClientEnvirnment: don't create fake events (#5676)
Instead of create fake events on the stack on each loop call (Game::run), verify is queue is empty or not and handle event directly if there is.

This prevents fake ClientEvent creation & memory allocations

Same fix is also applied on ClientEnvironment, & rename getClientEvent to getClientEnvEvent to match ClientEnvEvent object
2017-04-29 17:25:25 +02:00
SmallJoker f727f54192 Fix Travis/unittest broken since b662a45 2017-04-29 16:40:56 +02:00
Loic Blot 9762650f97
Remove legacy unused define DIGGING_PARTICLES_AMOUNT 2017-04-29 12:18:58 +02:00
Vincent Glize dc5bc6cac7 [CSM] Add event on_place_node API lua (#5548)
* [CSM] Add event on_place_node API lua
2017-04-29 12:08:16 +02:00
Loic Blot ecf08255b0
Fix Lint broken by b662a4577d 2017-04-29 09:47:22 +02:00
Auke Kok 1ecc8756bc Reorder TileLayer. (#5638)
Despite the split of TileSpec into TileDef and TileLayer, the
TileLayer struct is still 66 bytes large, and doesn't fit in
a single cacheline.

I'm moving the color member to cacheline 2, in the hope that it
is less used and the compiler loads all the hot members in a single
cacheline instead. Only color sits now in cacheline 2, all the
other members are in cacheline 1.

Note: is_color is probably rarely set, most nodes will likely
not use hardware coloring, but this may change in the future.
Ideally, this class is shrunk to 64 bytes.
2017-04-29 09:16:32 +02:00
Vincent Glize 19960e26c6 [CSM] add screenshot api lua (#5674)
* [CSM] add screenshot api lua
2017-04-29 09:16:06 +02:00
ShadowNinja b662a4577d Clean up getTime helpers
This increases size of the getTime return values to 64 bits.
It also removes the TimeGetter classes since the getTime functions
are now very precise.
2017-04-28 14:43:18 -04:00
you 7f4cdbcbe9 Fix click-digging torches (#5652)
Torches are dug instantly again.
When the digging time is 0, a delay of 0.15 seconds is added between digging nodes. If the left mouse button is released, the delay is set to 0, thus click-digging.
2017-04-28 20:12:28 +02:00
Auke Kok e21a1ab3bd Allow mesh and nodeboxes to wave like plants or leaves. (#3497)
We introduce a new value for "waving" - 2:

0 - waving disabled
1 - wave like a plant
2 - wave like a leave

Plantlike nodes will only allow waving = 1, but for leaves we will
permit both 1 and 2 since current minetest_game sets it to 1 for
all leaves. This makes it somewhat backwards compatible.

For mesh and nodebox, values 1 and 2 are both valid, and the node
can wave in both fashions as desired.

I've tested this with the crops:corn plants, which are mesh nodes,
and the results are really good. The code change is trivial as
well, so I've opted to document the waving parameter in lua_api.txt
because it was missing from there.

Nodeboxes likely will not wave properly unless waving = 2. However
it's possible that waving=1 may be desired by some mod developers
for geometries I have not tried, so the code will not prohibit
either value for mesh and nodebox drawtypes.

Add lua_api.txt documentation for this feature and document both
the existing functionality and the expansion to mesh and nodebox
drawtypes.
2017-04-28 20:11:43 +02:00
Louis Pearson 04ba2d2721 Search user path for sounds (#5657) 2017-04-27 21:33:59 +10:00
Loïc Blot b82e5ec880 Don't permit to copy Scripting classes (Client,Server,Mainmenu) 2017-04-27 11:52:44 +02:00
red-001 1ef9eee311 Allow scripts to get the client protocol version in non-debug builds. (#5649) 2017-04-27 11:49:44 +02:00
red-001 ff1ef67dcc Fix #5655 (#5658)
Client: Don't send `TOSERVER_RECEIVED_MEDIA` since it's not used anymore
Server: Handle `TOSERVER_RECEIVED_MEDIA` using `Server::handleCommand_Deprecated`
2017-04-26 21:10:13 +02:00
ShadowNinja 2818d3f224 Rename Scripting API files for consistency 2017-04-25 13:41:36 -04:00
Louis Pearson db17225a97 Footsteps without view bobbing (#5645)
* Remove redundant view_bobbing setting

Also fixes bug where disabling view_bobbing disables footstep sounds.

* Removes redundant view_bobbing setting

Setting view_bobbing amount to 0 is now the only way to
turn view_bobbing on and off. Also fixed a bug where footstep
sounds would not play when view_bobbing was disabled.
2017-04-25 21:11:51 +10:00
Loïc Blot a7e131f53e Fix various points reported by cppcheck (#5656)
* Fix various performance issues reported by cppcheck + code style (CI)

* Make CI happy with code style on master
* guiFileSelectMenu: remove useless includes
* some performance fixes pointed by cppcheck
* remove some useless casts
* TextDest: remove unused setFormSpec function

* Fix various iterator post-increment reported by cppcheck
2017-04-25 10:21:42 +02:00
Loic Blot d7ddceac73
Fix lint since recent player to db merge 2017-04-23 16:22:53 +02:00
Loïc Blot 29ab20c272 Player data to Database (#5475)
* Player data to Database

Add player data into databases (SQLite3 & PG only)

PostgreSQL & SQLite: better POO Design for databases

Add --migrate-players argument to server + deprecation warning

* Remove players directory if empty
2017-04-23 14:35:08 +02:00
Loic Blot dda171d292
LINT fix 2017-04-23 10:24:00 +02:00
Loïc Blot 91a9382c25 Pass clang-format on various cpp/header files (#5559) 2017-04-23 09:52:40 +02:00
red-001 0c34fe20a1 Network:Remove old opcodes and fix documentation. (#5573) 2017-04-22 13:59:02 +02:00
paramat 4c03190ce8 Mgflat, Mgv7: Fix noise crash on world exit.
Fix crash caused by destructor 'delete' on noise objects that are not
created due to mapgen options.
Crash was caused by commit 57eaf62c69
2017-04-22 05:37:33 +01:00
paramat 57eaf62c69 Mgflat, Mgv7: Only create noise objects if needed 2017-04-22 01:24:03 +01:00
paramat 58c083f305 Sneak glitch: Set default to false
The 'sneak glitch' physics override now controls whether a player can
use the new move code replications of the old sneak side-effects:
sneak ladders and 2 node sneak jump. This completes our intention to
replicate the old sneak side-effects in new code and provide them as
an option that is disabled by default.
2017-04-22 01:23:57 +01:00
Auke Kok cca58fe0fd Add on_flood() callback.
This callback is called if a liquid definitely floods a non-air
node on the map. The callback arguments are (pos, oldnode, newnode)
and can return a `bool` value indicating whether flooding the
node should be cancelled (`return true` will prevent the node
from flooding).

Documentation is added, the callback function was tested with a
modified minetest_game.

Note that `return true` will likely cause the node's `on_flood()`
callback to be called every second until the node gets removed,
so care must be taken to prevent many callbacks from using this
return value. The current default liquid update interval is 1.0
seconds, which isn't unmanageable.

The larger aim of this patch is to remove the lava cooling ABM,
which is a significant cost to idle servers that have lava on their
map. This callback will be much more efficient.
2017-04-22 01:23:51 +01:00
Dániel Juhász 8464da7585 Fix a memory leak (#5636) 2017-04-22 00:55:07 +02:00
Loic Blot 3e71c8f482
Fixing warning pointed by @sfan5 and clang and cleanup guiFileSelectMenu
* Also pass clang-format on guiFileSelectMenu.h and remove it from whitelist
2017-04-22 00:51:56 +02:00
Loic Blot 4f4e2e3e83
Revert a const ref on update texture
if mod is a reference to a class member a variable swap breaks.
We should find a way to keep this const ref if possible.
Added a comment about this in header
2017-04-22 00:36:59 +02:00
Loïc Blot 113c85a66a lua: remove core.cause_error call (#5637)
it was used in minimal to trigger core crash, not very useful
2017-04-22 00:34:00 +02:00
Loïc Blot dc0e9097d3 Fix various performance issues reported by cppcheck + code style (CI) (#5635)
* Make CI happy with code style on master
* guiFileSelectMenu: remove useless includes
* some performance fixes pointed by cppcheck
* remove some useless casts
* TextDest: remove unused setFormSpec function
2017-04-21 23:40:48 +02:00
orwell96 f151b23220 Fix #5617 - respect message and reconnect parameters when shutting down immediately (#5621) 2017-04-21 19:31:59 +02:00
Dániel Juhász 900b816162 Fix after soft node overlays
This removes a segmentation fault and makes node meshes well colorized.
2017-04-21 19:18:09 +02:00
Dániel Juhász 1ffb180868 Soft node overlay (#5186)
This commit adds node overlays, which are tiles that are drawn on top of
other tiles.
2017-04-21 23:34:59 +10:00
Loïc Blot 370354cc87 Fix various performance issues reported by cppcheck (#5628)
* Also remove 1 non declared but defined functions
2017-04-21 10:06:08 +02:00
Ekdohibs de5ecc9fa3 Run generate_from_settingtypes.lua 2017-04-20 06:06:15 +02:00
Dániel Juhász 57e5aa6628 Light update for map blocks
This is not really different from the light update of a voxel
manipulator. This update does not assume that the lighting was correct
before, therefore it is useful for correction.

Also expose this function to the Lua API for light correction, and
allow voxel manipulators not to update the light.
2017-04-20 05:39:14 +02:00
Dániel Juhász 6d1e6f8898 Split light update into two parts
The common part can be reused.
2017-04-20 05:31:50 +02:00
Loïc Blot f98bbe193e Fix various copy instead of const ref reported by cppcheck (part 3) (#5616)
* Also remove 2 non declared but defined functions
* Make some functions around const ref changes const
2017-04-20 00:12:52 +02:00
Loïc Blot f3fe62a0bf Fix various copy instead of const ref reported by cppcheck (#5615)
* Also remove InventoryList::peekItem unused function
* Fix some post increment to preincrement reported by cppcheck
2017-04-19 23:02:07 +02:00
Hybrid Dog 858c722974 Tools: Fix tool digging speed limit 2017-04-19 02:01:15 +01:00
Loïc Blot cf37a55690 Fix various variables passed by copy instead of const ref (#5610)
Pointed by cppcheck
2017-04-19 00:36:30 +02:00
Loïc Blot 5f2af7c4e8 Fix broken lint since 04cc9de8f2 2017-04-18 17:13:50 +02:00
Auke Kok 93c1d511e3 Reorder TileSpec. (#5591)
Put accessed members that are needed by updateFastFaceRow()
all in the same cacheline.
2017-04-18 07:48:17 +02:00
Ekdohibs eddf16eee9 Fix always using the xbox layout (reported by coverity). 2017-04-18 06:47:08 +02:00
Auke Kok 5433e9bd19 Don't make TAB exit game if bound to inventory.
I play with the TAB key bound to the inventory. However, the
code here assumes that TAB means "close formspec" in all contexts,
including the main menu. This causes my game to exit when I attempt
to TAB in between USERNAME and PASSWORD fields.

We know when m_client != NULL that the game is a client game and
not in the main menu, and then it's OK to use the INVENTORY bound
key to exit the formspec, since it's not the main menu.
2017-04-17 21:45:40 -07:00
SmallJoker 6120251320 Fix MSVC build broken by 34d32ce
`round` -> `myround`
Remove superflous `floor` calls
2017-04-17 14:02:26 +02:00
Perttu Ahola 04cc9de8f2 MeshUpdateQueue: Add a MapBlock cache that minimizes the amount of MapBlock copying done in the main thread
Cache size is configurable by the meshgen_block_cache_size (default 20 MB).

New profiler stats:
- MeshUpdateQueue MapBlock cache hit %
- MeshUpdateQueue MapBlock cache size kB

Removes one type of stutter that was seen on the client when received MapBlocks
were being handled. (the "MeshMakeData::fill" stutter)

Kind of related to at least #5239

Originally preceded by these commits, now includes them:
- Move the mesh generator thread into src/mesh_generator_thread.{cpp,h}
- mesh_generator_thread.cpp: Update code style
- MeshUpdateThread: Modify interface to house a different implementation: Actual functionality will be changed by next commits.
- MeshMakeData: Add fillBlockData() interface (so that caller can fill in stuff from eg. a MapBlock cache)
2017-04-17 14:58:29 +03:00
Perttu Ahola 4323ad163f Include container.h in util/thread.h. util/thread.h doesn't compile without it 2017-04-17 14:58:29 +03:00
paramat f6da7b3fda Sneak: Add option for old move code
Temporary option for the old move code for specific old sneak behaviour.
Enabled by setting the added 'new move' physics override to false.
By default 'new move' is true.
2017-04-17 10:13:05 +01:00
Loic Blot 907be0ab91
Remove an unused variable in Android Build 2017-04-17 09:37:12 +02:00
Auke Kok 97988a1044 Plug two minor Leaks (#5603)
* Resource leak: CHECK_FILE_ERR returns, without freeing chunk_name.

Found with static analysis.

* Resource leak: leaks `page` on error path.

Found with static analysis.
2017-04-17 09:04:58 +02:00
Loïc Blot 73de17afa8 Android progressbar fix (#5601)
* Fix progressbar for Android

Fixes #5599
Fixed #5403 

* draw_load_screen: use texturesource
  this permits to unify texture loading code
* scale progress bar

* Add gl version check for GL_OES_texture_npot. This fixed the texture on loading screen

* Remove two sanity checks pointed by @celeron55

* sfan5 comments + android ratio fixes
2017-04-16 14:44:15 +02:00
Loïc Blot 34d32ce55a Implement delayed server shutdown with cancelation (#4664) 2017-04-15 23:19:18 +02:00
SmallJoker 0f955bf7fa Minimap: Do a double-typecast to fix compiling with MSVC 2017-04-15 14:30:27 +02:00
Loïc Blot a9aad4d061 Partial damage cheat fix: node damages server side (#4981)
* Damage cheat fix: server side

* Lava/Node damages overtime server side
* lava hurt interval is only for old protocol
2017-04-15 09:25:43 +02:00
Loic Blot b1e6c2a9b8
NetworkPacket: don't copy push std::string and std::wstring 2017-04-14 18:26:24 +02:00
Loic Blot 093e621643
Fix wrong channel type in Client/Server CommandFactories
This is a u8 not a u16
2017-04-14 15:56:40 +02:00
Loïc Blot b0be7ab61e ClientIface::sendToAll: honor packet configuration (#5590) 2017-04-14 15:34:01 +02:00
bigfoot547 e80a83d1cb [CSM] Add function to set minimap shape (#5569)
* [CSM] Add function to set minimap shape

Also deprecates `toggle_shape`.

* Oh fish, I messed that one up!

* Fix Style

* Sorry, I missed something

I still had the `luamethod` call in there!

* Add getters

* Remove extra line

* Remove useless variable

Please review again @nerzhul . Thanks!

* Satisfy nerzhul
2017-04-14 09:04:41 +02:00
Dániel Juhász 6f641df8a5 Only use palette if param_type2 is correct 2017-04-13 09:52:48 -07:00
Dániel Juhász 021e667511 Add documentation for map block format 27 (#5576) 2017-04-13 10:19:46 +02:00
numberZero 83508277ce Fix inability to change metadata using stack:to_table() (#5547) 2017-04-12 16:51:07 +02:00
Loic Blot 1399678ffd
Fix fips_cipher_abort warning and other duplicate macros 2017-04-12 09:06:26 +02:00
t0ny2 a3e7372686 Replace occurrence of luaL_reg in l_localplayer (#5566)
Related to commit 41c5483. Replace a final occurrence of luaL_reg in
src/script/lua_api/l_localplayer.cpp
2017-04-11 19:29:24 +02:00
paramat 59911761ef Sneak glitch: Detect ledge for 2-node climb-up
Re-creates the old sneak-jump behaviour in new code.
Enabled by the 'sneak glitch' physics override.
When a ledge is detected the jump speed modifier is set to the larger
of 'physics override jump' and 1.3 to allow a 2-node climb-up.

An unexpected side-effect is the simple sneak ladder working smoothly.
2017-04-11 05:41:13 +01:00
Loïc Blot 0bc306e337 Clang-format fix for Android 2017-04-10 09:40:06 +02:00
Loïc Blot b4106ca58f Clang-format styles fixes since previous commit 2017-04-10 09:17:53 +02:00
Loic Blot 0419552c92
Clang format: fix LINT on old PR which doesn't have LINT enabled 2017-04-10 08:05:03 +02:00
number Zero 0a8834608d Hard-coded undersampling.
Adds uniform undersampling for the 3D rendered scene. GUI elements
are not undersampled, resulting in better playability for users
with low-performance platforms with readable fonts and formspecs.

The undersampling setting can be set to 0 (disabled), 2, 3, 4 pixels
which translates into a resolution reduction of x4, x9 or x16, and
is significant.
2017-04-09 17:30:19 -07:00
Vincent Glize 8ad3dad137 LocalPlayer api lua 2017-04-08 22:04:30 -07:00
Dániel Juhász 58d83a7bb2 Hardware coloring for itemstacks
Adds the possibility to colorize item stacks based on their metadata.

In the item/node definition you can specify palette (an image file)
and color (fallback color if the item has no palette or metadata).
Then you can add palette_index to the metadata.

Dropped itemstacks with different colors do not merge.
2017-04-08 18:39:15 -07:00
red-001 d4e9dd4643 Move chat command handling code from C++ to Lua (#5528) 2017-04-08 20:03:57 +02:00
Loïc Blot 41c5483024 Replace luaL_reg with luaL_Reg as recent LuaJIT dropped the Lua 5.0 compat (#5541)
We are bundling Lua5.1 which has same macro
2017-04-08 09:28:37 +02:00