Module Wube

Documents some of factorios built-in data-stage functions.

Module Status: Work in progress.

Usage:

    local Wube = require('__eradicators-library__/erlib/factorio/Wube')()
    

Circuit

default_circuit_wire_max_distance (number).
universal_connector_template (table).
circuit_connector_definitions (table).
circuit_connector_definitions.create(connector_template, definitions) (function).
make_universal_circuit_connectors(definitions) (function).

Pixel

Util.by_pixel(x, y) Converts pixels to tiles (32 pixels per tile).
Util.by_pixel_hr(x, y) Converts pixels to tiles (64 pixels per tile).


Circuit

default_circuit_wire_max_distance
(number).
universal_connector_template
(table).
The template graphics are in:
base/graphics/entity/circuit-connector/hr-ccm-universal-04a-base-sequence.png
circuit_connector_definitions
(table). Contains the sprites and points generated by base factorio in:
core/lualib/circuit-connector-generated-definitions.lua
circuit_connector_definitions.create(connector_template, definitions)
(function).

Parameters:

Returns:

    table A table with two subtables:
    sprites (table) Prototype/Entity.circuit_connector_sprites
    points (table) Prototype/Entity.circuit_wire_connection_point
make_universal_circuit_connectors(definitions)
(function). Erlib Syntactic Sugar.
Calls circuit_connector_definitions.create using the Wube.universal_connector_template, and unpacks the results.

Variation number is based on the sequence in the template graphics file. Starting at 1 in the upper left corner and incrementing left-to-right, top-to-bottom.

Parameters:

Returns:

  1. table Prototype/Entity.circuit_connector_sprites
  2. table Prototype/Entity.circuit_wire_connection_point

Usage:

    local sprites, points = Wube.make_universal_circuit_connectors{{
      variation     = 26,
      main_offset   = Wube.Util.by_pixel(7, 15.5),
      shadow_offset = Wube.Util.by_pixel(7, 15.5),
      show_shadow   = false,
      }}
    
    local my_prototype = {}
    my_prototype.circuit_connector_sprites     = sprites
    my_prototype.circuit_wire_connection_point = points
    

Pixel

Util.by_pixel(x, y)
Converts pixels to tiles (32 pixels per tile).

Parameters:

Returns:

    table {x,y} in tiles
Util.by_pixel_hr(x, y)
Converts pixels to tiles (64 pixels per tile).

Parameters:

Returns:

    table {x,y} in tiles
generated by LDoc 1.4.6 Last updated 2021-09-10 19:51:19