*/
#include "collision.h"
+#include "collidableobject.h"
#include "mapblock.h"
#include "map.h"
#include "nodedef.h"
for (core::list<ActiveObject*>::Iterator iter = objects.begin();
iter != objects.end(); iter++)
{
- aabb3f* object_collisionbox = (*iter)->getCollisionBox();
- //TODO do we need to check if it's really near enough?
- if (object_collisionbox != NULL)
+ CollidableObject* object = dynamic_cast<CollidableObject*>(*iter);
+
+ if (object != NULL)
{
- cboxes.push_back(*object_collisionbox);
- is_unloaded.push_back(false);
- is_step_up.push_back(false);
+ aabb3f* object_collisionbox = object->getCollisionBox();
+ //TODO do we need to check if it's really near enough?
+ if (object_collisionbox != NULL)
+ {
+ cboxes.push_back(*object_collisionbox);
+ is_unloaded.push_back(false);
+ is_step_up.push_back(false);
+ }
}
}
} //tt3
#include "tile.h"
#include "environment.h"
#include "collision.h"
+#include "collidableobject.h"
#include "settings.h"
#include <ICameraSceneNode.h>
#include <ITextSceneNode.h>
#include "luaentity_common.h"
-class LuaEntityCAO : public ClientActiveObject
+class LuaEntityCAO : public ClientActiveObject , public CollidableObject
{
private:
core::aabbox3d<f32> m_selection_box;
int m_anim_num_frames;
float m_anim_framelength;
float m_anim_timer;
- aabb3f m_collisionbox;
public:
LuaEntityCAO(IGameDef *gamedef, ClientEnvironment *env):
PlayerCAO
*/
-class PlayerCAO : public ClientActiveObject
+class PlayerCAO : public ClientActiveObject, public CollidableObject
{
private:
core::aabbox3d<f32> m_selection_box;
LocalPlayer *m_local_player;
float m_damage_visual_timer;
bool m_dead;
- aabb3f m_collisionbox;
public:
PlayerCAO(IGameDef *gamedef, ClientEnvironment *env):
#include "serverobject.h"
#include "content_object.h"
+#include "collidableobject.h"
class TestSAO : public ServerActiveObject
{
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
const std::string &data);
void step(float dtime, bool send_recommended);
- inline aabb3f* getCollisionBox() { return NULL; }
private:
float m_timer1;
float m_age;
ItemStack createItemStack();
void punch(ServerActiveObject *puncher, float time_from_last_punch);
float getMinimumSavedMovement(){ return 0.1*BS; }
- inline aabb3f* getCollisionBox() { return NULL; }
private:
std::string m_itemstring;
bool m_itemstring_changed;
std::string getClientInitializationData();
std::string getStaticData();
void punch(ServerActiveObject *puncher, float time_from_last_punch);
- inline aabb3f* getCollisionBox() { return NULL; }
private:
bool m_is_active;
IntervalLimiter m_inactive_interval;
std::string getStaticData();
void punch(ServerActiveObject *puncher, float time_from_last_punch);
bool isPeaceful(){return false;}
- inline aabb3f* getCollisionBox() { return NULL; }
private:
void doDamage(u16 d);
void step(float dtime, bool send_recommended);
std::string getClientInitializationData();
std::string getStaticData();
- inline aabb3f* getCollisionBox() { return NULL; }
private:
bool m_is_active;
IntervalLimiter m_inactive_interval;
void step(float dtime, bool send_recommended);
void punch(ServerActiveObject *puncher, float time_from_last_punch);
bool isPeaceful();
- inline aabb3f* getCollisionBox() { return NULL; }
private:
void sendPosition();
void setPropertyDefaults();
struct LuaEntityProperties;
-class LuaEntitySAO : public ServerActiveObject
+class LuaEntitySAO : public ServerActiveObject, public CollidableObject
{
public:
LuaEntitySAO(ServerEnvironment *env, v3f pos,
v3f m_last_sent_velocity;
float m_last_sent_position_timer;
float m_last_sent_move_precision;
- aabb3f m_collisionbox;
};
#endif
#include "player.h"
#include "serverobject.h"
+#include "collidableobject.h"
#include "content_object.h" // Object type IDs
/*
Player on the server
*/
-class ServerRemotePlayer : public Player, public ServerActiveObject
+class ServerRemotePlayer : public Player, public ServerActiveObject , public CollidableObject
{
public:
ServerRemotePlayer(ServerEnvironment *env);
aabb3f* getCollisionBox();
private:
bool m_position_not_sent;
- aabb3f m_collisionbox;
};
#endif