mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
added changes missing in last commit
This commit is contained in:
parent
c525330153
commit
d9ffd30445
5 changed files with 19 additions and 21 deletions
|
@ -62,7 +62,6 @@ public:
|
||||||
|
|
||||||
virtual u8 getType() const = 0;
|
virtual u8 getType() const = 0;
|
||||||
|
|
||||||
virtual aabb3f* getCollisionBox() = 0;
|
|
||||||
protected:
|
protected:
|
||||||
u16 m_id; // 0 is invalid, "no id"
|
u16 m_id; // 0 is invalid, "no id"
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "collision.h"
|
#include "collision.h"
|
||||||
|
#include "collidableobject.h"
|
||||||
#include "mapblock.h"
|
#include "mapblock.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "nodedef.h"
|
#include "nodedef.h"
|
||||||
|
@ -266,13 +267,18 @@ collisionMoveResult collisionMoveSimple(Environment* env,
|
||||||
for (core::list<ActiveObject*>::Iterator iter = objects.begin();
|
for (core::list<ActiveObject*>::Iterator iter = objects.begin();
|
||||||
iter != objects.end(); iter++)
|
iter != objects.end(); iter++)
|
||||||
{
|
{
|
||||||
aabb3f* object_collisionbox = (*iter)->getCollisionBox();
|
CollidableObject* object = dynamic_cast<CollidableObject*>(*iter);
|
||||||
//TODO do we need to check if it's really near enough?
|
|
||||||
if (object_collisionbox != NULL)
|
if (object != NULL)
|
||||||
{
|
{
|
||||||
cboxes.push_back(*object_collisionbox);
|
aabb3f* object_collisionbox = object->getCollisionBox();
|
||||||
is_unloaded.push_back(false);
|
//TODO do we need to check if it's really near enough?
|
||||||
is_step_up.push_back(false);
|
if (object_collisionbox != NULL)
|
||||||
|
{
|
||||||
|
cboxes.push_back(*object_collisionbox);
|
||||||
|
is_unloaded.push_back(false);
|
||||||
|
is_step_up.push_back(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} //tt3
|
} //tt3
|
||||||
|
|
|
@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include "tile.h"
|
#include "tile.h"
|
||||||
#include "environment.h"
|
#include "environment.h"
|
||||||
#include "collision.h"
|
#include "collision.h"
|
||||||
|
#include "collidableobject.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include <ICameraSceneNode.h>
|
#include <ICameraSceneNode.h>
|
||||||
#include <ITextSceneNode.h>
|
#include <ITextSceneNode.h>
|
||||||
|
@ -1681,7 +1682,7 @@ void MobV2CAO::setLooks(const std::string &looks)
|
||||||
|
|
||||||
#include "luaentity_common.h"
|
#include "luaentity_common.h"
|
||||||
|
|
||||||
class LuaEntityCAO : public ClientActiveObject
|
class LuaEntityCAO : public ClientActiveObject , public CollidableObject
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
core::aabbox3d<f32> m_selection_box;
|
core::aabbox3d<f32> m_selection_box;
|
||||||
|
@ -1701,7 +1702,6 @@ private:
|
||||||
int m_anim_num_frames;
|
int m_anim_num_frames;
|
||||||
float m_anim_framelength;
|
float m_anim_framelength;
|
||||||
float m_anim_timer;
|
float m_anim_timer;
|
||||||
aabb3f m_collisionbox;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LuaEntityCAO(IGameDef *gamedef, ClientEnvironment *env):
|
LuaEntityCAO(IGameDef *gamedef, ClientEnvironment *env):
|
||||||
|
@ -2071,7 +2071,7 @@ LuaEntityCAO proto_LuaEntityCAO(NULL, NULL);
|
||||||
PlayerCAO
|
PlayerCAO
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class PlayerCAO : public ClientActiveObject
|
class PlayerCAO : public ClientActiveObject, public CollidableObject
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
core::aabbox3d<f32> m_selection_box;
|
core::aabbox3d<f32> m_selection_box;
|
||||||
|
@ -2085,7 +2085,6 @@ private:
|
||||||
LocalPlayer *m_local_player;
|
LocalPlayer *m_local_player;
|
||||||
float m_damage_visual_timer;
|
float m_damage_visual_timer;
|
||||||
bool m_dead;
|
bool m_dead;
|
||||||
aabb3f m_collisionbox;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlayerCAO(IGameDef *gamedef, ClientEnvironment *env):
|
PlayerCAO(IGameDef *gamedef, ClientEnvironment *env):
|
||||||
|
|
|
@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
#include "serverobject.h"
|
#include "serverobject.h"
|
||||||
#include "content_object.h"
|
#include "content_object.h"
|
||||||
|
#include "collidableobject.h"
|
||||||
|
|
||||||
class TestSAO : public ServerActiveObject
|
class TestSAO : public ServerActiveObject
|
||||||
{
|
{
|
||||||
|
@ -32,7 +33,6 @@ public:
|
||||||
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
|
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
|
||||||
const std::string &data);
|
const std::string &data);
|
||||||
void step(float dtime, bool send_recommended);
|
void step(float dtime, bool send_recommended);
|
||||||
inline aabb3f* getCollisionBox() { return NULL; }
|
|
||||||
private:
|
private:
|
||||||
float m_timer1;
|
float m_timer1;
|
||||||
float m_age;
|
float m_age;
|
||||||
|
@ -52,7 +52,6 @@ public:
|
||||||
ItemStack createItemStack();
|
ItemStack createItemStack();
|
||||||
void punch(ServerActiveObject *puncher, float time_from_last_punch);
|
void punch(ServerActiveObject *puncher, float time_from_last_punch);
|
||||||
float getMinimumSavedMovement(){ return 0.1*BS; }
|
float getMinimumSavedMovement(){ return 0.1*BS; }
|
||||||
inline aabb3f* getCollisionBox() { return NULL; }
|
|
||||||
private:
|
private:
|
||||||
std::string m_itemstring;
|
std::string m_itemstring;
|
||||||
bool m_itemstring_changed;
|
bool m_itemstring_changed;
|
||||||
|
@ -73,7 +72,6 @@ public:
|
||||||
std::string getClientInitializationData();
|
std::string getClientInitializationData();
|
||||||
std::string getStaticData();
|
std::string getStaticData();
|
||||||
void punch(ServerActiveObject *puncher, float time_from_last_punch);
|
void punch(ServerActiveObject *puncher, float time_from_last_punch);
|
||||||
inline aabb3f* getCollisionBox() { return NULL; }
|
|
||||||
private:
|
private:
|
||||||
bool m_is_active;
|
bool m_is_active;
|
||||||
IntervalLimiter m_inactive_interval;
|
IntervalLimiter m_inactive_interval;
|
||||||
|
@ -100,7 +98,6 @@ public:
|
||||||
std::string getStaticData();
|
std::string getStaticData();
|
||||||
void punch(ServerActiveObject *puncher, float time_from_last_punch);
|
void punch(ServerActiveObject *puncher, float time_from_last_punch);
|
||||||
bool isPeaceful(){return false;}
|
bool isPeaceful(){return false;}
|
||||||
inline aabb3f* getCollisionBox() { return NULL; }
|
|
||||||
private:
|
private:
|
||||||
void doDamage(u16 d);
|
void doDamage(u16 d);
|
||||||
|
|
||||||
|
@ -129,7 +126,6 @@ public:
|
||||||
void step(float dtime, bool send_recommended);
|
void step(float dtime, bool send_recommended);
|
||||||
std::string getClientInitializationData();
|
std::string getClientInitializationData();
|
||||||
std::string getStaticData();
|
std::string getStaticData();
|
||||||
inline aabb3f* getCollisionBox() { return NULL; }
|
|
||||||
private:
|
private:
|
||||||
bool m_is_active;
|
bool m_is_active;
|
||||||
IntervalLimiter m_inactive_interval;
|
IntervalLimiter m_inactive_interval;
|
||||||
|
@ -160,7 +156,6 @@ public:
|
||||||
void step(float dtime, bool send_recommended);
|
void step(float dtime, bool send_recommended);
|
||||||
void punch(ServerActiveObject *puncher, float time_from_last_punch);
|
void punch(ServerActiveObject *puncher, float time_from_last_punch);
|
||||||
bool isPeaceful();
|
bool isPeaceful();
|
||||||
inline aabb3f* getCollisionBox() { return NULL; }
|
|
||||||
private:
|
private:
|
||||||
void sendPosition();
|
void sendPosition();
|
||||||
void setPropertyDefaults();
|
void setPropertyDefaults();
|
||||||
|
@ -198,7 +193,7 @@ private:
|
||||||
|
|
||||||
struct LuaEntityProperties;
|
struct LuaEntityProperties;
|
||||||
|
|
||||||
class LuaEntitySAO : public ServerActiveObject
|
class LuaEntitySAO : public ServerActiveObject, public CollidableObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LuaEntitySAO(ServerEnvironment *env, v3f pos,
|
LuaEntitySAO(ServerEnvironment *env, v3f pos,
|
||||||
|
@ -245,7 +240,6 @@ private:
|
||||||
v3f m_last_sent_velocity;
|
v3f m_last_sent_velocity;
|
||||||
float m_last_sent_position_timer;
|
float m_last_sent_position_timer;
|
||||||
float m_last_sent_move_precision;
|
float m_last_sent_move_precision;
|
||||||
aabb3f m_collisionbox;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,13 +22,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "serverobject.h"
|
#include "serverobject.h"
|
||||||
|
#include "collidableobject.h"
|
||||||
#include "content_object.h" // Object type IDs
|
#include "content_object.h" // Object type IDs
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Player on the server
|
Player on the server
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ServerRemotePlayer : public Player, public ServerActiveObject
|
class ServerRemotePlayer : public Player, public ServerActiveObject , public CollidableObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ServerRemotePlayer(ServerEnvironment *env);
|
ServerRemotePlayer(ServerEnvironment *env);
|
||||||
|
@ -96,7 +97,6 @@ public:
|
||||||
aabb3f* getCollisionBox();
|
aabb3f* getCollisionBox();
|
||||||
private:
|
private:
|
||||||
bool m_position_not_sent;
|
bool m_position_not_sent;
|
||||||
aabb3f m_collisionbox;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue