From 1b2f64473ed4f222d3b7f02df853730d4382105e Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Wed, 4 Mar 2015 11:29:34 +0100 Subject: Send Inventory packet on event, don't check it at each AsyncRunStep. * Call UpdateCrafting into SendInventory because this functions is only called before SendInventory * Use Player* instead of peer_id for UpdateCrafting because SendInventory already has the Player* pointer, then don't loop for searching Player* per peer_id * m_env_mutex don't need to be used with this modification because it's already locked before the calls --- src/script/lua_api/l_object.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/script/lua_api') diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 0bc6c0bbc..0f3848aac 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -355,6 +355,9 @@ int ObjectRef::l_set_wielded_item(lua_State *L) // Do it ItemStack item = read_item(L, 2, getServer(L)); bool success = co->setWieldedItem(item); + if (success && co->getType() == ACTIVEOBJECT_TYPE_PLAYER) { + getServer(L)->SendInventory(((PlayerSAO*)co)->getPeerID()); + } lua_pushboolean(L, success); return 1; } -- cgit v1.2.3