draw_line{color=…, width=…, gap_amount=…, gap_length=…, from=…, from_offset=…, to=…, to_offset=…, surface=…, time_to_live=…, forces=…, players=…} → uint64 | Create a line. |
draw_text{text=…, surface=…, target=…, target_offset=…, color=…, scale=…, font=…, time_to_live=…, forces=…, players=…, orientation=…, alignment=…, scale_with_zoom=…} → uint64 | Create a text. |
draw_circle{color=…, radius=…, width=…, filled=…, target=…, target_offset=…, surface=…, time_to_live=…, forces=…, players=…} → uint64 | Create a circle. |
draw_rectangle{color=…, width=…, filled=…, left_top=…, left_top_offset=…, right_bottom=…, right_bottom_offset=…, surface=…, time_to_live=…, forces=…, players=…} → uint64 | Create a rectangle. |
draw_arc{color=…, max_radius=…, min_radius=…, start_angle=…, angle=…, target=…, target_offset=…, surface=…, time_to_live=…, forces=…, players=…} → uint64 | Create an arc. |
draw_polygon{color=…, vertices=…, surface=…, time_to_live=…, forces=…, players=…} → uint64 | Create a polygon. |
draw_sprite{sprite=…, orientation=…, x_scale=…, y_scale=…, tint=…, render_layer=…, orientation_target=…, orientation_target_offset=…, oriented_offset=…, target=…, target_offset=…, surface=…, time_to_live=…, forces=…, players=…} → uint64 | Create a sprite. |
draw_light{sprite=…, orientation=…, scale=…, intensity=…, minimum_darkness=…, color=…, target=…, target_offset=…, surface=…, time_to_live=…, forces=…, players=…} → uint64 | Create a light. |
destroy(id) | Destroy the object with the given id. |
is_font_valid(font_name) → boolean | Does a font with this name exist? |
is_valid(id) → boolean | Does a valid object with this id exist? |
get_all_ids() → array of uint64 | Gets an array of all valid object ids. |
clear() | Destroys all render objects. |
get_type(id) → string | Gets the type of the given object. |
get_surface(id) → LuaSurface | The surface the object with this id is rendered on. |
get_time_to_live(id) → uint | 0 if this object does not expire. |
set_time_to_live(id, time_to_live) | Set to 0 if this object should not expire. |
get_forces(id) → array of LuaForce | Get the forces that the object with this id is rendered to or nil if visible to all forces. |
set_forces(id, forces) | Set the forces that the object with this id is rendered to. |
get_players(id) → array of LuaPlayer | Get the players that the object with this id is rendered to or nil if visible to all players. |
set_players(id, players) | Set the players that the object with this id is rendered to. |
get_color(id) → Color | Get the color or tint of the object with this id. |
set_color(id, color) | Set the color or tint of the object with this id. |
get_width(id) → float | Get the width of the object with this id. |
set_width(id, width) | Set the width of the object with this id. |
get_from(id) | Get from where the line with this id is drawn or nil if this object is not a line. |
set_from(id, from, from_offset) | Set from where the line with this id is drawn. |
get_to(id) | Get to where the line with this id is drawn or nil if the object is not a line. |
set_to(id, to, to_offset) | Set to where the line with this id is drawn. |
get_gap_amount(id) → uint | Get the amount of gaps in the line with this id or nil if the object is not a line. |
set_gap_amount(id, gap_amount) | Set the amount of gaps in the line with this id. |
get_gap_length(id) → uint | Get the length of the gaps in the line with this id or nil if the object is not a line. |
set_gap_length(id, gap_length) | Set the length of the gaps in the line with this id. |
get_target(id) | Get where the object with this id is drawn or nil if the object does not support target. |
set_target(id, target, target_offset) | Set where the object with this id is drawn. |
get_orientation(id) → float | Get the orientation of the text, sprite or light with this id or nil if the object is not a text, sprite or light. |
set_orientation(id, orientation) | Set the orientation of the text, sprite or light with this id. |
get_scale(id) → double | Get the scale of the text or light with this id or nil if the object is not a text or light. |
set_scale(id, scale) | Set the scale of the text or light with this id. |
get_text(id) → LocalisedString | Get the text that is displayed by the text with this id or nil if the object is not a text. |
set_text(id, text) | Set the text that is displayed by the text with this id. |
get_font(id) → string | Get the font of the text with this id or nil if the object is not a text. |
set_font(id, font) | Set the font of the text with this id. |
get_alignment(id) → string | Get the alignment of the text with this id or nil if the object is not a text. |
set_alignment(id, alignment) | Set the alignment of the text with this id. |
get_scale_with_zoom(id) → boolean | Get if the text with this id scales with player zoom or nil if the object is not a text. |
set_scale_with_zoom(id, scale_with_zoom) | Set if the text with this id scales with player zoom. |
get_filled(id) → boolean | Get if the circle or rectangle with this id is filled or nil if the object is not a circle or rectangle. |
set_filled(id, filled) | Set if the circle or rectangle with this id is filled. |
get_radius(id) → double | Get the radius of the circle with this id or nil if the object is not a circle. |
set_radius(id, radius) | Set the radius of the circle with this id. |
get_left_top(id) | Get where top left corner of the rectangle with this id is drawn or nil if the object is not a rectangle. |
set_left_top(id, left_top, left_top_offset) | Set where top left corner of the rectangle with this id is drawn. |
get_right_bottom(id) | Get where bottom right corner of the rectangle with this id is drawn or nil if the object is not a rectangle. |
set_right_bottom(id, right_bottom, right_bottom_offset) | Set where top bottom right of the rectangle with this id is drawn. |
get_max_radius(id) → double | Get the radius of the outer edge of the arc with this id or nil if the object is not a arc. |
set_max_radius(id, max_radius) | Set the radius of the outer edge of the arc with this id. |
get_min_radius(id) → double | Get the radius of the inner edge of the arc with this id or nil if the object is not a arc. |
set_min_radius(id, min_radius) | Set the radius of the inner edge of the arc with this id. |
get_start_angle(id) → float | Get where the arc with this id starts or nil if the object is not a arc. |
set_start_angle(id, start_angle) | Set where the arc with this id starts. |
get_angle(id) → float | Get the angle of the arc with this id or nil if the object is not a arc. |
set_angle(id, angle) | Set the angle of the arc with this id. |
get_vertices(id) → array of ScriptRenderTarget | Get the vertices of the polygon with this id or nil if the object is not a polygon. |
set_vertices(id, vertices) | Set the vertices of the polygon with this id. |
get_sprite(id) → SpritePath | Get the sprite of the sprite or light with this id or nil if the object is not a sprite or light. |
set_sprite(id, sprite) | Set the sprite of the sprite or light with this id. |
get_x_scale(id) → double | Get the horizontal scale of the sprite with this id or nil if the object is not a sprite. |
set_x_scale(id, x_scale) | Set the horizontal scale of the sprite with this id. |
get_y_scale(id) → double | Get the vertical scale of the sprite with this id or nil if the object is not a sprite. |
set_y_scale(id, y_scale) | Set the vertical scale of the sprite with this id. |
get_render_layer(id) → RenderLayer | Get the render layer of the sprite with this id or nil if the object is not a sprite. |
set_render_layer(id, render_layer) | Set the render layer of the sprite with this id. |
get_orientation_target(id) | The sprite rotates so that it faces this target. |
set_orientation_target(id, orientation_target, orientation_target_offset) | The sprite rotates so that it faces this target. |
get_oriented_offset(id) → Vector | Offsets the center of the sprite if orientation_target is given. |
set_oriented_offset(id, oriented_offset) | Offsets the center of the sprite if orientation_target is given. |
get_intensity(id) → float | Get the intensity of the light with this id or nil if the object is not a light. |
set_intensity(id, intensity) | Set the intensity of the light with this id. |
get_minimum_darkness(id) → float | Get the minimum darkness at which the light with this id is rendered or nil if the object is not a light. |
set_minimum_darkness(id, minimum_darkness) | Set the minimum darkness at which the light with this id is rendered. |
Allows rendering of geometric shapes, text and sprites in the game world. Each render object is identified by a unique id.
Create a line.
from
is a LuaEntity.to
is a LuaEntity.Create a text.
target
is a LuaEntity.Create a circle.
target
is a LuaEntity.Create a rectangle.
left_top
is a LuaEntity.right_bottom
is a LuaEntity.Create an arc.
target
is a LuaEntity.Create a polygon.
Create a sprite.
orientation
is still applied to the sprite.orientation_target
is a LuaEntity.orientation_target
is given. This offset will rotate together with the sprite.target
is a LuaEntity.Create a light.
target
is a LuaEntity.light_medium
and light_small
for lights.Destroy the object with the given id.
Gets an array of all valid object ids.
Destroys all render objects.
Get the forces that the object with this id is rendered to or nil
if visible to all forces.
Set the forces that the object with this id is rendered to.
Get the players that the object with this id is rendered to or nil
if visible to all players.
Set the players that the object with this id is rendered to.
Get the color or tint of the object with this id.
nil
if the object does not support color.Get the width of the object with this id.
nil
if the object does not support width. Get the amount of gaps in the line with this id or nil
if the object is not a line.
Get the length of the gaps in the line with this id or nil
if the object is not a line.
Get where the object with this id is drawn or nil
if the object does not support target.
Get the orientation of the text, sprite or light with this id or nil
if the object is not a text, sprite or light.
Get the scale of the text or light with this id or nil
if the object is not a text or light.
Get the text that is displayed by the text with this id or nil
if the object is not a text.
Set the text that is displayed by the text with this id. Does nothing if this object is not a text.
Get the font of the text with this id or nil
if the object is not a text.
Get the alignment of the text with this id or nil
if the object is not a text.
Get if the text with this id scales with player zoom or nil
if the object is not a text.
Get if the circle or rectangle with this id is filled or nil
if the object is not a circle or rectangle.
Get the radius of the circle with this id or nil
if the object is not a circle.
Get where top left corner of the rectangle with this id is drawn or nil
if the object is not a rectangle.
Get where bottom right corner of the rectangle with this id is drawn or nil
if the object is not a rectangle.
Get the radius of the outer edge of the arc with this id or nil
if the object is not a arc.
Get the radius of the inner edge of the arc with this id or nil
if the object is not a arc.
Get where the arc with this id starts or nil
if the object is not a arc.
Get the angle of the arc with this id or nil
if the object is not a arc.
Get the sprite of the sprite or light with this id or nil
if the object is not a sprite or light.
Set the sprite of the sprite or light with this id. Does nothing if this object is not a sprite or light.
Get the horizontal scale of the sprite with this id or nil
if the object is not a sprite.
Get the vertical scale of the sprite with this id or nil
if the object is not a sprite.
Get the render layer of the sprite with this id or nil
if the object is not a sprite.
Set the render layer of the sprite with this id. Does nothing if this object is not a sprite.
The sprite rotates so that it faces this target. Note that orientation
is still applied to the sprite.
Get the orientation_target of the sprite with this id or nil
if no target or if this object is not a sprite.
The sprite rotates so that it faces this target. Note that orientation
is still applied to the sprite.
Set the orientation_target of the sprite with this id. Does nothing if this object is not a sprite.
Set to nil
if the sprite should not have an orientation_target.
Offsets the center of the sprite if orientation_target
is given. This offset will rotate together with the sprite.
Get the oriented_offset of the sprite with this id or nil
if this object is not a sprite.
Get the intensity of the light with this id or nil
if the object is not a light.