Skip to content

Expose landscape record data to Lua

To my understanding, the only way to get information about height/normals/textures of the terrain is to parse the data files directory yourself in Lua using the vfs (which is a lot of work to say the least).

Extending the API to provide that information would allow for things like dynamic footstep sounds (an example from Discord) or procedural generation of static objects at runtime.

I know there's extra caveats when it comes to modifying terrain at runtime or creating new landscape records but a read-only API doesn't seem that difficult to add.

Perhaps something along the lines of #Cell.getLandscape() that returns an object with relevant data (presumably parsed into 2d arrays instead of the compressed representation of LAND records).

Alternatively, extending openmw.world could also be an option. For example, world.getExteriorData(posX, posY), returning a userdata with elevation, landscape texture and a normal at a position.