Home

LuaRenderObject

Reference to a single LuaRendering object.

Attributes

id

Unique identifier of this render object.

type

Type of this object.

surface

Surface this object is rendered on.

time_to_live

Time to live of this object. This will be 0 if the object does not expire.

blink_interval

Blink interval of this object based on the internal "update tick". When zero, blinking is disabled. For other values, the object will be visible the given number of ticks and then invisible for the same duration. Objects with the same blink interval will blink synchronously. Blink interval of game alerts is 30.

For example, when the interval is 60, the object is visible for 60 ticks and hidden for the next 60.

forces

Forces for which this object is rendered or nil if visible to all forces. Writing nil or empty array will make object to be visible to all forces.

players

Players for which this object is visible or nil if visible to all players.

visible

If this object is rendered to anyone at all.

draw_on_ground

If this object is being drawn on the ground, under most entities and sprites.

In render_mode == "chart", this value is unused.

only_in_alt_mode

If this object is only rendered in alt-mode.

render_mode

Whether the object is rendered in game world or on the chart (map view).

When it is changed, the object is pushed to front of its new group.

use_target_orientation

If this object uses the target orientation.

color

Color or tint of the object.

width

Width of the object. Value is in pixels (32 per tile).

from

Where this line is drawn from.

to

Where this line is drawn to.

dash_length

Dash length of this line.

gap_length

Length of the gaps in this line.

dash_offset

Starting offset to apply to dashes of this line. Cannot be greater than dash_length + gap_length.

target

Where this object is drawn.

Polygon vertices that are set to an entity will ignore this.

orientation

Orientation of this object.

Polygon vertices that are set to an entity will ignore this.

scale

Scale of the text or light.

text

Text that is displayed by this text object.

font

Font of this text.

alignment

Alignment of this text.

vertical_alignment

Vertical alignment of this text.

scale_with_zoom

If this text scales with player zoom.

use_rich_text

If this text parses rich text tags.

filled

If this circle or rectangle is filled.

radius

Radius of this circle.

left_top

Where top left corner of this rectangle is drawn.

right_bottom

Where bottom right corner of this rectangle is drawn.

max_radius

Radius of the outer edge of this arc.

min_radius

Radius of the inner edge of this arc.

start_angle

Where this arc starts. Angle in radian.

angle

Angle of this arc. Angle in radian.

vertices

Vertices of this polygon.

sprite

Sprite of the sprite or light.

x_scale

Horizontal scale of this sprite or animation.

y_scale

Vertical scale of this sprite or animation.

render_layer

Render layer of this sprite or animation.

orientation_target

Target to which this object rotates so that it faces the target. Note that orientation is still applied to the object. Writing nil will clear the orientation_target. nil if no target.

Polygon vertices that are set to an entity will ignore this.

oriented_offset

Offsets the center of the sprite or animation if orientation_target is given. This offset will rotate together with the sprite or animation.

intensity

Intensity of this light.

minimum_darkness

Minimum darkness at which this light is rendered.

oriented

If this light is rendered with the same orientation as the target entity. Note that orientation is still applied to the sprite.

animation

Animation prototype name of this animation.

animation_speed

Animation speed of this animation. Animation speed in frames per tick.

animation_offset

Animation offset of this animation. Animation offset in frames.

valid

Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.

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

destroy

LuaRenderObject.destroy()

Call As

renderObject.destroy()

Call Convention

Destroys this object. Does not error when the object is invalid.

bring_to_front

LuaRenderObject.bring_to_front()

Call As

renderObject.bring_to_front()

Call Convention

Reorder this object so that it is drawn in front of the already existing objects.

move_to_back

LuaRenderObject.move_to_back()

Call As

renderObject.move_to_back()

Call Convention

Reorder this object so that it is drawn in the back of the already existing objects.

set_dashes

LuaRenderObject.set_dashes(dash_length: double, gap_length: double)

Call As

renderObject.set_dashes(dash_length, gap_length)

Call Convention

Set the length of the dashes and the length of the gaps in this line.

Parameters

set_corners

LuaRenderObject.set_corners(left_top: ScriptRenderTarget, right_bottom: ScriptRenderTarget)

Call As

renderObject.set_corners(left_top, right_bottom)

Call Convention

Set the corners of the rectangle with this id.

Parameters