2011-02-20 23:45:14 +01:00
|
|
|
/*
|
2013-02-24 18:40:43 +01:00
|
|
|
Minetest
|
2013-02-24 19:38:45 +01:00
|
|
|
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
2011-02-20 23:45:14 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
2012-06-05 16:56:56 +02: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 23:45:14 +01: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 16:56:56 +02:00
|
|
|
GNU Lesser General Public License for more details.
|
2011-02-20 23:45:14 +01:00
|
|
|
|
2012-06-05 16:56:56 +02:00
|
|
|
You should have received a copy of the GNU Lesser General Public License along
|
2011-02-20 23:45:14 +01: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-11 04:09:45 +02:00
|
|
|
#include "irr_aabb3d.h"
|
2011-02-20 23:45:14 +01:00
|
|
|
#include <string>
|
|
|
|
|
2015-02-16 17:42:13 +01:00
|
|
|
enum ActiveObjectType {
|
|
|
|
ACTIVEOBJECT_TYPE_INVALID = 0,
|
|
|
|
ACTIVEOBJECT_TYPE_TEST = 1,
|
2015-02-17 15:01:54 +01:00
|
|
|
// Deprecated stuff
|
2015-02-16 17:42:13 +01:00
|
|
|
ACTIVEOBJECT_TYPE_ITEM = 2,
|
2017-05-20 08:15:56 +02:00
|
|
|
// ACTIVEOBJECT_TYPE_RAT = 3,
|
|
|
|
// ACTIVEOBJECT_TYPE_OERKKI1 = 4,
|
|
|
|
// ACTIVEOBJECT_TYPE_FIREFLY = 5,
|
2015-02-17 11:37:55 +01:00
|
|
|
ACTIVEOBJECT_TYPE_MOBV2 = 6,
|
2015-02-17 15:01:54 +01:00
|
|
|
// End deprecated stuff
|
2015-02-16 17:42:13 +01: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 14:48:56 +02:00
|
|
|
// Other types are defined in content_object.h
|
|
|
|
|
2011-02-20 23:45:14 +01:00
|
|
|
struct ActiveObjectMessage
|
|
|
|
{
|
2017-04-19 00:36:30 +02:00
|
|
|
ActiveObjectMessage(u16 id_, bool reliable_=true, const std::string &data_ = "") :
|
2011-02-20 23:45:14 +01:00
|
|
|
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)
|
|
|
|
{
|
|
|
|
}
|
2017-01-09 20:39:45 +01:00
|
|
|
|
2011-02-20 23:45:14 +01:00
|
|
|
u16 getId()
|
|
|
|
{
|
|
|
|
return m_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setId(u16 id)
|
|
|
|
{
|
|
|
|
m_id = id;
|
|
|
|
}
|
|
|
|
|
2015-02-16 17:42:13 +01:00
|
|
|
virtual ActiveObjectType getType() const = 0;
|
2017-01-09 20:39:45 +01:00
|
|
|
virtual bool getCollisionBox(aabb3f *toset) const = 0;
|
|
|
|
virtual bool collideWithObjects() const = 0;
|
2011-02-20 23:45:14 +01:00
|
|
|
protected:
|
|
|
|
u16 m_id; // 0 is invalid, "no id"
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|