This file documents the functions within the technic modpack for use in mods.
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"
e.g. grindertechnic.producer = "PR"
e.g. solar paneltechnic.producer_receiver = "PR_RE"
supply convertertechnic.battery = "BA"
e.g. LV battery boxAvailable functions:
technic.register_machine(tier, nodename, machine_type)
tier
: see register_tier
nodename
: string, node namemachine_type
: string, following options are possible:
"RE"
: Receiver"PR"
: Producer"BA"
: Battery, energy storageMachine types
Functions to use for callbacks:
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_solar_array(data)
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:
wear_represents = "string"
"mechanical_wear"
: represents physical damage"technic_RE_charge"
: represents electrical charge<itemdef>.technic_run(pos, node)
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.
The station collects power from sources (PR), distributes it to sinks (RE),
and uses the excess/shortfall to charge and discharge batteries (BA).
For now, all supply and demand values are expressed in kW.
It works like this:
All PR,BA,RE nodes are indexed and tagged with the switching station.
The tagging is a workaround to allow more stations to be built without allowing
a cheat with duplicating power.
All the RE nodes are queried for their current EU demand. Those which are off
would require no or a small standby EU demand, while those which are on would
require more.
If the total demand is less than the available power they are all updated with
the demand number.
If any surplus exists from the PR nodes the batteries will be charged evenly
with this.
If the total demand requires draw on the batteries they will be discharged
evenly.
If the total demand is more than the available power all RE nodes will be shut
down. We have a brown-out situation.
Hence for now all the power distribution logic resides in this single node.
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