Ok, making it work was actually quite fun ^^
Whether a specific tile is a roof, wall or block depends on the terrain tag. The terrain tag is refer from the top layer first (x,y,2) then (x,y,1) and down to (x,y,0) until it finds a non-zero terrain tag. You put a tile on layer 1 that had terrain tag 0, where layer 0 had terrain tag 7. So fetching 7 is to be expected.
The actual tile ids fetched are dependent on layer 0 so the walls you put on layer 1 is ignore then. Moreover autotiles have a significant impact. I.e. you may have to change the tiles surrounding the tiles you are changing.
Here is a link to the fixed demo:
https://www.mediafire.com/?c1wckdq4q7q1xq1
I have added two methods to Game_Map which should help you. Call
$game_map.map_data_change when the lights should be updated after changes to the game map data.
The
$game_map.change_shadow_data(x, y, new_value) is used to simplify removing shadows from the game map while preserving any Region ID there might be specified.
I have been very specific with the autotile ids so there is work left generalizing those, but I hope this is enough to help you progress further on your own.
*hugs*
- Zeriab