Physics' layer-by-layer collisions, bugfix in gl_code

Layer by layer collision is now working (though needs testing since the
code is kinda hackish).

gl_code no longer crashes the program by attempting to tie a nonexistent
entitiy's shaders instead of the terrain piece