liquid_alternative_flowing = "",
liquid_alternative_source = "",
liquid_viscosity = 0,
+ drowning = 0,
light_source = 0,
damage_per_second = 0,
selection_box = {type="regular"},
freezemelt = "", -- water for snow/ice, ice/snow for water
leveled = 0, -- Block contain level in param2. value - default level, used for snow. Dont forget use "leveled" type nodebox
liquid_range = 8, -- number of flowing nodes arround source (max. 8)
- drowning = true, -- Player will drown in these
+ drowning = 0, -- Player will take this amount of damage if no bubbles are left
two or more sources nearly?
light_source = 0, -- Amount of light emitted by node
damage_per_second = 0, -- If player is inside node, this damage is caused
pointable = false,
diggable = false,
buildable_to = true,
+ drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "default:water_flowing",
liquid_alternative_source = "default:water_source",
pointable = false,
diggable = false,
buildable_to = true,
+ drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "default:water_flowing",
liquid_alternative_source = "default:water_source",
pointable = false,
diggable = false,
buildable_to = true,
+ drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "default:lava_flowing",
liquid_alternative_source = "default:lava_source",
pointable = false,
diggable = false,
buildable_to = true,
+ drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "default:lava_flowing",
liquid_alternative_source = "default:lava_source",
v3s16 p = floatToInt(pf + v3f(0, BS*1.6, 0), BS);
MapNode n = m_map->getNodeNoEx(p);
ContentFeatures c = m_gamedef->ndef()->get(n);
- if(c.isLiquid() && c.drowning && lplayer->hp > 0){
+ u8 drowning_damage = c.drowning;
+ if(drowning_damage > 0 && lplayer->hp > 0){
u16 breath = lplayer->getBreath();
if(breath > 10){
breath = 11;
updateLocalPlayerBreath(breath);
}
- if(lplayer->getBreath() == 0){
- damageLocalPlayer(1, true);
+ if(lplayer->getBreath() == 0 && drowning_damage > 0){
+ damageLocalPlayer(drowning_damage, true);
}
}
if(m_breathing_interval.step(dtime, 0.5))
if (!lplayer->hp){
lplayer->setBreath(11);
}
- else if(!c.isLiquid() || !c.drowning){
+ else if(c.drowning == 0){
u16 breath = lplayer->getBreath();
if(breath <= 10){
breath += 1;
liquid_renewable = true;
freezemelt = "";
liquid_range = LIQUID_LEVEL_MAX+1;
- drowning = true;
+ drowning = 0;
light_source = 0;
damage_per_second = 0;
node_box = NodeBox();
std::string freezemelt;
// Number of flowing liquids surrounding source
u8 liquid_range;
- bool drowning;
+ u8 drowning;
// Amount of light the node emits
u8 light_source;
u32 damage_per_second;
getboolfield(L, index, "liquid_renewable", f.liquid_renewable);
getstringfield(L, index, "freezemelt", f.freezemelt);
- getboolfield(L, index, "drowning", f.drowning);
+ f.drowning = getintfield_default(L, index,
+ "drowning", f.drowning);
// Amount of light the node emits
f.light_source = getintfield_default(L, index,
"light_source", f.light_source);