summaryrefslogtreecommitdiff
path: root/src/content_sao.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/content_sao.cpp')
-rw-r--r--src/content_sao.cpp60
1 files changed, 51 insertions, 9 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index 718a42dff..ae08b4260 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -31,7 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "genericobject.h"
#include "util/serialize.h"
-core::map<u16, ServerActiveObject::Factory> ServerActiveObject::m_types;
+std::map<u16, ServerActiveObject::Factory> ServerActiveObject::m_types;
/*
DummyLoadSAO
@@ -64,6 +64,10 @@ public:
infostream<<"DummyLoadSAO step"<<std::endl;
}
+ bool getCollisionBox(aabb3f *toset) {
+ return false;
+ }
+
private:
};
@@ -132,6 +136,10 @@ public:
}
}
+ bool getCollisionBox(aabb3f *toset) {
+ return false;
+ }
+
private:
float m_timer1;
float m_age;
@@ -208,8 +216,7 @@ public:
v3f pos_f_old = pos_f;
v3f accel_f = v3f(0,0,0);
f32 stepheight = 0;
- IGameDef *gamedef = m_env->getGameDef();
- moveresult = collisionMoveSimple(&m_env->getMap(), gamedef,
+ moveresult = collisionMoveSimple(m_env,m_env->getGameDef(),
pos_max_d, box, stepheight, dtime,
pos_f, m_speed_f, accel_f);
@@ -314,6 +321,10 @@ public:
return 0;
}
+ bool getCollisionBox(aabb3f *toset) {
+ return false;
+ }
+
private:
std::string m_itemstring;
@@ -370,8 +381,7 @@ LuaEntitySAO::LuaEntitySAO(ServerEnvironment *env, v3f pos,
}
// Initialize something to armor groups
- m_armor_groups["fleshy"] = 3;
- m_armor_groups["snappy"] = 2;
+ m_armor_groups["fleshy"] = 100;
}
LuaEntitySAO::~LuaEntitySAO()
@@ -490,8 +500,7 @@ void LuaEntitySAO::step(float dtime, bool send_recommended)
v3f p_pos = m_base_position;
v3f p_velocity = m_velocity;
v3f p_acceleration = m_acceleration;
- IGameDef *gamedef = m_env->getGameDef();
- moveresult = collisionMoveSimple(&m_env->getMap(), gamedef,
+ moveresult = collisionMoveSimple(m_env,m_env->getGameDef(),
pos_max_d, box, stepheight, dtime,
p_pos, p_velocity, p_acceleration);
// Apply results
@@ -880,6 +889,22 @@ void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end)
m_messages_out.push_back(aom);
}
+bool LuaEntitySAO::getCollisionBox(aabb3f *toset) {
+ if (m_prop.physical)
+ {
+ //update collision box
+ toset->MinEdge = m_prop.collisionbox.MinEdge * BS;
+ toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS;
+
+ toset->MinEdge += m_base_position;
+ toset->MaxEdge += m_base_position;
+
+ return true;
+ }
+
+ return false;
+}
+
/*
PlayerSAO
*/
@@ -916,8 +941,7 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
assert(m_peer_id != 0);
setBasePosition(m_player->getPosition());
m_inventory = &m_player->inventory;
- m_armor_groups["choppy"] = 2;
- m_armor_groups["fleshy"] = 3;
+ m_armor_groups["fleshy"] = 100;
m_prop.hp_max = PLAYER_MAX_HP;
m_prop.physical = false;
@@ -1230,6 +1254,20 @@ void PlayerSAO::moveTo(v3f pos, bool continuous)
m_moved = true;
}
+void PlayerSAO::setYaw(float yaw)
+{
+ m_player->setYaw(yaw);
+ // Force change on client
+ m_moved = true;
+}
+
+void PlayerSAO::setPitch(float pitch)
+{
+ m_player->setPitch(pitch);
+ // Force change on client
+ m_moved = true;
+}
+
int PlayerSAO::punch(v3f dir,
const ToolCapabilities *toolcap,
ServerActiveObject *puncher,
@@ -1420,3 +1458,7 @@ std::string PlayerSAO::getPropertyPacket()
return gob_cmd_set_properties(m_prop);
}
+bool PlayerSAO::getCollisionBox(aabb3f *toset) {
+ //player collision handling is already done clientside no need to do it twice
+ return false;
+}