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.
22 #include "irr_aabb3d.h"
27 enum ActiveObjectType {
28 ACTIVEOBJECT_TYPE_INVALID = 0,
29 ACTIVEOBJECT_TYPE_TEST = 1,
31 ACTIVEOBJECT_TYPE_ITEM = 2,
32 // ACTIVEOBJECT_TYPE_RAT = 3,
33 // ACTIVEOBJECT_TYPE_OERKKI1 = 4,
34 // ACTIVEOBJECT_TYPE_FIREFLY = 5,
35 ACTIVEOBJECT_TYPE_MOBV2 = 6,
37 ACTIVEOBJECT_TYPE_LUAENTITY = 7,
38 // Special type, not stored as a static object
39 ACTIVEOBJECT_TYPE_PLAYER = 100,
40 // Special type, only exists as CAO
41 ACTIVEOBJECT_TYPE_GENERIC = 101,
43 // Other types are defined in content_object.h
45 struct ActiveObjectMessage
47 ActiveObjectMessage(u16 id_, bool reliable_=true, const std::string &data_ = "") :
55 std::string datastring;
59 Parent class for ServerActiveObject and ClientActiveObject
79 virtual ActiveObjectType getType() const = 0;
83 * Returns the collision box of the object.
84 * This box is translated by the object's
86 * The box's coordinates are world coordinates.
87 * @returns true if the object has a collision box.
89 virtual bool getCollisionBox(aabb3f *toset) const = 0;
93 * Returns the selection box of the object.
94 * This box is not translated when the
96 * The box's coordinates are world coordinates.
97 * @returns true if the object has a selection box.
99 virtual bool getSelectionBox(aabb3f *toset) const = 0;
102 virtual bool collideWithObjects() const = 0;
105 virtual void setAttachment(int parent_id, const std::string &bone, v3f position,
107 virtual void getAttachment(int *parent_id, std::string *bone, v3f *position,
108 v3f *rotation) const {}
109 virtual void clearChildAttachments() {}
110 virtual void clearParentAttachment() {}
111 virtual void addAttachmentChild(int child_id) {}
112 virtual void removeAttachmentChild(int child_id) {}
114 u16 m_id; // 0 is invalid, "no id"