mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
Add player:set_eye_offset() by @MirceaKitsune and clean up
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user