summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2017-01-21 15:02:08 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-03-13 23:56:05 +0100
commit2efae3ffd720095222c800e016286a45c9fe1e5c (patch)
tree3a8b19daa071cf742fee52d70a0e0adf94d56c0c /src/network
parentc9492b4d37c11f35cfdc1558f771eef87fc5c972 (diff)
downloadminetest-2efae3ffd720095222c800e016286a45c9fe1e5c.tar.gz
minetest-2efae3ffd720095222c800e016286a45c9fe1e5c.tar.bz2
minetest-2efae3ffd720095222c800e016286a45c9fe1e5c.zip
[CSM] 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
Diffstat (limited to 'src/network')
-rw-r--r--src/network/clientpackethandler.cpp6
-rw-r--r--src/network/serverpackethandler.cpp2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index b11f73e86..f1c44c7d8 100644
--- a/src/network/clientpackethandler.cpp
+++ b/src/network/clientpackethandler.cpp
@@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "server.h"
#include "util/strfnd.h"
#include "network/clientopcodes.h"
+#include "script/clientscripting.h"
#include "util/serialize.h"
#include "util/srp.h"
#include "tileanimation.h"
@@ -411,7 +412,10 @@ void Client::handleCommand_ChatMessage(NetworkPacket* pkt)
message += (wchar_t)read_wchar;
}
- m_chat_queue.push(message);
+ // If chat message not consummed by client lua API
+ if (!m_script->on_receiving_message(wide_to_utf8(message))) {
+ m_chat_queue.push(message);
+ }
}
void Client::handleCommand_ActiveObjectRemoveAdd(NetworkPacket* pkt)
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index ac428e8ed..b707c6fad 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "nodedef.h"
#include "player.h"
#include "rollback_interface.h"
-#include "scripting_game.h"
+#include "serverscripting.h"
#include "settings.h"
#include "tool.h"
#include "version.h"