1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Load CSM environment after the restrictions are known

Safety-guards for CSM callbacks to abort on a bad implementation
Only run callbacks when the mods are loaded (and with it: builtin)

Duplication checks inside constructors
This commit is contained in:
SmallJoker 2019-06-25 21:18:08 +02:00
parent 720aedb467
commit 23677be951
10 changed files with 64 additions and 55 deletions

View file

@ -415,7 +415,7 @@ void Client::handleCommand_ChatMessage(NetworkPacket *pkt)
chatMessage->type = (ChatMessageType) message_type;
// @TODO send this to CSM using ChatMessage object
if (moddingEnabled() && m_script->on_receiving_message(
if (modsLoaded() && m_script->on_receiving_message(
wide_to_utf8(chatMessage->message))) {
// Message was consumed by CSM and should not be handled by client
delete chatMessage;
@ -532,9 +532,8 @@ void Client::handleCommand_HP(NetworkPacket* pkt)
player->hp = hp;
if (moddingEnabled()) {
if (modsLoaded())
m_script->on_hp_modification(hp);
}
if (hp < oldhp) {
// Add to ClientEvent queue