tuned lava/universal damage code
parent
8f42a8be0c
commit
472585a7e8
|
@ -449,6 +449,7 @@ void content_mapnode_init()
|
||||||
f->liquid_type = LIQUID_FLOWING;
|
f->liquid_type = LIQUID_FLOWING;
|
||||||
f->liquid_alternative_flowing = CONTENT_LAVA;
|
f->liquid_alternative_flowing = CONTENT_LAVA;
|
||||||
f->liquid_alternative_source = CONTENT_LAVASOURCE;
|
f->liquid_alternative_source = CONTENT_LAVASOURCE;
|
||||||
|
f->damage_per_second = 4*2;
|
||||||
if(f->special_material == NULL && g_texturesource)
|
if(f->special_material == NULL && g_texturesource)
|
||||||
{
|
{
|
||||||
// Flowing lava material
|
// Flowing lava material
|
||||||
|
@ -496,6 +497,7 @@ void content_mapnode_init()
|
||||||
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
|
||||||
f->liquid_alternative_flowing = CONTENT_LAVA;
|
f->liquid_alternative_flowing = CONTENT_LAVA;
|
||||||
f->liquid_alternative_source = CONTENT_LAVASOURCE;
|
f->liquid_alternative_source = CONTENT_LAVASOURCE;
|
||||||
|
f->damage_per_second = 4*2;
|
||||||
if(f->special_material == NULL && g_texturesource)
|
if(f->special_material == NULL && g_texturesource)
|
||||||
{
|
{
|
||||||
// Flowing lava material
|
// Flowing lava material
|
||||||
|
|
|
@ -1638,18 +1638,28 @@ void ClientEnvironment::step(float dtime)
|
||||||
if(m_lava_hurt_interval.step(dtime, 1.0))
|
if(m_lava_hurt_interval.step(dtime, 1.0))
|
||||||
{
|
{
|
||||||
v3f pf = lplayer->getPosition();
|
v3f pf = lplayer->getPosition();
|
||||||
v3s16 p1 = floatToInt(pf + v3f(0, BS*0.0, 0), BS);
|
|
||||||
|
// Feet, middle and head
|
||||||
|
v3s16 p1 = floatToInt(pf + v3f(0, BS*0.1, 0), BS);
|
||||||
MapNode n1 = m_map->getNodeNoEx(p1);
|
MapNode n1 = m_map->getNodeNoEx(p1);
|
||||||
v3s16 p2 = floatToInt(pf + v3f(0, BS*1.5, 0), BS);
|
v3s16 p2 = floatToInt(pf + v3f(0, BS*0.8, 0), BS);
|
||||||
MapNode n2 = m_map->getNodeNoEx(p2);
|
MapNode n2 = m_map->getNodeNoEx(p2);
|
||||||
if(n1.getContent() == CONTENT_LAVA ||
|
v3s16 p3 = floatToInt(pf + v3f(0, BS*1.6, 0), BS);
|
||||||
n1.getContent() == CONTENT_LAVASOURCE ||
|
MapNode n3 = m_map->getNodeNoEx(p2);
|
||||||
n2.getContent() == CONTENT_LAVA ||
|
|
||||||
n2.getContent() == CONTENT_LAVASOURCE)
|
u32 damage_per_second = 0;
|
||||||
|
damage_per_second = MYMAX(damage_per_second,
|
||||||
|
content_features(n1).damage_per_second);
|
||||||
|
damage_per_second = MYMAX(damage_per_second,
|
||||||
|
content_features(n2).damage_per_second);
|
||||||
|
damage_per_second = MYMAX(damage_per_second,
|
||||||
|
content_features(n3).damage_per_second);
|
||||||
|
|
||||||
|
if(damage_per_second != 0)
|
||||||
{
|
{
|
||||||
ClientEnvEvent event;
|
ClientEnvEvent event;
|
||||||
event.type = CEE_PLAYER_DAMAGE;
|
event.type = CEE_PLAYER_DAMAGE;
|
||||||
event.player_damage.amount = 4*2; // 4 hearts
|
event.player_damage.amount = damage_per_second;
|
||||||
m_client_event_queue.push_back(event);
|
m_client_event_queue.push_back(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,6 +164,8 @@ struct ContentFeatures
|
||||||
|
|
||||||
// Digging properties for different tools
|
// Digging properties for different tools
|
||||||
DiggingPropertiesList digging_properties;
|
DiggingPropertiesList digging_properties;
|
||||||
|
|
||||||
|
u32 damage_per_second;
|
||||||
|
|
||||||
// NOTE: Move relevant properties to here from elsewhere
|
// NOTE: Move relevant properties to here from elsewhere
|
||||||
|
|
||||||
|
@ -192,6 +194,7 @@ struct ContentFeatures
|
||||||
special_atlas = NULL;
|
special_atlas = NULL;
|
||||||
light_source = 0;
|
light_source = 0;
|
||||||
digging_properties.clear();
|
digging_properties.clear();
|
||||||
|
damage_per_second = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentFeatures()
|
ContentFeatures()
|
||||||
|
|
Loading…
Reference in New Issue