Skip to main content

Documentation for the DebugDraw DLL mod's Lua API functions.

sm.debugDraw​

The DebugDraw DLL re-implements and enables the disabled (but already existing) sm.debugDraw functions.
Documentation for these functions already exists here.
However, the DLL also expands the API a little bit - these extra features are documented below.

sm.debugDraw.enabled​

local enabled = sm.debugDraw.enabled

Not a function, but a boolean flag indicating the state of the mod:

  • true means the DLL is loaded and enabled
  • false means the DLL is loaded but disabled (game launch flag not set)
  • nil means the DLL is not loaded (vanilla debugDraw functions do nothing; extra features below are not available)

drawLine​

sm.debugDraw.drawLine(from, to, color)

Draws a single debug line with the given color for a single frame.
To keep the line from immediately disappearing, the function needs to be called every frame.

Parameters:
  • from (Vec3): The start position of the line.
  • to (Vec3): The end position of the line.
  • color (Color): The color of the line.

setEnabledOverride​

sm.debugDraw.setEnabledOverride(state)

This function is intended to temporarily force-enable the DebugDraw library if it is disabled.
For this, the function is typically called with state = true, then sm.debugDraw commands are issued before calling this function again with state = false to "finish" drawing.

Parameters:
  • state (boolean): Whether DebugDraw is force-enabled or not. Defaults to false.

Terrain Script Environment​

The DLL also enables the debugDraw API to be used from the terrain script environment.
The API there is the same as in the game script environment.