Commit Graph

525 Commits

Author SHA1 Message Date
Loic Blot 119aa5c919 Fix crash due to missing pointer validation
Based on commit 014a1a0
2018-06-10 17:18:11 +02:00
Dániel Juhász 2c450ed93f Fix Android node selection distance (#6187) 2018-06-03 17:31:59 +02:00
SmallJoker 037b01eac7 Trigger on_rightclick regardless on the formspec meta field
Document behaviour for older clients.
2018-06-03 17:31:59 +02:00
Fixer c789c532bb Full viewing range key message clarified
To make it sound less confusing to players
2018-06-03 17:31:59 +02:00
Dániel Juhász 322e5aaf92 Automatic item and node colorization (#5640)
* Automatic item and node colorization

Now nodes with a palette yield colored item stacks, and colored items
place colored nodes by default. The client predicts the colorization.

* Backwards compatibility

* Use nil

* Style fixes

* Fix code style

* Document changes
2018-06-03 17:31:59 +02:00
ShadowNinja cba783f7fa Fix segmentation fault with tool capabilities (#5899) 2018-06-03 17:31:59 +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
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
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
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
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
Wuzzy 07c17db114 Add configurable key bindings for hotbar scrolling, and for changing volume. 2017-05-06 21:21:59 +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
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 ae0d8f74d7 Add function to get server info. 2017-05-04 04:25:45 +01: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
Ben Deutsch f1d7a26b7c Add clouds API 2017-04-30 00:06:13 +01: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
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
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
Louis Pearson 04ba2d2721 Search user path for sounds (#5657) 2017-04-27 21:33:59 +10:00
ShadowNinja 2818d3f224 Rename Scripting API files for consistency 2017-04-25 13:41:36 -04: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
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 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
Ekdohibs a5c9174bad Fix spacing 2017-04-06 21:27:29 -07:00
Ekdohibs 08b680d588 Fix problems when overriding the hand:
- If the hand can dig a node the item wielded can't, allow to dig it anyway.
- Fix the API callbacks from setting the hand instead of the wielded item.
2017-04-06 21:27:29 -07:00
orwell96 63e175dd70 Show media download progress in percent on progress screen (#5498) 2017-04-07 00:03:29 +02:00
red-001 e70e15134c Change command prefix to "." and add "help" command. 2017-03-26 05:51:14 +01:00
Loïc Blot 072bbba69a Some performance optimizations (#5424)
* Some performance optimizations

This is globally removing some memory useless copy

* use a const ref return on std::string Settings::get to prevent data copy on getters which doesn't need to copy it
 * pass some stack created strings to static const as they are not modified anywhere
 * Camera: return nametags per const ref instead of a list pointer, we only need to read it
 * INodeDefManager: getAll should be a result ref writer instead of a return copy
 * INodeDefManager: getAlias should return a const std::string ref
 * Minimap: unroll a Scolor creation in blitMinimapPixersToImageRadar to prvent many variable construct/destruct which are unneeded (we rewrite the content in the loop)
 * CNodeDefManager::updateAliases: prevent a idef getall copy
 * Profiler: constness
 * rollback_interface: create real_name later, and use const ref
 * MapBlockMesh updateFastFaceRow: unroll TileSpec next_tile, which has a cost of 1.8% CPU due to variable allocation/destruction,
 * MapBlockMesh updateFastFaceRow: copy next_tile to tile only if it's a different tilespec
 * MapBlockMesh updateFastFaceRow: use memcpy to copy next_lights to lights to do it in a single cpu operation
2017-03-22 21:41:02 +01:00
Ben Deutsch e7246d3f0d Refactored client event if-else cascade to switch statement 2017-03-20 18:35:33 +00:00
Loïc Blot 3c4ac70348 Refactor Game class (part 2) (#5422)
* showPauseMenu is now part of game
* remove many flags parameters passed to game functions, use the member.
* rename VolatileRunFlags to GameUIFlags (this will permit to share structure with client and CSM
* updatePointedThing: remove pointer ref, we already have the pointer in rundata
* move some attributes outside of VolatileRunFlags after renaming, to game class
* rename statustext to m_statustext
* make some const variables static
* All those changes permit to reduce a little bit function class cost and will permit to interface CSM with some interesting Game flags
* Expose GameUIFlags to client
* Client now have GameUIFlags parameter and setters for other classes
* Fix minimap show/hide in Lua because we now have access to the real flag
2017-03-19 13:18:52 +01:00
ShadowNinja b8484ef24e Server list cleanup
This removes the hacky server_dedicated pseudo-setting.
2017-03-18 12:37:57 +01:00
Loic Blot 9f4916a452
TOGGLE_CHAT keymap should togglechat not HUD
Fixes #5413
2017-03-18 10:00:04 +01:00
Loïc Blot a7485e40ff Reduce memory & function cost of Game class functions (#5406)
GameRunData is passed on many game functions, or one of its attributes whereas it's a member of the class. Remove it from functions arguments and call object directly from concerned functions.
This will reduce a little bit the Game class loop usage & very little bit the memory usage (due to non creation of pointer/references)
2017-03-17 22:15:25 +01:00
Loïc Blot 7b74f04a61 [CSM] Fix minimap problems (#5405)
This fixes issue #5404
2017-03-17 07:54:49 +01:00
Loïc Blot 40ce538aad [CSM] Add minimap API modifiers (#5399)
* Rename Mapper (too generic) to Minimap
* Add lua functions to get/set position, angle, mode for minimap
* Client: rename m_mapper to m_minimap
* Add minimap to core.ui namespace (core.ui.minimap)
* Add various functions to manage minimap (show, hide, toggle_shape)
* Cleanup trivial declaration in client
2017-03-16 10:34:54 +01:00
nerzhul 44ca9c9cb2 [CSM] Add enable_client_modding param (default: false) 2017-03-13 23:56:05 +01:00
red-001 0727bb3ddd [CSM] Add `on_punchnode` callback 2017-03-13 23:56:05 +01:00
red-001 073f5cf03d [CSM] Add `on_dignode` callback (#5140) 2017-03-13 23:56:05 +01:00
red-001 c42c53fccf [CSM] Add local formspecs. (#5094) 2017-03-13 23:56:05 +01:00
Loïc Blot 9978f5af82 [CSM] Add on_death, on_hp_modification & oh_damage_taken callbacks (#5093)
* Add on_death callback
* Add on_hp_modification & on_damage_taken callbacks
* move preview code to preview.lua
2017-03-13 23:56:05 +01:00