mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Send Position packet on event, don't check it at each AsyncRunStep.
* This permit to cleanup the player checking loop
This commit is contained in:
parent
7f8f9785d7
commit
40bf1d7b5f
5 changed files with 10 additions and 45 deletions
|
@ -581,32 +581,6 @@ void Server::AsyncRunStep(bool initial_step)
|
|||
Do background stuff
|
||||
*/
|
||||
|
||||
/*
|
||||
Handle players
|
||||
*/
|
||||
{
|
||||
JMutexAutoLock lock(m_env_mutex);
|
||||
|
||||
std::list<u16> clientids = m_clients.getClientIDs();
|
||||
|
||||
ScopeProfiler sp(g_profiler, "Server: handle players");
|
||||
|
||||
for(std::list<u16>::iterator
|
||||
i = clientids.begin();
|
||||
i != clientids.end(); ++i)
|
||||
{
|
||||
PlayerSAO *playersao = getPlayerSAO(*i);
|
||||
if(playersao == NULL)
|
||||
continue;
|
||||
|
||||
|
||||
if(playersao->m_moved) {
|
||||
SendMovePlayer(*i);
|
||||
playersao->m_moved = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Transform liquids */
|
||||
m_liquid_transform_timer += dtime;
|
||||
if(m_liquid_transform_timer >= m_liquid_transform_every)
|
||||
|
@ -2590,6 +2564,7 @@ void Server::RespawnPlayer(u16 peer_id)
|
|||
bool repositioned = m_script->on_respawnplayer(playersao);
|
||||
if(!repositioned){
|
||||
v3f pos = findSpawnPos(m_env->getServerMap());
|
||||
// setPos will send the new position to client
|
||||
playersao->setPos(pos);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue