Commit Graph

4632 Commits

Author SHA1 Message Date
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