Commit Graph

31 Commits

Author SHA1 Message Date
Desour c400b9d9e8
Add documentation to builtin core.run_callbacks (#10494) 2022-05-21 16:18:04 +02:00
Elijah Duffy 3001721dd2
Lua API: Add register_on_chatcommand to SSM and CSM (#7862)
Allows catching a chatcommand call just after the command and the
parameters are parsed but before its existence is checked and before the
corresponding function is run. Returning `true` from a callback function
will prevent default handling of the command leaving mods to handle the
command manually.
2022-05-21 16:18:01 +02:00
rubenwardy d5c162fb03
Add luacheck to check builtin (#7895) 2022-05-21 16:17:08 +02:00
Loïc Blot 74641de4d5
CSM: add requested CSM_RF_READ_PLAYERINFO (#8007)
* CSM: add requested CSM_RF_READ_PLAYERINFO

This new CSM limit permit to limit PLAYERINFO read from server.

It affects get_player_names call
2022-05-21 16:16:36 +02:00
paramat 54617ebb02
CSM: Don't create the client script environment if CSM is disabled (#7874)
Use the CSM death formspec when CSM is enabled and use the engine death formspec when CSM is disabled.
Move the CSM death formspec code to a dedicated file.
2022-05-21 16:16:28 +02:00
Loïc Blot 1a7574e9cd
CSM/SSM: Add on_mods_loaded callback (#7411)
* CSM/SSM: Add on_mods_loaded callback
2022-05-21 16:16:02 +02:00
red-001 8683013193
Remove `on_connect` callback (#6941)
Fixes #6939
2022-05-21 16:15:42 +02:00
Vincent Glize 1f00a7e212
Add callback on open inventory (#5793) 2022-05-21 16:15:24 +02:00
Loïc Blot 0882448ea8
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
2022-05-21 16:15:23 +02:00
Loïc Blot 84f53e2eb0
Revert "CSM: Revert "[CSM] Add send_chat_message and run_server_chatcommand""
This reverts commit bdac12761cd92960c3df83c932aa610f2322215f.
2022-05-21 16:15:03 +02:00
rubenwardy c8de877867
CSM: Revert "[CSM] Add send_chat_message and run_server_chatcommand"
Original PR: #5747.
This reverts commit 39f4a2f607d44738d60db84eba4b30e3d7450204.
2022-05-21 16:15:02 +02:00
red-001 2dcce68936
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
2022-05-21 16:14:59 +02:00
Desour 3133dce383
CSM: Fix documentation error for register_on_*_chat_messages (#5917) 2022-05-21 16:14:53 +02:00
Pierre-Adrien Langrognet c1f181041c
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
2022-05-21 16:14:49 +02:00
red-001 284cbcd844
add `on_item_use` (#5544) 2022-05-21 16:14:44 +02:00
Vincent Glize 9a88f2bc0c
Add event on_place_node API lua (#5548)
* [CSM] Add event on_place_node API lua
2022-05-21 16:14:43 +02:00
red-001 04a8ca0f9c
Allow escaping chatcommands and add missing calls to gettext. (#5565) 2022-05-21 16:14:40 +02:00
red-001 089bca3f7f
Use more gettext (#5553) 2022-05-21 16:14:39 +02:00
red-001 e6d04ba28f
Move `.list_players` and `.disconnect` to builtin. (#5550) 2022-05-21 16:14:39 +02:00
Vincent Glize 58e922c884
Add event on_connect player API lua (#5540)
* Add event on_connect player API lua
2022-05-21 16:14:37 +02:00
Loïc Blot 342452f247
Expose vector helpers to CSM 2022-05-21 16:14:36 +02:00
red-001 5943ad8975
Change command prefix to "." and add "help" command. 2022-05-21 16:14:32 +02:00
red-001 c38197ed66
Add `on_punchnode` callback 2022-05-21 16:14:29 +02:00
red-001 e02c119936
Add `on_dignode` callback (#5140) 2022-05-21 16:14:29 +02:00
red-001 fb042da4a5
Improve security for client-sided mods (#5100) 2022-05-21 16:14:28 +02:00
Loïc Blot 3d38c234e5
implement client side mod loading (#5123)
* client side mods are located in clientmods/
* move builtin/preview.lua to clientmods/preview/init.lua as a preview mod
* refactor ModConfiguration class to work properly with client and server using child objects
* move some Server constructor mod load code to ModConfiguration to reduce code duplication between client and server
* remove mods.{cpp,h} unused functions
* use UNORDERED_SET instead of std::set in some modspec storages
2022-05-21 16:14:28 +02:00
red-001 0412d35355
Add local formspecs. (#5094) 2022-05-21 16:14:27 +02:00
Loïc Blot b38c00d90f
sound_play & sound_stop support + client_lua_api doc (#5096)
* squashed: CSM: Implement register_globalstep
  * Re-use fatal error mechanism from server to disconnect client on CSM error
  * Little client functions cleanups

* squashed: CSM: add core.after function
  * core.after is shared code between client & server
  * ModApiUtil get_us_time feature enabled for client
2022-05-21 16:14:27 +02:00
red-001 33b76809dd
Add client-sided chat commands (#5092) 2022-05-21 16:14:27 +02:00
Loïc Blot 6a9953bd0f
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
2022-05-21 16:14:26 +02:00
Loïc Blot 80f3d77767
Client side modding
* rename GameScripting to ServerScripting
* Make getBuiltinLuaPath static serverside
* Add on_shutdown callback
* Add on_receiving_chat_message & on_sending_chat_message callbacks
* ScriptApiBase: use IGameDef instead of Server
  This permits to share common attribute between client & server
* Enable mod security in client side modding without conditions
2022-05-21 16:14:26 +02:00