diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-04-03 16:21:06 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-04-03 16:21:06 +0300 |
commit | 01c2b003e1efb839ad246eb939af7fa8336b9ad5 (patch) | |
tree | 9771fbd3321709f6aff0761ed7efc5a177823352 /src/map.cpp | |
parent | 06eb0ad4d063c696afa53cad75824c7778c5c157 (diff) | |
download | minetest-01c2b003e1efb839ad246eb939af7fa8336b9ad5.tar.gz minetest-01c2b003e1efb839ad246eb939af7fa8336b9ad5.tar.bz2 minetest-01c2b003e1efb839ad246eb939af7fa8336b9ad5.zip |
commit before some more radical changes
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/map.cpp b/src/map.cpp index 0a1b65ace..39e351569 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -941,19 +941,28 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n, } /* + If node lets sunlight through and is under sunlight, it has + sunlight too. + */ + if(node_under_sunlight && content_features(n.d).sunlight_propagates) + { + n.setLight(LIGHTBANK_DAY, LIGHT_SUN); + } + + /* Set the node on the map */ setNode(p, n); /* - If node is under sunlight, take all sunlighted nodes under - it and clear light from them and from where the light has - been spread. + If node is under sunlight and doesn't let sunlight through, + take all sunlighted nodes under it and clear light from them + and from where the light has been spread. TODO: This could be optimized by mass-unlighting instead of looping */ - if(node_under_sunlight) + if(node_under_sunlight && !content_features(n.d).sunlight_propagates) { s16 y = p.Y - 1; for(;; y--){ @@ -981,7 +990,7 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n, break; } } - + for(s32 i=0; i<2; i++) { enum LightBank bank = banks[i]; @@ -1687,6 +1696,17 @@ void Map::transformLiquids(core::map<v3s16, MapBlock*> & modified_blocks) //dstream<<"Map::transformLiquids(): loopcount="<<loopcount<<std::endl; } +NodeMetadata* Map::getNodeMetadataClone(v3s16 p) +{ + v3s16 blockpos = getNodeBlockPos(p); + v3s16 p_rel = p - blockpos*MAP_BLOCKSIZE; + MapBlock *block = getBlockNoCreateNoEx(blockpos); + if(block == NULL) + return NULL; + NodeMetadata *meta = block->m_node_metadata.getClone(p_rel); + return meta; +} + /* ServerMap */ |