mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Add player:set_eye_offset() by @MirceaKitsune and clean up
This commit is contained in:
parent
a1db9242ec
commit
c0ab09af74
16 changed files with 108 additions and 13 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue