The original engine has this bug too. I think you can check the base tile and see if it is a wall. Then get the wall direction and check for darkness on the other side.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The original engine has this bug too. I think you can check the base tile and see if it is a wall. Then get the wall direction and check for darkness on the other side.
I think spells are the only issue left as of revision 1485.
The target of usecode items will still target blacked out tiles. There really should be a check for this when returning objects that can be used.