if(m_base_position.Y > 8*BS)
m_base_position.Y = 2*BS;
- if(send_recommended == false)
+ if (!send_recommended)
return;
m_timer1 -= dtime;
m_env->getScriptIface()->luaentity_Remove(m_id);
}
- for (std::unordered_set<u32>::iterator it = m_attached_particle_spawners.begin();
- it != m_attached_particle_spawners.end(); ++it) {
- m_env->deleteParticleSpawner(*it, false);
+ for (u32 attached_particle_spawner : m_attached_particle_spawners) {
+ m_env->deleteParticleSpawner(attached_particle_spawner, false);
}
}
m_hp = m_prop.hp_max;
// Activate entity, supplying serialized state
m_env->getScriptIface()->
- luaentity_Activate(m_id, m_init_state.c_str(), dtime_s);
+ luaentity_Activate(m_id, m_init_state, dtime_s);
} else {
m_prop.infotext = m_init_name;
}
s16 hp = 1;
v3f velocity;
float yaw = 0;
- if(data != ""){
+ if (!data.empty()) {
std::istringstream is(data, std::ios::binary);
// read version
u8 version = readU8(is);
}
}
- if(send_recommended == false)
+ if (!send_recommended)
return;
if(!isAttached())
}
}
- if(m_armor_groups_sent == false){
+ if (!m_armor_groups_sent) {
m_armor_groups_sent = true;
std::string str = gob_cmd_update_armor_groups(
m_armor_groups);
m_messages_out.push(aom);
}
- if(m_animation_sent == false){
+ if (!m_animation_sent) {
m_animation_sent = true;
std::string str = gob_cmd_update_animation(
m_animation_range, m_animation_speed, m_animation_blend, m_animation_loop);
m_messages_out.push(aom);
}
- if(m_bone_position_sent == false){
+ if (!m_bone_position_sent) {
m_bone_position_sent = true;
for (std::unordered_map<std::string, core::vector2d<v3f>>::const_iterator
ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii){
}
}
- if(m_attachment_sent == false){
+ if (!m_attachment_sent) {
m_attachment_sent = true;
std::string str = gob_cmd_update_attachment(m_attachment_parent_id, m_attachment_bone, m_attachment_position, m_attachment_rotation);
// create message and add to list
{
assert(m_peer_id != 0); // pre-condition
- m_prop.hp_max = PLAYER_MAX_HP;
+ m_prop.hp_max = PLAYER_MAX_HP_DEFAULT;
m_prop.physical = false;
m_prop.weight = 75;
m_prop.collisionbox = aabb3f(-0.3f, 0.0f, -0.3f, 0.3f, 1.77f, 0.3f);
m_prop.visual = "upright_sprite";
m_prop.visual_size = v2f(1, 2);
m_prop.textures.clear();
- m_prop.textures.push_back("player.png");
- m_prop.textures.push_back("player_back.png");
+ m_prop.textures.emplace_back("player.png");
+ m_prop.textures.emplace_back("player_back.png");
m_prop.colors.clear();
- m_prop.colors.push_back(video::SColor(255, 255, 255, 255));
+ m_prop.colors.emplace_back(255, 255, 255, 255);
m_prop.spritediv = v2s16(1,1);
// end of default appearance
m_prop.is_visible = true;
m_prop.makes_footstep_sound = true;
m_prop.stepheight = PLAYER_DEFAULT_STEPHEIGHT * BS;
- m_hp = PLAYER_MAX_HP;
+ m_hp = m_prop.hp_max;
}
PlayerSAO::~PlayerSAO()
ServerActiveObject::removingFromEnvironment();
if (m_player->getPlayerSAO() == this) {
unlinkPlayerSessionAndSave();
- for (std::unordered_set<u32>::iterator it = m_attached_particle_spawners.begin();
- it != m_attached_particle_spawners.end(); ++it) {
- m_env->deleteParticleSpawner(*it, false);
+ for (u32 attached_particle_spawner : m_attached_particle_spawners) {
+ m_env->deleteParticleSpawner(attached_particle_spawner, false);
}
}
}
return os.str();
}
-void PlayerSAO::getStaticData(std::string *result) const
+void PlayerSAO::getStaticData(std::string * result) const
{
FATAL_ERROR("Deprecated function");
}
return 0;
// No effect if PvP disabled
- if (g_settings->getBool("enable_pvp") == false) {
+ if (!g_settings->getBool("enable_pvp")) {
if (puncher->getType() == ACTIVEOBJECT_TYPE_PLAYER) {
std::string str = gob_cmd_punched(0, getHP());
// create message and add to list
if (hp < 0)
hp = 0;
- else if (hp > PLAYER_MAX_HP)
- hp = PLAYER_MAX_HP;
+ else if (hp > m_prop.hp_max)
+ hp = m_prop.hp_max;
if (hp < oldhp && !g_settings->getBool("enable_damage")) {
return;
return false;
}
- getCollisionBox(toset);
+ toset->MinEdge = m_prop.collisionbox.MinEdge * BS;
+ toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS;
return true;
}