diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/network/clientpackethandler.cpp | 24 | ||||
-rw-r--r-- | src/script/lua_api/l_clientobject.cpp | 9 | ||||
-rw-r--r-- | src/script/lua_api/l_clientobject.h | 3 |
3 files changed, 24 insertions, 12 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 55f85571d..373d4484a 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -450,10 +450,10 @@ void Client::handleCommand_ActiveObjectRemoveAdd(NetworkPacket* pkt) string initialization data } */ - + LocalPlayer *player = m_env.getLocalPlayer(); - bool try_reattach = player && player->isWaitingForReattach(); - + bool try_reattach = player && player->isWaitingForReattach(); + try { u8 type; u16 removed_count, added_count, id; @@ -596,13 +596,13 @@ void Client::handleCommand_Breath(NetworkPacket* pkt) } void Client::handleCommand_MovePlayer(NetworkPacket* pkt) -{ +{ LocalPlayer *player = m_env.getLocalPlayer(); assert(player != NULL); if ((player->getCAO() && player->getCAO()->getParentId()) || player->isWaitingForReattach()) return; - + v3f pos; f32 pitch, yaw; @@ -622,10 +622,10 @@ void Client::handleCommand_MovePlayer(NetworkPacket* pkt) it would just force the pitch and yaw values to whatever the camera points to. */ - + if (g_settings->getBool("no_force_rotate")) return; - + ClientEvent *event = new ClientEvent(); event->type = CE_PLAYER_FORCE_MOVE; event->player_force_move.pitch = pitch; @@ -833,12 +833,12 @@ void Client::handleCommand_PlaySound(NetworkPacket* pkt) *pkt >> pitch; *pkt >> ephemeral; } catch (PacketError &e) {}; - + SimpleSoundSpec sound_spec(name, gain, fade, pitch); - + if (m_mods_loaded && m_script->on_play_sound(sound_spec)) return; - + // Start playing int client_id = -1; switch(type) { @@ -987,10 +987,10 @@ void Client::handleCommand_SpawnParticle(NetworkPacket* pkt) ClientEvent *event = new ClientEvent(); event->type = CE_SPAWN_PARTICLE; event->spawn_particle = new ParticleParameters(p); - + if (m_mods_loaded && m_script->on_spawn_particle(*event->spawn_particle)) return; - + m_client_event_queue.push(event); } diff --git a/src/script/lua_api/l_clientobject.cpp b/src/script/lua_api/l_clientobject.cpp index 521aba023..76d0d65ab 100644 --- a/src/script/lua_api/l_clientobject.cpp +++ b/src/script/lua_api/l_clientobject.cpp @@ -173,6 +173,15 @@ int ClientObjectRef::l_rightclick(lua_State *L) return 0; } +int ClientObjectRef::l_remove(lua_State *L) +{ + ClientObjectRef *ref = checkobject(L, 1); + ClientActiveObject *cao = get_cao(ref); + getClient(L)->getEnv().removeActiveObject(cao->getId()); + + return 0; +} + ClientObjectRef::ClientObjectRef(ClientActiveObject *object) : m_object(object) { } diff --git a/src/script/lua_api/l_clientobject.h b/src/script/lua_api/l_clientobject.h index 1ff22407f..ebc0f2a90 100644 --- a/src/script/lua_api/l_clientobject.h +++ b/src/script/lua_api/l_clientobject.h @@ -89,4 +89,7 @@ private: // rightclick(self) static int l_rightclick(lua_State *L); + + // remove(self) + static int l_remove(lua_State *L); }; |