diff options
author | BlockMen <nmuelll@web.de> | 2014-01-08 13:47:53 +0100 |
---|---|---|
committer | BlockMen <nmuelll@web.de> | 2014-04-12 17:44:15 +0200 |
commit | a1db9242ec491efdee70a7184aa61e861b17595a (patch) | |
tree | 04bdd2302f8b3c4285ddb8f5ba669f7adc6bf4b9 /src/server.cpp | |
parent | e149d1ad9a623b9f8ca597839f7b850841c54781 (diff) | |
download | minetest-a1db9242ec491efdee70a7184aa61e861b17595a.tar.gz minetest-a1db9242ec491efdee70a7184aa61e861b17595a.tar.bz2 minetest-a1db9242ec491efdee70a7184aa61e861b17595a.zip |
Add third person view
Diffstat (limited to 'src/server.cpp')
-rw-r--r-- | src/server.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/server.cpp b/src/server.cpp index 5c93988b8..4f42cfabe 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3484,6 +3484,24 @@ void Server::SendMovePlayer(u16 peer_id) m_clients.send(peer_id, 0, data, true); } +void Server::SendLocalPlayerAnimations(u16 peer_id, v2f animation_frames[4], f32 animation_speed) +{ + std::ostringstream os(std::ios_base::binary); + + writeU16(os, TOCLIENT_LOCAL_PLAYER_ANIMATIONS); + writeV2F1000(os, animation_frames[0]); + writeV2F1000(os, animation_frames[1]); + writeV2F1000(os, animation_frames[2]); + writeV2F1000(os, animation_frames[3]); + writeF1000(os, animation_speed); + + // 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); @@ -4578,6 +4596,15 @@ void Server::hudSetHotbarSelectedImage(Player *player, std::string name) { SendHUDSetParam(player->peer_id, HUD_PARAM_HOTBAR_SELECTED_IMAGE, name); } +bool Server::setLocalPlayerAnimations(Player *player, v2f animation_frames[4], f32 frame_speed) +{ + if (!player) + return false; + + SendLocalPlayerAnimations(player->peer_id, animation_frames, frame_speed); + return true; +} + bool Server::setSky(Player *player, const video::SColor &bgcolor, const std::string &type, const std::vector<std::string> ¶ms) { |