1) I believe the polflip has some kind of slant detection for ceilings. It doesn't care for slopes though.
viewtopic.php?f=101&t=24442
If not the polflip, then the ceiling and floor stretch npcs in basegame share custom edge detection code that works similarly. That code may be difficult to understand, though, as all 4 possible stretch directions share the same lines of code.
Basically, it's two getIntersectings in the facing direction, placed just in front of the hitbox. One above the current y for pits, and one below for walls.
2) Yes. You can, for specific harm types, override the speed values of an effect. Look at the monty mole in basegame (npc-309.lua i believe).
[HARM_TYPE_JUMP]={id=170, speedX=0, speedY=0},
[HARM_TYPE_FROMBELOW]=170,