See the scripting methods of Scene object, namely EnableNode3D, DisableNode3D, EnableLight, DisableLight and SetLightColor. Using them you can enable/disable lights and blocked areas or even change light color at runtime.
The rest is just a matter of several variables and "if" conditions.