Add on_layer event and layermod macro.