本文整理汇总了C++中PlayerSAO::resetTimeFromLastPunch方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerSAO::resetTimeFromLastPunch方法的具体用法?C++ PlayerSAO::resetTimeFromLastPunch怎么用?C++ PlayerSAO::resetTimeFromLastPunch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerSAO
的用法示例。
在下文中一共展示了PlayerSAO::resetTimeFromLastPunch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessData
//.........这里部分代码省略.........
n = m_env->getMap().getNodeNoEx(p_under, &pos_ok);
if (pos_ok)
n = m_env->getMap().getNodeNoEx(p_under, &pos_ok);
if (!pos_ok) {
infostream<<"Server: Not punching: Node not found."
<<" Adding block to emerge queue."
<<std::endl;
m_emerge->enqueueBlockEmerge(peer_id, getNodeBlockPos(p_above), false);
}
if(n.getContent() != CONTENT_IGNORE)
m_script->node_on_punch(p_under, n, playersao, pointed);
// Cheat prevention
playersao->noCheatDigStart(p_under);
}
else if(pointed.type == POINTEDTHING_OBJECT)
{
// Skip if object has been removed
if(pointed_object->m_removed)
return;
actionstream<<player->getName()<<" punches object "
<<pointed.object_id<<": "
<<pointed_object->getDescription()<<std::endl;
ItemStack punchitem = playersao->getWieldedItem();
ToolCapabilities toolcap =
punchitem.getToolCapabilities(m_itemdef);
v3f dir = (pointed_object->getBasePosition() -
(player->getPosition() + player->getEyeOffset())
).normalize();
float time_from_last_punch =
playersao->resetTimeFromLastPunch();
s16 src_original_hp = pointed_object->getHP();
s16 dst_origin_hp = playersao->getHP();
pointed_object->punch(dir, &toolcap, playersao,
time_from_last_punch);
// If the object is a player and its HP changed
if (src_original_hp != pointed_object->getHP() &&
pointed_object->getType() == ACTIVEOBJECT_TYPE_PLAYER) {
SendPlayerHPOrDie(((PlayerSAO*)pointed_object)->getPeerID(),
pointed_object->getHP() == 0);
}
// If the puncher is a player and its HP changed
if (dst_origin_hp != playersao->getHP()) {
SendPlayerHPOrDie(playersao->getPeerID(), playersao->getHP() == 0);
}
stat.add("punch", player->getName());
}
} // action == 0
/*
1: stop digging
*/
else if(action == 1)
{
} // action == 1
/*