1
0
Fork 0

Remove redundant code in player interact handler

mutilcraft-mt53
kwolekr 2015-10-04 02:53:52 -04:00
parent f0cd5da687
commit 7b01b94c6b
1 changed files with 9 additions and 7 deletions

View File

@ -1467,21 +1467,22 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
NOTE: This can be used in the future to check if NOTE: This can be used in the future to check if
somebody is cheating, by checking the timing. somebody is cheating, by checking the timing.
*/ */
MapNode n(CONTENT_IGNORE); MapNode n(CONTENT_IGNORE);
bool pos_ok; bool pos_ok;
n = m_env->getMap().getNodeNoEx(p_under, &pos_ok);
if (pos_ok)
n = m_env->getMap().getNodeNoEx(p_under, &pos_ok);
n = m_env->getMap().getNodeNoEx(p_under, &pos_ok);
if (!pos_ok) { if (!pos_ok) {
infostream << "Server: Not punching: Node not found." infostream << "Server: Not punching: Node not found."
<< " Adding block to emerge queue." << " Adding block to emerge queue."
<< std::endl; << std::endl;
m_emerge->enqueueBlockEmerge(pkt->getPeerId(), getNodeBlockPos(p_above), false); m_emerge->enqueueBlockEmerge(pkt->getPeerId(),
getNodeBlockPos(p_above), false);
} }
if (n.getContent() != CONTENT_IGNORE) if (n.getContent() != CONTENT_IGNORE)
m_script->node_on_punch(p_under, n, playersao, pointed); m_script->node_on_punch(p_under, n, playersao, pointed);
// Cheat prevention // Cheat prevention
playersao->noCheatDigStart(p_under); playersao->noCheatDigStart(p_under);
} }
@ -1540,7 +1541,8 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
infostream << "Server: Not finishing digging: Node not found." infostream << "Server: Not finishing digging: Node not found."
<< " Adding block to emerge queue." << " Adding block to emerge queue."
<< std::endl; << std::endl;
m_emerge->enqueueBlockEmerge(pkt->getPeerId(), getNodeBlockPos(p_above), false); m_emerge->enqueueBlockEmerge(pkt->getPeerId(),
getNodeBlockPos(p_above), false);
} }
/* Cheat prevention */ /* Cheat prevention */