2011-02-20 17:45:14 -05:00
|
|
|
/*
|
2013-02-24 12:40:43 -05:00
|
|
|
Minetest
|
2013-02-24 13:38:45 -05:00
|
|
|
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
2011-02-20 17:45:14 -05:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
2012-06-05 10:56:56 -04:00
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
2011-02-20 17:45:14 -05:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2012-06-05 10:56:56 -04:00
|
|
|
GNU Lesser General Public License for more details.
|
2011-02-20 17:45:14 -05:00
|
|
|
|
2012-06-05 10:56:56 -04:00
|
|
|
You should have received a copy of the GNU Lesser General Public License along
|
2011-02-20 17:45:14 -05:00
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ACTIVEOBJECT_HEADER
|
|
|
|
#define ACTIVEOBJECT_HEADER
|
|
|
|
|
2013-08-10 22:09:45 -04:00
|
|
|
#include "irr_aabb3d.h"
|
2011-02-20 17:45:14 -05:00
|
|
|
#include <string>
|
|
|
|
|
2015-02-16 11:42:13 -05:00
|
|
|
enum ActiveObjectType {
|
|
|
|
ACTIVEOBJECT_TYPE_INVALID = 0,
|
|
|
|
ACTIVEOBJECT_TYPE_TEST = 1,
|
2015-02-17 09:01:54 -05:00
|
|
|
// Deprecated stuff
|
2015-02-16 11:42:13 -05:00
|
|
|
ACTIVEOBJECT_TYPE_ITEM = 2,
|
2015-02-17 05:37:55 -05:00
|
|
|
ACTIVEOBJECT_TYPE_RAT = 3,
|
|
|
|
ACTIVEOBJECT_TYPE_OERKKI1 = 4,
|
|
|
|
ACTIVEOBJECT_TYPE_FIREFLY = 5,
|
|
|
|
ACTIVEOBJECT_TYPE_MOBV2 = 6,
|
2015-02-17 09:01:54 -05:00
|
|
|
// End deprecated stuff
|
2015-02-16 11:42:13 -05:00
|
|
|
ACTIVEOBJECT_TYPE_LUAENTITY = 7,
|
|
|
|
// Special type, not stored as a static object
|
|
|
|
ACTIVEOBJECT_TYPE_PLAYER = 100,
|
|
|
|
// Special type, only exists as CAO
|
|
|
|
ACTIVEOBJECT_TYPE_GENERIC = 101,
|
|
|
|
};
|
2011-06-26 08:48:56 -04:00
|
|
|
// Other types are defined in content_object.h
|
|
|
|
|
2011-02-20 17:45:14 -05:00
|
|
|
struct ActiveObjectMessage
|
|
|
|
{
|
|
|
|
ActiveObjectMessage(u16 id_, bool reliable_=true, std::string data_=""):
|
|
|
|
id(id_),
|
|
|
|
reliable(reliable_),
|
|
|
|
datastring(data_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
u16 id;
|
|
|
|
bool reliable;
|
|
|
|
std::string datastring;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
Parent class for ServerActiveObject and ClientActiveObject
|
|
|
|
*/
|
|
|
|
class ActiveObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ActiveObject(u16 id):
|
|
|
|
m_id(id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
u16 getId()
|
|
|
|
{
|
|
|
|
return m_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setId(u16 id)
|
|
|
|
{
|
|
|
|
m_id = id;
|
|
|
|
}
|
|
|
|
|
2015-02-16 11:42:13 -05:00
|
|
|
virtual ActiveObjectType getType() const = 0;
|
2013-01-12 12:59:19 -05:00
|
|
|
virtual bool getCollisionBox(aabb3f *toset) = 0;
|
2013-06-14 08:04:46 -04:00
|
|
|
virtual bool collideWithObjects() = 0;
|
2011-02-20 17:45:14 -05:00
|
|
|
protected:
|
|
|
|
u16 m_id; // 0 is invalid, "no id"
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|