Using shift-enter doesn't place the player on shallow water even though you can walk on it. Shallow water is in vanilla but not generated by vanilla map-gen. See https://mods.factorio.com/mod/CanalBuilderMAV, https://mods.factorio.com/mod/Waterfill_Shallow, or Alien Biomes to get it in game (or just use /editor
).
The problem is that you are using tile_player_test_item
to test for collision, which has "water-tile"
in the collision mask. Much better to instead call surface.find_non_colliding_position
with the name of the character entity itself (player.character.name
), which is guaranteed to have the correct collision mask.