summaryrefslogtreecommitdiff
path: root/src/clientiface.cpp
diff options
context:
space:
mode:
authorNer'zhul <nerzhul@users.noreply.github.com>2016-10-30 14:53:26 +0100
committerGitHub <noreply@github.com>2016-10-30 14:53:26 +0100
commit9d25242c5c1411d692254cf910345d51c9a24fa3 (patch)
treeedec8475b32562379d463757e77031bdc994e971 /src/clientiface.cpp
parentd43326021a9a7def27773ed1f7ec01992ed3abf6 (diff)
downloadminetest-9d25242c5c1411d692254cf910345d51c9a24fa3.tar.gz
minetest-9d25242c5c1411d692254cf910345d51c9a24fa3.tar.bz2
minetest-9d25242c5c1411d692254cf910345d51c9a24fa3.zip
PlayerSAO/LocalPlayer refactor: (#4612)
* Create UnitSAO, a common part between PlayerSAO & LuaEntitySAO * Move breath to PlayerSAO & LocalPlayer * Migrate m_yaw from (Remote)Player & LuaEntitySAO to UnitSAO * Migrate m_yaw from Player to LocalPlayer for client * Move some functions outside of player class to PlayerSAO/RemotePlayer or LocalPlayer depending on which class needs it * Move pitch to LocalPlayer & PlayerSAO * Move m_position from Player to LocalPlayer * Move camera_barely_in_ceiling to LocalPlayer as it's used only there * use PlayerSAO::m_base_position for Server side positions * remove a unused variable * ServerActiveObject::setPos now uses const ref * use ServerEnv::loadPlayer unconditionnaly as it creates RemotePlayer only if it's not already loaded * Move hp from Player to LocalPlayer * Move m_hp from LuaEntitySAO to UnitSAO * Use m_hp from PlayerSAO/UnitSAO instead of RemotePlayer
Diffstat (limited to 'src/clientiface.cpp')
-rw-r--r--src/clientiface.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/clientiface.cpp b/src/clientiface.cpp
index d78cf1c53..d2e3a6da0 100644
--- a/src/clientiface.cpp
+++ b/src/clientiface.cpp
@@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "environment.h"
#include "map.h"
#include "emerge.h"
-#include "serverobject.h" // TODO this is used for cleanup of only
+#include "content_sao.h" // TODO this is used for cleanup of only
#include "log.h"
#include "util/srp.h"
@@ -82,6 +82,10 @@ void RemoteClient::GetNextBlocks (
if (player == NULL)
return;
+ PlayerSAO *sao = player->getPlayerSAO();
+ if (sao == NULL)
+ return;
+
// Won't send anything if already sending
if(m_blocks_sending.size() >= g_settings->getU16
("max_simultaneous_block_sends_per_client"))
@@ -90,7 +94,7 @@ void RemoteClient::GetNextBlocks (
return;
}
- v3f playerpos = player->getPosition();
+ v3f playerpos = sao->getBasePosition();
v3f playerspeed = player->getSpeed();
v3f playerspeeddir(0,0,0);
if(playerspeed.getLength() > 1.0*BS)
@@ -103,10 +107,10 @@ void RemoteClient::GetNextBlocks (
v3s16 center = getNodeBlockPos(center_nodepos);
// Camera position and direction
- v3f camera_pos = player->getEyePosition();
+ v3f camera_pos = sao->getEyePosition();
v3f camera_dir = v3f(0,0,1);
- camera_dir.rotateYZBy(player->getPitch());
- camera_dir.rotateXZBy(player->getYaw());
+ camera_dir.rotateYZBy(sao->getPitch());
+ camera_dir.rotateXZBy(sao->getYaw());
/*infostream<<"camera_dir=("<<camera_dir.X<<","<<camera_dir.Y<<","
<<camera_dir.Z<<")"<<std::endl;*/