diff options
author | BlockMen <nmuelll@web.de> | 2014-04-11 15:32:46 +0200 |
---|---|---|
committer | BlockMen <nmuelll@web.de> | 2014-04-12 17:44:20 +0200 |
commit | c0ab09af747fc431dfb459ede30788cb9cd1c56b (patch) | |
tree | 7355b0b349a6d188e6066c00c3b3ef9b0a76f33e /src/server.cpp | |
parent | a1db9242ec491efdee70a7184aa61e861b17595a (diff) | |
download | minetest-c0ab09af747fc431dfb459ede30788cb9cd1c56b.tar.gz minetest-c0ab09af747fc431dfb459ede30788cb9cd1c56b.tar.bz2 minetest-c0ab09af747fc431dfb459ede30788cb9cd1c56b.zip |
Add player:set_eye_offset() by @MirceaKitsune and clean up
Diffstat (limited to 'src/server.cpp')
-rw-r--r-- | src/server.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/server.cpp b/src/server.cpp index 4f42cfabe..cbb9f427f 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3502,6 +3502,20 @@ void Server::SendLocalPlayerAnimations(u16 peer_id, v2f animation_frames[4], f32 m_clients.send(peer_id, 0, data, true); } +void Server::SendEyeOffset(u16 peer_id, v3f first, v3f third) +{ + std::ostringstream os(std::ios_base::binary); + + writeU16(os, TOCLIENT_EYE_OFFSET); + writeV3F1000(os, first); + writeV3F1000(os, third); + + // Make data buffer + std::string s = os.str(); + SharedBuffer<u8> data((u8 *)s.c_str(), s.size()); + // Send as reliable + m_clients.send(peer_id, 0, data, true); +} void Server::SendPlayerPrivileges(u16 peer_id) { Player *player = m_env->getPlayer(peer_id); @@ -4605,6 +4619,15 @@ bool Server::setLocalPlayerAnimations(Player *player, v2f animation_frames[4], f return true; } +bool Server::setPlayerEyeOffset(Player *player, v3f first, v3f third) +{ + if (!player) + return false; + + SendEyeOffset(player->peer_id, first, third); + return true; +} + bool Server::setSky(Player *player, const video::SColor &bgcolor, const std::string &type, const std::vector<std::string> ¶ms) { |