The Goal : To be able to have moving entities (running a move code) react to obstructions the same way the player does (when using arrow keys to move). I.e. If you move straight and hit a diagonal obstruction, you start moving diagonally. If you move diagonally and hit a straight obstruction, you start moving straight.
The first challenge to this goal is that move codes don't really allow diagonal motion. As far as I can tell, the best you can do is set your move code to "pixel perfect" and step along the approximate slope you want (e.g. movecode="p 1r 1d b" for down-right diagonal, etc).
The second challenge is, as far as I've been able to ascertain from the docs and experimentation, you can make an entity respond to obstructions by setting:
entity.obstructable[id] = 1
But this does not help us accomplish The Goal because when you hit an obstruction, your movecode stalls out, since it can't go where you're telling it to go.
I can think of several long, painful, and hackish ways to manually move an entity along an arbitrary slope and have it react to obstruction pixels. Checking pixel obstructions, moving one pixel at a time, and hacking the rendering code... or something similar with timed movecode updates so an obstructed move can fail and move on to the next step... that sort of thing.
It seems like a lot of work to do something that is built into the Player's movement processing already.
Is there currently any way to access the Player obstruction handling for movecodes? Or can anyone think of a less hackish way to reach The Goal?
My original thought was to go and look at the Player and movecode code in the V3 engine, and maybe do a little copy-pasting or add a new letter to movecodes to turn on Player-style obstruction handling, but it took all of 30 seconds to find the words "closed source" in the docs, so that's not a likely option. Plus I'm sure Vecna and co have thought of similar things before and probably have a good reason that option doesn't exist (right?).
And for those of you who just have to know why I want to make this work, my combat system includes knockback on a map with obstructions. Like I said, I can hack up something ugly to make it work... just fishing for a better solution.