This file documents the functions within the technic modpack for use in mods.
Undocumented API may change at any time.
Tier are network types. List of pre-registered tiers:
"LV"
, Low Voltage"MV"
, Medium Voltage"HV"
, High VoltageAvailable functions:
technic.register_tier(tier, description)
tier
: string, short name (ex. LV
)description
: string, long name (ex. Low Voltage
)tiers
technic.register_cable(tier, size)
tier
: stringsize
: number, visual size of the wiretechnic.get_cable_tier(nodename)
nodename
: string, name of the nodenil
technic.is_tier_cable(nodename, tier)
nodename
is the cable of the tier tier
.technic.get_cable_tier(nodename) == tier
The machine type indicates the direction of power flow.
List of pre-registered machine types:
technic.receiver = "RE"
: consumes energy. e.g. grindertechnic.producer = "PR"
: provides energy. e.g. solar paneltechnic.producer_receiver = "PR_RE"
supply convertertechnic.battery = "BA"
: stores energy. e.g. LV battery boxAvailable functions:
technic.register_base_machine(data)
data
fields:tier
: string, see #Tierstypename
: string, equivalent to the processing type registeredtechnic.register_recipe
. Examples: "cooking"
"alloy"
machine_name
: string, node namemachine_desc
: string, node descriptiondemand
: table, EU consumption values for each upgrade level.{3000, 2000, 1000}
.upgrade
: (boolean), whether to add upgrade slotsmodname
: (string), mod origintube
: (boolean), whether the machine has Pipeworks connectivitycan_insert
: (func), see Pipeworks documentation
tube = 1
technic.can_insert_unique_stack
insert_object
: (func), see Pipeworks documentation
tube = 1
technic.insert_object_unique_stack
connect_sides
: (table), see Lua API documentation. Defaults to all directions but front.technic.register_machine(tier, nodename, machine_type)
tier
: string, see #Tiersnodename
: string, node namemachine_type
: string, following options are possible:
technic.receiver = "RE"
: Consumes energytechnic.producer = "PR"
: Provides energytechnic.battery = "BA"
: Energy storageMachine types
Callbacks for pipeworks item transfer:
technic.can_insert_unique_stack(pos, node, stack, direction)
technic.insert_object_unique_stack(pos, node, stack, direction)
can_insert
and insert_object
to avoidtechnic.register_recipe_type(typename, recipedef)
typename
: string, name of the recipe typerecipedef
:
description
: string, descriptor of the recipe typeinput_size
: (numeric), count of input ItemStacks. default 1output_size
: (numeric), count of output ItemStacks. default 1technic.register_recipe(recipe)
recipe
:input
: table, integer-indexed list of input ItemStacks.output
: table/ItemStack, single output or list of output ItemStacks.time
: numeric, process time in seconds.technic.get_recipe(typename, items)
typename
: string, see technic.register_recipe_type
items
: table, integer-indexed list of input ItemStacks.recipe
table on success, nil
otherwiseThe following functions can be used to register recipes for
a specific machine type:
technic.register_separating_recipe(recipe)
technic.register_compressor_recipe(recipe)
minetest.register_recipe(recipe)
technic.register_extractor_recipe(recipe)
technic.register_freezer_recipe(recipe)
technic.register_grinder_recipe(recipe)
technic.register_power_tool(itemname, max_charge)
craftitem
: string, item or node namemax_charge
: number, maximal EU capacityUnsorted functions:
technic.EU_string(num)
pretty_num
)EU
unittechnic.pretty_num(num)
num
to a human-readable string with SI prefixestechnic.config:get(name)
technic.tube_inject_item(pos, start_pos, velocity, item)
pipeworks.tube_inject_item
technic.set_RE_wear(itemstack, item_load, max_charge)
itemstack
: ItemStack to modifyitem_load
: number, used energy in EUmax_charge
: number, maximal EU capacity of the toolwear_represents
must be set to "technic_RE_charge"
,technic.refill_RE_charge(itemstack)
technic.power_tools[itemstack:get_name()]
is nil
(or false
), thistechnic.get_or_load_node(pos)
nil
.technic.swap_node(pos, nodename)
mintest.swap_node
but it only changes the nodename.minetest.get_node
before swapping to ensure the new nodenametechnic.trace_node_ray(pos, dir, range)
pos
.technic.trace_node_ray_fat(pos, dir, range)
technic.trace_node_ray
but includes extra positions near the ray.Groups:
technic_<tier> = 1
<tier>
: name of the tier, in lowercase (ex. lv
)technic_machine = 1
connect_sides = {"top", "left", ...}
Additional definition fields:
<itemdef>.wear_represents = "string"
"mechanical_wear"
: represents physical damage"technic_RE_charge"
: represents electrical charge<itemdef>.technic_run = function(pos, node) ...
<itemdef>.technic_disabled_machine_name = "string"
<itemdef>.technic_on_disable = function(pos, node) ...
<itemdef>.technic_get_charge = function(itemstack) ...
itemstack
: ItemStack, the tool to analysecharge
: Electrical charge of the toolmax_charge
: Upper charge limitlocal charge, maxcharge = itemdef.technic_get_charge(itemstack)
<itemdef>.technic_set_charge = function(itemstack, charge) ...
itemstack
: ItemStack, the tool to updatecharge
: numeric, value between 0
and max_charge
Nodes connected to the network will have one or more of these parameters as meta
data:
<tier>_EU_supply
- direction: output
PR
or BA
tier<tier>_EU_demand
- direction: output
RE
or BA
tier<tier>_EU_input
- direction: input
RE
or BA
tier<tier>
corresponds to the tier name registered usingtechnic.register_tier
(ex. LV
). It is possible for the machine to depend on
multiple tiers (or networks).
The switching station is the center of all power distribution on an electric
network. This node is used to calculate the power supply of the network and
to distribute the power across nodes.
The switching station is the center of all electricity distribution. It collects
power from sources (PR), distributes it to sinks (RE), and uses the
excess/shortfall to charge and discharge batteries (BA).
As a thumb of rule, "EU" (energy unit) values are expressed in kW.
Network functionality:
Following functions are either no longer used by technic, or are planned to
be removed soon. Please update mods depending on technic accordingly.
technic.get_RE_item_load
technic.set_RE_item_load