本文整理汇总了C++中PlayerSAO::getNoCheatDigPos方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerSAO::getNoCheatDigPos方法的具体用法?C++ PlayerSAO::getNoCheatDigPos怎么用?C++ PlayerSAO::getNoCheatDigPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerSAO
的用法示例。
在下文中一共展示了PlayerSAO::getNoCheatDigPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessData
//.........这里部分代码省略.........
stat.add("punch", player->getName());
}
} // action == 0
/*
1: stop digging
*/
else if(action == 1)
{
} // action == 1
/*
2: Digging completed
*/
else if(action == 2)
{
// Only digging of nodes
if(pointed.type == POINTEDTHING_NODE)
{
bool pos_ok;
MapNode n = m_env->getMap().getNodeNoEx(p_under, &pos_ok);
if (!pos_ok) {
infostream << "Server: Not finishing digging: Node not found."
<< " Adding block to emerge queue."
<< std::endl;
m_emerge->enqueueBlockEmerge(peer_id, getNodeBlockPos(p_above), false);
}
/* Cheat prevention */
bool is_valid_dig = true;
if(!isSingleplayer() && !g_settings->getBool("disable_anticheat"))
{
v3s16 nocheat_p = playersao->getNoCheatDigPos();
float nocheat_t = playersao->getNoCheatDigTime();
playersao->noCheatDigEnd();
// If player didn't start digging this, ignore dig
if(nocheat_p != p_under){
infostream<<"Server: NoCheat: "<<player->getName()
<<" started digging "
<<PP(nocheat_p)<<" and completed digging "
<<PP(p_under)<<"; not digging."<<std::endl;
is_valid_dig = false;
// Call callbacks
m_script->on_cheat(playersao, "finished_unknown_dig");
}
// Get player's wielded item
ItemStack playeritem;
InventoryList *mlist = playersao->getInventory()->getList("main");
if(mlist != NULL)
playeritem = mlist->getItem(playersao->getWieldIndex());
ToolCapabilities playeritem_toolcap =
playeritem.getToolCapabilities(m_itemdef);
// Get diggability and expected digging time
DigParams params = getDigParams(m_nodedef->get(n).groups,
&playeritem_toolcap);
// If can't dig, try hand
if(!params.diggable){
const ItemDefinition &hand = m_itemdef->get("");
const ToolCapabilities *tp = hand.tool_capabilities;
if(tp)
params = getDigParams(m_nodedef->get(n).groups, tp);
}
// If can't dig, ignore dig
if(!params.diggable){
infostream<<"Server: NoCheat: "<<player->getName()