From 01c2b003e1efb839ad246eb939af7fa8336b9ad5 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 3 Apr 2011 16:21:06 +0300 Subject: commit before some more radical changes --- src/map.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index 0a1b65ace..39e351569 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -940,6 +940,15 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n, n.setLight(bank, 0); } + /* + 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 */ @@ -947,13 +956,13 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n, 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 & modified_blocks) //dstream<<"Map::transformLiquids(): loopcount="<m_node_metadata.getClone(p_rel); + return meta; +} + /* ServerMap */ -- cgit v1.2.3