OpenMiner/docs/lua-api-gui-progress-bar.md

1.6 KiB

Lua API: Progress bar

Example

gui:progress_bar {
	name = "bar_process",
	pos = {x = 80, y = 35},

	type = "item_process",

	block = {x = pos.x, y = pos.y, z = pos.z},

	meta = "item_progress",
	max_value = 200,

	texture = mod:path() .. "/textures/gui/furnace.png",
	clip = {x = 176, y = 14, width = 24, height = 17},
}

Attributes

block

Specify the block to use for metadata.

block = {
	x = 0,
	y = 0,
	z = 0
}

clip

Clip rect of the texture.

Example:

clip = {
	x = 0,
	y = 0,
	width = 176,
	height = 166
}

max_meta

Name of the metadata value storing the max value of the bar in the block.

Example:

max_meta = "current_burn_time"

max_value

Max value of the progress bar. Used with type = "item_process".

Example:

max_value = 200,

meta

Name of the metadata value storing the progress of the bar in the block.

Example:

meta = "ticks_remaining"

name

Name of the widget. Mandatory field.

Example:

name = "bar_burn"

pos

Position of the widget. Mandatory field.

Example:

pos = {
	x = 0,
	y = 0
}

texture

Full path of the texture. Relative to the repo root.

Example:

texture = mod:path() .. "/textures/gui/furnace.png"

See this page for more details about mod:path().

type

Type of the progress bar.

Example:

type = "item_process"

Possible values:

  • item_process: Goes from left to right depending on meta and max_value.
  • burn_process: Goes from down to up depending on meta and max_meta.