Home

LuaRendering

Allows rendering of geometric shapes, text and sprites in the game world through the global object named rendering. Each render object is identified by an id that is universally unique for the lifetime of a whole game.

If an entity target of an object is destroyed or changes surface, then the object is also destroyed.

Attributes

object_name

The class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.

Methods

draw_line

LuaRendering.draw_line{ color: Color, width: float, gap_length?: double, dash_length?: double, dash_offset?: double, from: ScriptRenderTarget, to: ScriptRenderTarget, surface: SurfaceIdentification, time_to_live?: uint32, blink_interval?: uint16, forces?: ForceSet, players?: Array<PlayerIdentification>, visible?: boolean, draw_on_ground?: boolean, only_in_alt_mode?: boolean, render_mode?: ScriptRenderMode } -> LuaRenderObject

Call As

rendering.draw_line{ color=color, width=width, from=from, to=to, surface=surface }

Call Convention

Create a line.

Parameters

Returns

draw_text

LuaRendering.draw_text{ text: LocalisedString, surface: SurfaceIdentification, target: ScriptRenderTarget, color: Color, scale?: double, font?: string, time_to_live?: uint32, blink_interval?: uint16, forces?: ForceSet, players?: Array<PlayerIdentification>, visible?: boolean, draw_on_ground?: boolean, orientation?: RealOrientation, alignment?: TextAlign, vertical_alignment?: VerticalTextAlign, scale_with_zoom?: boolean, only_in_alt_mode?: boolean, render_mode?: ScriptRenderMode, use_rich_text?: boolean } -> LuaRenderObject

Call As

rendering.draw_text{ text=text, surface=surface, target=target, color=color }

Call Convention

Create a text.

Not all fonts support scaling.

Parameters

Returns

draw_circle

LuaRendering.draw_circle{ color: Color, radius: double, width?: float, filled?: boolean, target: ScriptRenderTarget, surface: SurfaceIdentification, time_to_live?: uint32, blink_interval?: uint16, forces?: ForceSet, players?: Array<PlayerIdentification>, visible?: boolean, draw_on_ground?: boolean, only_in_alt_mode?: boolean, render_mode?: ScriptRenderMode } -> LuaRenderObject

Call As

rendering.draw_circle{ color=color, radius=radius, target=target, surface=surface }

Call Convention

Create a circle.

Parameters

Returns

draw_rectangle

LuaRendering.draw_rectangle{ color: Color, width?: float, filled?: boolean, left_top: ScriptRenderTarget, right_bottom: ScriptRenderTarget, surface: SurfaceIdentification, time_to_live?: uint32, blink_interval?: uint16, forces?: ForceSet, players?: Array<PlayerIdentification>, visible?: boolean, draw_on_ground?: boolean, only_in_alt_mode?: boolean, render_mode?: ScriptRenderMode } -> LuaRenderObject

Call As

rendering.draw_rectangle{ color=color, left_top=left_top, right_bottom=right_bottom, surface=surface }

Call Convention

Create a rectangle.

Parameters

Returns

draw_arc

LuaRendering.draw_arc{ color: Color, max_radius: double, min_radius: double, start_angle: float, angle: float, target: ScriptRenderTarget, surface: SurfaceIdentification, time_to_live?: uint32, blink_interval?: uint16, forces?: ForceSet, players?: Array<PlayerIdentification>, visible?: boolean, draw_on_ground?: boolean, only_in_alt_mode?: boolean, render_mode?: ScriptRenderMode } -> LuaRenderObject

Call As

rendering.draw_arc{ color=color, max_radius=max_radius, min_radius=min_radius, start_angle=start_angle, angle=angle, target=target, surface=surface }

Call Convention

Create an arc.

Parameters

Returns

draw_polygon

LuaRendering.draw_polygon{ color: Color, vertices: Array<ScriptRenderTarget>, target?: ScriptRenderTarget, orientation?: RealOrientation, orientation_target?: ScriptRenderTarget, use_target_orientation?: boolean, surface: SurfaceIdentification, time_to_live?: uint32, blink_interval?: uint16, forces?: ForceSet, players?: Array<PlayerIdentification>, visible?: boolean, draw_on_ground?: boolean, only_in_alt_mode?: boolean, render_mode?: ScriptRenderMode } -> LuaRenderObject

Call As

rendering.draw_polygon{ color=color, vertices=vertices, surface=surface }

Call Convention

Create a triangle mesh defined by a triangle strip.

Parameters

Returns

draw_sprite

LuaRendering.draw_sprite{ sprite: SpritePath, orientation?: RealOrientation, x_scale?: double, y_scale?: double, tint?: Color, render_layer?: RenderLayer, orientation_target?: ScriptRenderTarget, use_target_orientation?: boolean, oriented_offset?: Vector, target: ScriptRenderTarget, surface: SurfaceIdentification, time_to_live?: uint32, blink_interval?: uint16, forces?: ForceSet, players?: Array<PlayerIdentification>, visible?: boolean, only_in_alt_mode?: boolean, render_mode?: ScriptRenderMode } -> LuaRenderObject

Call As

rendering.draw_sprite{ sprite=sprite, target=target, surface=surface }

Call Convention

Create a sprite.

Parameters

Returns

draw_light

LuaRendering.draw_light{ sprite: SpritePath, orientation?: RealOrientation, scale?: float, intensity?: float, minimum_darkness?: float, oriented?: boolean, color?: Color, target: ScriptRenderTarget, surface: SurfaceIdentification, time_to_live?: uint32, blink_interval?: uint16, forces?: ForceSet, players?: Array<PlayerIdentification>, visible?: boolean, only_in_alt_mode?: boolean, render_mode?: ScriptRenderMode } -> LuaRenderObject

Call As

rendering.draw_light{ sprite=sprite, target=target, surface=surface }

Call Convention

Create a light.

The base game uses the utility sprites light_medium and light_small for lights.

Parameters

Returns

draw_animation

LuaRendering.draw_animation{ animation: string, orientation?: RealOrientation, x_scale?: double, y_scale?: double, tint?: Color, render_layer?: RenderLayer, animation_speed?: double, animation_offset?: double, orientation_target?: ScriptRenderTarget, use_target_orientation?: boolean, oriented_offset?: Vector, target: ScriptRenderTarget, surface: SurfaceIdentification, time_to_live?: uint32, blink_interval?: uint16, forces?: ForceSet, players?: Array<PlayerIdentification>, visible?: boolean, only_in_alt_mode?: boolean, render_mode?: ScriptRenderMode } -> LuaRenderObject

Call As

rendering.draw_animation{ animation=animation, target=target, surface=surface }

Call Convention

Create an animation.

Parameters

Returns

get_all_objects

LuaRendering.get_all_objects(mod_name?: string) -> Array<LuaRenderObject>

Call As

rendering.get_all_objects()

Call Convention

Gets an array of all valid objects.

Parameters

Returns

clear

LuaRendering.clear(mod_name?: string)

Call As

rendering.clear()

Call Convention

Destroys all render objects.

Parameters

get_object_by_id

LuaRendering.get_object_by_id(object_id: uint64) -> LuaRenderObject?

Call As

rendering.get_object_by_id(object_id)

Call Convention

Gives LuaRenderObject for given object ID. May return nil if object does not exist or is invalid.

Parameters

Returns