data_util module

Misc functions for data stage prototype manipulation.

Usage

local data_util = require('__flib__.data_util')

Functions

copy_prototype(prototype, new_name[, remove_icon=false]) Copy a prototype, assign new name and minable properties.
create_icons(prototype, new_layers) Add new icon layers to a prototype icon or icons.
get_energy_value(energy_string) Convert an energy string to base unit value + suffix.
build_sprite([name][, position][, filename][, size][, mipmap_count][, mods]) Build a sprite.

Fields

empty_image An empty image.
black_image A black image, for use with tool backgrounds.
planner_base_image A desaturated planner image.

Functions

# copy_prototype(prototype, new_name[, remove_icon=false])

Copy a prototype, assign new name and minable properties.

Parameters: Returns:
# create_icons(prototype, new_layers)

Add new icon layers to a prototype icon or icons.

Parameters: Returns:
# get_energy_value(energy_string)

Convert an energy string to base unit value + suffix.

Parameters: Returns:
# build_sprite([name][, position][, filename][, size][, mipmap_count][, mods])

Build a sprite.

Parameters:
  • name : (string) (optional)
  • position : (Position) (optional)
  • filename : (string) (optional)
  • size : (Vector) (optional)
  • mipmap_count : (uint) (optional)
  • mods : (table) (optional)
Returns:

Fields

# empty_image

An empty image.

This image is 8x8 to facilitate usage with GUI styles.

# black_image

A black image, for use with tool backgrounds.

This image is 1x1.

# planner_base_image

A desaturated planner image.

Tint this sprite to easily add your own planners.