Created
March 30, 2011 22:26
-
-
Save squiddy/895435 to your computer and use it in GitHub Desktop.
Bravo skylight spreading strength (MasterofJOKers)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/bravo/chunk.py b/bravo/chunk.py | |
| index 1b53573..6d6d519 100644 | |
| --- a/bravo/chunk.py | |
| +++ b/bravo/chunk.py | |
| @@ -198,7 +198,8 @@ class Chunk(object): | |
| while glow: | |
| for coords in spread: | |
| - if coords[2] > max_height: | |
| + if lightmap[coords] <= glow: | |
| + visited.add(coords) | |
| continue | |
| for dx, dz, dy in ( | |
| diff --git a/bravo/tests/test_chunk.py b/bravo/tests/test_chunk.py | |
| index 06623fe..acc0946 100644 | |
| --- a/bravo/tests/test_chunk.py | |
| +++ b/bravo/tests/test_chunk.py | |
| @@ -152,3 +152,21 @@ class TestLightmaps(unittest.TestCase): | |
| glow -= 1 | |
| assert_array_equal(self.c.skylight[:, :, 1], reference) | |
| + | |
| + def test_skylight_glow_spreading_strength(self): | |
| + # build some sort of arch which is lit by light that | |
| + # has fallen through some leaves | |
| + | |
| + # Fill it as if we were the boring generator. | |
| + self.c.blocks[:, :, 0].fill(1) | |
| + # set up a wall height 2, width 2 | |
| + self.c.blocks[:, 0:2, 1:3].fill(1) | |
| + # cut out one block | |
| + self.c.blocks[1, 1, 1] = 0 | |
| + # a floor out of leaves | |
| + # so the light under it will be 11 | |
| + self.c.blocks[:, 2:, 2:6].fill(18) | |
| + self.c.regenerate() | |
| + | |
| + print self.c.skylight[:, :, 1] | |
| + self.assertEqual(self.c.skylight[1, 1, 1], 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment