MZ Plugin that sums passage of layers

Does anybody know of a plugin that would sum passage of all layers so that instead of using the top layer to check for passage it sums passage of all layers to determine if and how can you traverse the layer? Preferably with the exception of when terrain is marked a ladder it still uses the old method.
You'll need to clarify with examples how the layer passability would be different with the layers compounded.
So if you have 4 layers, you only want to be able to move to a tile if it's passable on all 4 layers?

Try saving this as a plugin (I haven't tested, so it might all crumple into a big heap):

Code:
Game_Map.prototype.checkPassage = function(x, y, bit) {
    var flags = this.tilesetFlags();
    var tiles = this.allTiles(x, y);
    for (var i = 0; i < tiles.length; i++) {
        var flag = flags[tiles[i]];
        if ((flag & 0x10) !== 0)  // [*] No effect on passage
            continue;
        if ((flag & bit) === bit) // [x] Impassable
            return false;
    }
    return true;
};

This will apply to the player as well as events. And there might be issues if you have other plugins that modify the behaviour.

Oh, sorry - I forgot the bit about the ladder. Let me know how the above goes, and I can come back later and update it for that.

Original thread: https://forums.rpgmakerweb.com/threads/plugin-that-sums-passage-of-layers.156916/