The parts 1 and 2, if I understand correctly.
Actually, there is no call to rmgen in those parts, only access to g_Map.height. It should work as is.
I agree with what you and Fexor say about the TileObjectMap (or whatever name we call it). It's seems to me the design is not mature enough to syntheses all those features in a single object.
Yes, I'm aware of this too. The slope member, for instance, remains accurate while you avoid modifying the height map after computing the slope, and reading the various random map scripts, one can see height map manipulation can occur anywhere, not only at the beginning.
I'm aware of efficiency too: javascript is Ok, but... really slow. This is the reason why I added a 'lock' member to my tile object, because I think testing a bitfield with a mask is much faster than fetching one or more arrays to enforce constraints. It's not difficult to create a tile class from a bit pattern or set a lock bit from a tile class, but it must be done 'manually' which is error prone.
BTW, I'm rather surprised rmgen don't provide set operations on tile classes. Maybe, I didn't dig enough
Friendly,
P.S. The idea I had to remove artifacts don't work, or more accurately, removes them but introduces new ones ! too bad !