ACTIVEOBJECT_TYPE_INVALID = 0,
ACTIVEOBJECT_TYPE_TEST = 1,
ACTIVEOBJECT_TYPE_ITEM = 2,
+ // Compat layer, migrating objects from 0.3 to 0.4+
+ ACTIVEOBJECT_TYPE_RAT = 3,
+ ACTIVEOBJECT_TYPE_OERKKI1 = 4,
+ ACTIVEOBJECT_TYPE_FIREFLY = 5,
+ ACTIVEOBJECT_TYPE_MOBV2 = 6,
ACTIVEOBJECT_TYPE_LUAENTITY = 7,
// Special type, not stored as a static object
ACTIVEOBJECT_TYPE_PLAYER = 100,
removeFromScene(true);
}
-ClientActiveObject* ClientActiveObject::create(u8 type, IGameDef *gamedef,
- ClientEnvironment *env)
+ClientActiveObject* ClientActiveObject::create(ActiveObjectType type,
+ IGameDef *gamedef, ClientEnvironment *env)
{
// Find factory function
std::map<u16, Factory>::iterator n;
n = m_types.find(type);
- if(n == m_types.end())
- {
+ if(n == m_types.end()) {
// If factory is not found, just return.
dstream<<"WARNING: ClientActiveObject: No factory for type="
<<(int)type<<std::endl;
virtual void initialize(const std::string &data){}
// Create a certain type of ClientActiveObject
- static ClientActiveObject* create(u8 type, IGameDef *gamedef,
+ static ClientActiveObject* create(ActiveObjectType type, IGameDef *gamedef,
ClientEnvironment *env);
// If returns true, punch will not be sent to the server
StaticObject &s_obj = *i;
// Create an active object from the data
ServerActiveObject *obj = ServerActiveObject::create
- (s_obj.type, this, 0, s_obj.pos, s_obj.data);
+ ((ActiveObjectType) s_obj.type, this, 0, s_obj.pos, s_obj.data);
// If couldn't create object, store static data back.
if(obj==NULL)
{
const std::string &init_data)
{
ClientActiveObject* obj =
- ClientActiveObject::create(type, m_gamedef, this);
+ ClientActiveObject::create((ActiveObjectType) type, m_gamedef, this);
if(obj == NULL)
{
infostream<<"ClientEnvironment::addActiveObject(): "
{
}
-ServerActiveObject* ServerActiveObject::create(u8 type,
+ServerActiveObject* ServerActiveObject::create(ActiveObjectType type,
ServerEnvironment *env, u16 id, v3f pos,
const std::string &data)
{
// Find factory function
std::map<u16, Factory>::iterator n;
n = m_types.find(type);
- if(n == m_types.end())
- {
+ if(n == m_types.end()) {
// If factory is not found, just return.
dstream<<"WARNING: ServerActiveObject: No factory for type="
<<type<<std::endl;
{ return true; }
// Create a certain type of ServerActiveObject
- static ServerActiveObject* create(u8 type,
+ static ServerActiveObject* create(ActiveObjectType type,
ServerEnvironment *env, u16 id, v3f pos,
const std::string &data);