fix ice lighting, and don't freeze near fire or lava

This commit is contained in:
darkrose 2013-11-19 21:54:53 +10:00
parent 1418225b48
commit 3c63d43a24
2 changed files with 20 additions and 3 deletions

View File

@ -981,7 +981,7 @@ void content_mapnode_init()
f->description = std::string("Ice");
f->setAllTextures("ice.png");
f->setInventoryTextureCube("ice.png", "ice.png", "ice.png");
f->draw_type = CDT_GLASSLIKE;
f->draw_type = CDT_CUBELIKE;
f->light_propagates = true;
f->sunlight_propagates = true;
f->param_type = CPT_LIGHT;

View File

@ -1002,8 +1002,25 @@ void ServerEnvironment::step(float dtime)
}
if (n.getContent() == CONTENT_WATERSOURCE || n.getContent() == CONTENT_WATER) {
if (p.Y > 60 && p.Y < 200) {
n.setContent(CONTENT_ICE);
m_map->addNodeWithEvent(p, n);
bool found = false;
s16 range = (p.Y > 60) ? 2 : 4;
for(s16 x=-range; !found && x<=range; x++) {
for(s16 y=-1; !found && y<=1; y++) {
for(s16 z=-range; !found && z<=range; z++) {
MapNode n_test = m_map->getNodeNoEx(p+v3s16(x,y,z));
if (
n_test.getContent() == CONTENT_LAVASOURCE
|| n_test.getContent() == CONTENT_LAVA
|| n_test.getContent() == CONTENT_FIRE
)
found = true;
}
}
}
if (found == false) {
n.setContent(CONTENT_ICE);
m_map->addNodeWithEvent(p, n);
}
}
}else if (n.getContent() == CONTENT_ICE) {
bool found = false;