本文整理汇总了C++中PlayerSAO::setWieldedItem方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerSAO::setWieldedItem方法的具体用法?C++ PlayerSAO::setWieldedItem怎么用?C++ PlayerSAO::setWieldedItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerSAO
的用法示例。
在下文中一共展示了PlayerSAO::setWieldedItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessData
//.........这里部分代码省略.........
*/
else if(action == 3)
{
ItemStack item = playersao->getWieldedItem();
// Reset build time counter
if(pointed.type == POINTEDTHING_NODE &&
item.getDefinition(m_itemdef).type == ITEM_NODE)
getClient(peer_id)->m_time_from_building = 0.0;
if(pointed.type == POINTEDTHING_OBJECT)
{
// Right click object
// Skip if object has been removed
if(pointed_object->m_removed)
return;
/* android bug - too many
actionstream<<player->getName()<<" right-clicks object "
<<pointed.object_id<<": "
<<pointed_object->getDescription()<<std::endl;
*/
// Do stuff
pointed_object->rightClick(playersao);
}
else if(m_script->item_OnPlace(
item, playersao, pointed))
{
// Placement was handled in lua
// Apply returned ItemStack
if (playersao->setWieldedItem(item)) {
SendInventory(playersao);
}
stat.add("place", player->getName());
//stat.add("place_" + item.name, player->getName());
}
// If item has node placement prediction, always send the
// blocks to make sure the client knows what exactly happened
RemoteClient *client = getClient(peer_id);
v3s16 blockpos = getNodeBlockPos(floatToInt(pointed_pos_above, BS));
v3s16 blockpos2 = getNodeBlockPos(floatToInt(pointed_pos_under, BS));
if(item.getDefinition(m_itemdef).node_placement_prediction != "") {
client->SetBlockNotSent(blockpos);
if(blockpos2 != blockpos) {
client->SetBlockNotSent(blockpos2);
}
}
else {
client->ResendBlockIfOnWire(blockpos);
if(blockpos2 != blockpos) {
client->ResendBlockIfOnWire(blockpos2);
}
}
} // action == 3
/*
4: use
*/
else if(action == 4)
{
ItemStack item = playersao->getWieldedItem();