本文整理汇总了C++中LocalPlayer::setBreath方法的典型用法代码示例。如果您正苦于以下问题:C++ LocalPlayer::setBreath方法的具体用法?C++ LocalPlayer::setBreath怎么用?C++ LocalPlayer::setBreath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalPlayer
的用法示例。
在下文中一共展示了LocalPlayer::setBreath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: step
//.........这里部分代码省略.........
m_client->ndef()->get(n1).damage_per_second);
damage_per_second = MYMAX(damage_per_second,
m_client->ndef()->get(n2).damage_per_second);
damage_per_second = MYMAX(damage_per_second,
m_client->ndef()->get(n3).damage_per_second);
if(damage_per_second != 0)
{
damageLocalPlayer(damage_per_second, true);
}
}
// Protocol v29 make this behaviour obsolete
if (getGameDef()->getProtoVersion() < 29) {
/*
Drowning
*/
if (m_drowning_interval.step(dtime, 2.0)) {
v3f pf = lplayer->getPosition();
// head
v3s16 p = floatToInt(pf + v3f(0, BS * 1.6, 0), BS);
MapNode n = m_map->getNodeNoEx(p);
ContentFeatures c = m_client->ndef()->get(n);
u8 drowning_damage = c.drowning;
if (drowning_damage > 0 && lplayer->hp > 0) {
u16 breath = lplayer->getBreath();
if (breath > 10) {
breath = 11;
}
if (breath > 0) {
breath -= 1;
}
lplayer->setBreath(breath);
updateLocalPlayerBreath(breath);
}
if (lplayer->getBreath() == 0 && drowning_damage > 0) {
damageLocalPlayer(drowning_damage, true);
}
}
if (m_breathing_interval.step(dtime, 0.5)) {
v3f pf = lplayer->getPosition();
// head
v3s16 p = floatToInt(pf + v3f(0, BS * 1.6, 0), BS);
MapNode n = m_map->getNodeNoEx(p);
ContentFeatures c = m_client->ndef()->get(n);
if (!lplayer->hp) {
lplayer->setBreath(11);
} else if (c.drowning == 0) {
u16 breath = lplayer->getBreath();
if (breath <= 10) {
breath += 1;
lplayer->setBreath(breath);
updateLocalPlayerBreath(breath);
}
}
}
}
// Update lighting on local player (used for wield item)
u32 day_night_ratio = getDayNightRatio();
{
// Get node at head