Commit Graph

147 Commits

Author SHA1 Message Date
Dániel Juhász 3face01a20 Node definition manager refactor (#7016)
* Rename IWritableNodeDefManager to NodeDefManager
* Make INodeDefManager functions const
* Use "const *NodeDefManager" instead of "*INodeDefManager"
* Remove unused INodeDefManager class
* Merge NodeDefManager and CNodeDefManager
* Document NodeDefManager
2018-02-10 21:04:16 +01:00
red-001 1e94a7feaf Move `setlocale` from Lua to C++. 2018-02-08 15:38:34 +01:00
red-001 d6050bee51 [CSM] Don't Load the package library (#6944)
Already removed by a latter step in CSM init so this just saves on pointless work.
2018-01-22 08:34:49 +01:00
Wayward One 684e70477d Change include from "cmake_config.h" to "config.h"
Fixes #6894
2018-01-21 23:25:04 +01:00
red-001 49ff1d2ea8 [CSM] Remove `on_connect` callback (#6941)
Fixes #6939
2018-01-21 18:27:27 +01:00
red-001 30821ad8de [CSM] Don't load the IO library. (#6087)
* [CSM] Don't load the IO library.

* Rename the function to match the Lua API function name and add a missing `const`

* Add a comment to explain some strange code and fix the other issues pointed out by shadowninja.
2018-01-04 08:21:12 +01:00
rubenwardy 2af47e6f5f Fix crash on can_bypass_userlimit returning non-boolean 2018-01-03 14:18:13 +00:00
Vitaliy 20a85d76d9 Move files to subdirectories (#6599)
* Move files around
2017-11-08 23:56:20 +01:00
SmallJoker f547452685 Unkown nodes: Provide position on interact (#6505)
* Unkown nodes: Provide position on interact
2017-10-07 15:11:07 +02:00
Vincent Glize 4e19791cde [CSM] Add callback on open inventory (#5793) 2017-10-02 22:09:49 +02:00
Loïc Blot 6f1c907204 Implement mod communication channels (#6351)
Implement network communication for channels

* Implement ModChannel manager server side to route incoming messages from clients to other clients
* Add signal handler switch on client & ModChannelMgr on client to handle channels
* Add Lua API bindings + client packet sending + unittests
* Implement server message sending
* Add callback from received message handler to Lua API using registration method
2017-09-26 00:11:20 +02:00
DTA7 5a3b8e34b3 Set placer to nil instead of a non-functional one in item_OnPlace (#6449)
* Set placer to nil instead of a non-functional one

This requires nil checks in core.rotate_node and core.rotate_and_place.
2017-09-21 21:52:52 +02:00
SmallJoker 67f97f8d32 on_death: Fix callback number of pushed arguments (Fixes #6451) 2017-09-21 19:56:24 +02:00
sfan5 04839f233f ServerEnv: Clean up object lifecycle handling (#6414)
* ServerEnv: Clean up object lifecycle handling
2017-09-15 12:19:01 +02:00
Kahrl 17fd5fe935 Make INodeDefManager::getIds return a vector, not a set 2017-09-12 19:31:46 +02:00
Loïc Blot 40dd03e328 Implement minetest.register_can_bypass_userlimit (#6369)
* Implement minetest.register_on_userlimit_check

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

Move core part for builtin privileges checks to builtin
2017-09-04 22:08:59 +02:00
Rui c0dac4d928 Remove nodeupdate completely (#6358) 2017-09-01 13:40:09 +02:00
Loïc Blot 1c1c97cbd1 Modernize source code: last part (#6285)
* Modernize source code: last par

* Use empty when needed
* Use emplace_back instead of push_back when needed
* For range-based loops
* Initializers fixes
* constructors, destructors default
* c++ C stl includes
2017-08-20 13:30:50 +02:00
Loïc Blot fd3afbced5 Optimize headers (part 2) (#6272)
* Optimize headers (part 2)

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

* Cleanup (part 2)

* camera.h: mesh.h
* mapgen.h: mapnode.h
* serverenvironment.h: mapblock.h
* nodedef.h: shader.h
2017-08-18 19:25:07 +02:00
Loïc Blot 921151d97a C++ modernize: Pragma once (#6264)
* Migrate cpp headers to pragma once
2017-08-17 22:19:39 +02:00
Loïc Blot 85511a642f Cleanup various headers to reduce compilation times (#6255)
* Cleanup various headers to reduce compilation times
2017-08-16 22:11:45 +02:00
Loïc Blot 550c0404a8 Add LuaEntity on_death callback (#6177)
Add LuaEntity on_death callback

This fixes #5474
2017-07-27 11:32:35 +02:00
number Zero ef285b2815 Add 'plantlike_rooted' drawtype
Useful for underwater plants.
Node consists of a base cube plus a plantlike extension that can pass through
liquid nodes above without creating air bubbles or interfering with liquid flow.
Uses paramtype2 'leveled', param2 defines height of plantlike extension.
2017-07-11 01:02:22 +01:00
Dániel Juhász 3caad3f3c9 Expose getPointedThing to Lua
This commit introduces Raycast, a Lua user object, which can be
used to perform a raycast on the map. The ray is continuable, so one can
also get hidden nodes (for example to see trough glass).
2017-07-07 22:28:23 +01:00
red-001 f3ad75691a Create a filesystem abstraction layer for CSM and only allow accessing files that are scanned into it. (#5965)
* Load client-side mods into memory before executing them.

This removes the remaining filesystem access that client-sided mods had and it will hopefully make then more secure.

* Lua Virtual filesystem: don't load the files into memory just scan the filenames into memory.

* Fix the issues with backtrace

* fix most of the issues

* fix code style.

* add a comment
2017-06-30 20:14:39 +02:00
Vincent Glize 4a5e8ad343 C++11 cleanup on constructors (#6000)
* C++11 cleanup on constructors dir script
2017-06-19 23:54:58 +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
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
DS 44495ea719 CSM: Fix documentation error for register_on_*_chat_messages (#5917) 2017-06-09 15:48:04 +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
red-001 772944daf6 Fix CSM crash (#5779)
Caused by dc5bc6c and them made worse by 5ebf8f9
2017-05-20 16:45:49 +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
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
red-001 5ebf8f9450 [CSM] add `on_item_use` (#5544) 2017-05-06 21:12:44 +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
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 91a9382c25 Pass clang-format on various cpp/header files (#5559) 2017-04-23 09:52:40 +02: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
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
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
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
Loic Blot 01f9d05f23
code style fix on src/script/cpp_api/s_client.h 2017-04-08 08:45:58 +02:00
Vincent Glize f73534640a [CSM] Add event on_connect player API lua (#5540)
* Add event on_connect player API lua
2017-04-08 08:20:30 +02:00
Loic Blot 4af99b75cf
Pass clang-format on 14 trivial header files fixes
Also remove them from whitelist
2017-04-07 23:22:00 +02:00
paramat ea549bbae3 Paramtype2: Add missing type CPT2_GLASSLIKE_LIQUID_LEVEL
Add the missing paramtype2 for param2 controlling the liquid level
inside the glasslike_framed drawtype.
Add missing documentation of the feature to lua_api.txt.
Update and improve comments for drawtype enumerations in nodedef.h.
2017-03-30 04:52:54 +01:00
red-001 2e3778ec0c Block access to the `io` library 2017-03-19 12:34:33 +01:00
Loïc Blot 0891975ad6 [CSM] Add core.get_timeofday & core.get_day_count env calls (#5401)
* [CSM] Add core.get_timeofday & core.get_day_count env calls

* [CSM] Add core.get_node_level, core.get_node_max_level, core.find_node_near
2017-03-17 07:48:29 +01:00
red-001 88df9fb5b6 Add `get_wielded_item` 2017-03-13 23:56:05 +01:00
nerzhul 44ca9c9cb2 [CSM] Add enable_client_modding param (default: false) 2017-03-13 23:56:05 +01:00