Kryzeth Standard Library

StdLib.Data.Technology

supers: StdLib.Data

Wrapper for Factorio technology prototypes.

Methods17

function Technology.__call(tech: string) -> technology StdLib.Data.Technology

Looks up and wraps a technology by name.

Parameters
techstring

Technology prototype name

Returns
function Technology.add_effect(effect: table | boolean | string | number, effect_type: nil | string) -> self

Adds an effect to a technology.

Parameters
effecttable | boolean | string | number

Effect target, modifier value, or complete effect definition

effect_typenil | string

Technology effect type; defaults to "unlock-recipe"

Returns
self
function Technology.remove_effect(tech_name: nil | string, unlock_type: nil | string, name: nil | string) -> (self, name nil | string, unlock_type nil | string)

Removes an effect from a technology or removes a recipe unlock.

Parameters
tech_namenil | string

Technology prototype name

unlock_typenil | string

Technology effect type

namenil | string

Effect target name

Returns
self
namenil | string
unlock_typenil | string
function Technology.has_pack(pack: string) -> (has_pack boolean, index nil | integer)

Checks whether this technology contains a science pack.

Parameters
packstring

Science-pack item name

Returns
has_packboolean
indexnil | integer
function Technology.add_pack(new_pack: table | string, count: nil | number) -> self

Adds a science pack to this technology's research ingredients.

Parameters
new_packtable | string

Science-pack name or {name, count} pair

countnil | number

Ingredient count; defaults to 1

Returns
self
function Technology.remove_pack(pack: string) -> self

Removes a science pack from this technology's research ingredients.

Parameters
packstring

Science-pack item name

Returns
self
function Technology.replace_pack(old_pack: string, new_pack: string, count: nil | number) -> self

Replaces a science pack in this technology's research ingredients.

Parameters
old_packstring

Existing science-pack item name

new_packstring

Replacement science-pack item name

countnil | number

Replacement ingredient count

Returns
self
function Technology.set_pack_count(pack: string, count: number) -> self

Sets the amount of an existing science pack.

Parameters
packstring

Science-pack item name

countnumber

New ingredient count

Returns
self
function Technology.set_pack_amount(pack: string, count: number) -> self
Parameters
packstring

Science-pack item name

countnumber

New ingredient count

Returns
self
function Technology.add_prereq(tech_name: string) -> self

Adds a prerequisite technology.

Parameters
tech_namestring

Prerequisite technology name

Returns
self
function Technology.remove_prereq(tech_name: string) -> self

Removes a prerequisite technology.

Parameters
tech_namestring

Prerequisite technology name

Returns
self
function Technology.replace_prereq(old_tech: string, new_tech: string) -> self

Replaces one prerequisite technology with another.

Parameters
old_techstring

Existing prerequisite technology name

new_techstring

Replacement prerequisite technology name

Returns
self
function Technology.copy_cost(tech_name: string) -> result self | false

Copies research-unit properties from another technology.

Parameters
tech_namestring

Source technology name

Returns
resultself | false
function Technology.multiply_cost(mult: number) -> result self | false

Multiplies this technology's research-unit count.

Parameters
multnumber

Cost multiplier

Returns
resultself | false
function Technology.add_unlock(recipe: string) -> nil

Adds a recipe-unlock effect to this technology.

Parameters
recipestring

Recipe prototype name

Returns
nil
function Technology.get_recipes() -> recipes {string, true} | nil

Returns the recipes unlocked by this technology.

function Technology.remove_unlock(recipe: string) -> nil

Removes a recipe-unlock effect from this technology.

Parameters
recipestring

Recipe prototype name

Returns
nil

Fields5

Technology.effects : table[] | nil

Technology effects

Technology.prerequisites : string[] | nil

Prerequisite technology names

Technology.unit : nil | table

Technology research-unit properties

Technology.__class: string = "Technology"
Technology.__index : unknown