3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "serveractiveobject.h"
22 #include "inventory.h"
23 #include "constants.h" // BS
26 ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos):
33 float ServerActiveObject::getMinimumSavedMovement()
38 ItemStack ServerActiveObject::getWieldedItem(ItemStack *selected, ItemStack *hand) const
40 *selected = ItemStack();
47 bool ServerActiveObject::setWieldedItem(const ItemStack &item)
52 std::string ServerActiveObject::generateUpdateInfantCommand(u16 infant_id, u16 protocol_version)
54 std::ostringstream os(std::ios::binary);
56 writeU8(os, AO_CMD_SPAWN_INFANT);
58 writeU16(os, infant_id);
59 writeU8(os, getSendType());
60 os << serializeLongString(getClientInitializationData(protocol_version));
64 std::string ServerActiveObject::generateUpdateNametagAttributesCommand(const video::SColor &color) const
66 std::ostringstream os(std::ios::binary);
68 writeU8(os, AO_CMD_UPDATE_NAMETAG_ATTRIBUTES);
70 writeU8(os, 1); // version for forward compatibility
71 writeARGB8(os, color);
75 void ServerActiveObject::dumpAOMessagesToQueue(std::queue<ActiveObjectMessage> &queue)
77 while (!m_messages_out.empty()) {
78 queue.push(m_messages_out.front());