Get passability of the player's current tile?

Hello all,
I have been at this a few hours now, and I am at my wit's end. I have been trying to find a script call that returns the passability of the tile that the player is currently standing on. I am aware of the existence of the very handy: $
JavaScript:
$gamePlayer.canPass(x,y,dir)
but the issue is with the direction parameter. It only allows for the checking of tiles at least one away from the player without causing issues. If I try to correct it by adding or subtracting from the x or y values then it can trigger when I don't want it to. For example:
JavaScript:
if($gamePlayer.direction() == 8) {
    if(!$gamePlayer.canPass($gamePlayer.x, $gamePlayer.y+1, 8)) {$gamePlayer.jump(0,-1)}
}
The intended use is clearly to jump up one tile at a time if the player is stuck on the current tile until they are in the clear using a parallel process. However, if the player were to have their back to the wall below or an npc would pass behind them they would still jump forward as soon as they became adjacent to the tile. I understand the logic behind that since the player's y value plus one still fails the passability check when going forward. I hope I'm just dumb and there is a simple solution to getting the passage type for the current tile or something like that, but I can't seem to find a solution. Thanks for the help!
the issue is with the direction parameter. It only allows for the checking of tiles at least one away from the player without causing issues.
Can you clarify this part? This method checks the passability out of the specified tile in the direction chosen. So if you want:
to jump up one tile at a time if the player is stuck on the current tile
then you shouldn't be manipulating the coordinates. The player is stuck on their current tile if this method returns false given the player's current coordinates.

If you're trying to do the kind of gameplay where you walk to a ledge and the character automatically hops along the pedestals beyond it, I think that would be achieved more easily by an event with a touch trigger that sets a move route.

If not, perhaps you can explain a bit more clearly exactly what you want to be happening during the game and how/when you're calling this.
It's because canPass checks map passability via Game_Character#isMapPassable, which checks passability for both the current and target tiles. That's because you shouldn't be able to walk onto a tile that is impassable from that direction.

For single-tile checks you can instead one of these in Conditional Branch -> Script:
  1. JavaScript:
    $gameMap.isPassable(1, 2, 4)
    "Is the map passable at x = 1, y = 2 in direction d = 4 (left)?"

  2. JavaScript:
    [2,4,6,8].some(d => $gameMap.isPassable(1, 2, d))
    "Is the map passable at x = 1, y = 2 in direction 2, 4, 6, and/or 8?"
I've used option 2 before for checking valid jump landings.

Or, like Turan says, you could give more detail/consider a rework.
Can you clarify this part?
Or, like Turan says, you could give more detail/consider a rework.
I see now that my example was confusing. Let me be specific about my purpose and the code that I have. I am putting together a sort of physics-based platforming system where you jump farther if running or walking. Obviously, by default, this causes you to get stuck a lot. My goal is to make the player "fall" if they are stuck in a wall or on top of an event. Now that I understand a bit better what the script call does this example is something I have set up:
JavaScript:
if(!$gamePlayer.isJumping() && $gamePlayer.direction() == 8) {
    if(!$gamePlayer.canPass($gamePlayer.x, $gamePlayer.y, 2)) {
        $gamePlayer.setDirectionFix(true);
        $gamePlayer.jump(0,1);
    }
    else {$gamePlayer.setDirectionFix(false);}
}
This is the piece for when the player is jumping upward and lands on a wall. I would like him to "fall" back down to the next available passable tile. However, the issue occurs where if backed against an impassable coordinate, whether it be from tileset or event, the player does this "falling" motion. It is annoying especially since it occurs if you land on the tile at the edge of the platform since the tile behind the player is impassable.

EDIT:
JavaScript:
[2,4,6,8].some(d => $gameMap.isPassable(1, 2, d))
I'll be playing around with this and update this post if it works.

EDIT 2:
Caethyril's code seems to work pretty well for tiles, so thank you very much. I'll just have to figure out something separately for events that collide with the player. I'll have to tweak both a bit to work with a pixel movement script I'd like to use, but any issues with that are for a different post.

EDIT 3:
In trying to make the motion look less jarring than jumping down 1 tile at a time, I came up with this event:
Spoiler: Image
Untitled.png
Now I am questioning my ability to use loops because I can't seem to understand why it freezes the whole game when I land on the impassable tile. It works fine without the loop and incrementing variable if the player just jump(0,1) down one tile at a time until in the clear. Can someone explain to me like I'm 5?

Final Edit:
I put getValue instead of just value which is why nothing was working. Loops in parallel processes aren't great either so I'm using Yanfly's region common events instead.

Original thread: https://forums.rpgmakerweb.com/threads/get-passability-of-the-players-current-tile.164867/