mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-23 08:08:47 -05:00
Don't call a player event without having player to do a event for
This commit is contained in:
parent
a4c987b339
commit
2a5c88bde1
@ -62,6 +62,9 @@ void ScriptApiEnv::player_event(ServerActiveObject* player, std::string type)
|
|||||||
{
|
{
|
||||||
SCRIPTAPI_PRECHECKHEADER
|
SCRIPTAPI_PRECHECKHEADER
|
||||||
|
|
||||||
|
if (player == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
// Get minetest.registered_playerevents
|
// Get minetest.registered_playerevents
|
||||||
lua_getglobal(L, "minetest");
|
lua_getglobal(L, "minetest");
|
||||||
lua_getfield(L, -1, "registered_playerevents");
|
lua_getfield(L, -1, "registered_playerevents");
|
||||||
|
@ -4581,7 +4581,12 @@ bool Server::hudSetFlags(Player *player, u32 flags, u32 mask) {
|
|||||||
SendHUDSetFlags(player->peer_id, flags, mask);
|
SendHUDSetFlags(player->peer_id, flags, mask);
|
||||||
player->hud_flags = flags;
|
player->hud_flags = flags;
|
||||||
|
|
||||||
m_script->player_event(player->getPlayerSAO(),"hud_changed");
|
PlayerSAO* playersao = player->getPlayerSAO();
|
||||||
|
|
||||||
|
if (playersao == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
m_script->player_event(playersao, "hud_changed");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user