1 /*
2 activeobject.h
3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4 */
5 
6 /*
7 This file is part of Freeminer.
8 
9 Freeminer is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Freeminer  is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Freeminer.  If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #ifndef ACTIVEOBJECT_HEADER
24 #define ACTIVEOBJECT_HEADER
25 
26 #include "irr_aabb3d.h"
27 #include <string>
28 
29 #define ACTIVEOBJECT_TYPE_INVALID 0
30 // Other types are defined in content_object.h
31 
32 struct ActiveObjectMessage
33 {
34 	ActiveObjectMessage(u16 id_, bool reliable_=true, std::string data_=""):
idActiveObjectMessage35 		id(id_),
36 		reliable(reliable_),
37 		datastring(data_)
38 	{}
39 
40 	u16 id;
41 	bool reliable;
42 	std::string datastring;
43 };
44 
45 /*
46 	Parent class for ServerActiveObject and ClientActiveObject
47 */
48 class ActiveObject
49 {
50 public:
ActiveObject(u16 id)51 	ActiveObject(u16 id):
52 		m_id(id)
53 	{
54 	}
55 
getId()56 	u16 getId()
57 	{
58 		return m_id;
59 	}
60 
setId(u16 id)61 	void setId(u16 id)
62 	{
63 		m_id = id;
64 	}
65 
66 	virtual u8 getType() const = 0;
67 	virtual bool getCollisionBox(aabb3f *toset) = 0;
68 	virtual bool collideWithObjects() = 0;
69 protected:
70 	u16 m_id; // 0 is invalid, "no id"
71 };
72 
73 #endif
74 
75