This file is fairly incomplete. Read the code if this is not enough. Help is welcome.
The tier is a string, currently "LV", "MV" and "HV" are included with technic.
The network is the cable with the connected machine nodes. The switching station activates network.
technic.EU_string(num)- Converts num to a human-readable string (see pretty_num)
and adds the
EUunit - Use this function when showing players energy values
- Converts num to a human-readable string (see pretty_num)
and adds the
technic.pretty_num(num)- Converts the number
numto a human-readable string with SI prefixes
- Converts the number
technic.swap_node(pos, nodename)- Same as
mintest.swap_nodebut it only changes the nodename. - It uses
minetest.get_nodebefore swapping to ensure the new nodename is not the same as the current one.
- Same as
technic.get_or_load_node(pos)- If the mapblock is loaded, it returns the node at pos,
else it loads the chunk and returns
nil.
- If the mapblock is loaded, it returns the node at pos,
else it loads the chunk and returns
technic.is_tier_cable(nodename, tier)- Tells whether the node
nodenameis the cable of the tiertier.
- Tells whether the node
technic.get_cable_tier(nodename)- Returns the tier of the cable
nodenameornil.
- Returns the tier of the cable
technic.register_cable_tier(nodename, tier)- Register user defined cable to list of known tier cables.
nodename: string, name of the nodetier: string, tier name
technic.trace_node_ray(pos, dir, range)- Returns an iteration function (usable in the for loop) to iterate over the node positions along the specified ray.
- The returned positions will not include the starting position
pos.
technic.trace_node_ray_fat(pos, dir, range)- Like
technic.trace_node_raybut includes extra positions near the ray. - The node ray functions are used for mining lasers.
- Like
technic.tube_inject_item(pos, start_pos, velocity, item)- Same as
pipeworks.tube_inject_item
- Same as
technic.configSettings object that contains Technic configuration.- Provides all methods that are provided by Minetest Settings object.
- Uses
<world-path>/technic.confas configuration file. - If key is not present in configuration then returns default value for that key.
:get_int(key)Return number value for configuration key.
technic.register_power_tool(itemname, definition)- Registers power tool adding required fields, otherwise same as
minetest.register_tool(itemname, definition). - For regular power tools you only want to change
max_chargeand leave other fields unset (defaults). - Special fields for
definition:technic_max_chargeNumber, maximum charge for tool. Defaults to10000which is same as RE battery.on_refillFunction to refill charge completely. Default is to set maximum charge for tool.wear_representsCustomize wear indicator instead of using charge level. Default is"technic_RE_charge".tool_capabilitiesSee Minetest documentation. Default is{ punch_attack_uses = 0 }.technic_get_charge = function(itemstack) ...:- Callback will be used to get itemstack charge and max_charge.
- Have to return values
charge, max_charge. - E.g.
local charge, maxcharge = itemdef.technic_get_charge(itemstack). - Defaults to
technic.get_chargewhich handles tool wear and charge values.
technic_set_charge = function(itemstack, charge) ...:- Callback will be used to set itemstack charge.
- Defaults to
technic.set_chargewhich handles tool wear and charge values.
- Registers power tool adding required fields, otherwise same as
technic.get_charge(itemstack)- Returns current charge level of tool.
- For tool charger mods it is recommended to use
<tooldef>.technic_get_charge(stack)instead.
technic.set_charge(itemstack, charge)- Sets tool charge level.
- For tool charger mods it is recommended to use
<tooldef>.technic_set_charge(stack, charge)instead.
technic.use_charge(itemstack, charge)- Attempt to use charge and return
true/falseindicating success. - Always succeeds without checking charge level if creative is enabled.
- Attempt to use charge and return
technic.register_machine(tier, nodename, machine_type)- Custom machine registration. Not needed when using builtin machine registration functions.
- See also
Machine types
technic.register_tier(tier)- Registers network tier.
- See also
tiers
technic.register_base_machine(nodename, def)- Register various types of basic factory processing machines.
typename = "compressing"description = S("%s Compressor")tier = "HV"demand = {1500, 1000, 750}speed = 5upgrade = 1tube = 1- TODO / TBD
technic.register_solar_array(nodename, def)- Registers solar array generator.
tier = "HV"power = 100- TODO / TBD
technic.register_battery_box(nodename, def)- Registers battery box node used as energy storage.
- TODO / TBD
technic.register_cable(nodename, data)- Registers technic network cables.
tier = "HV"size = 3/16description = S("%s Digiline Cable"):format("HV")digiline = { wire = { rules = technic.digilines.rules_allfaces } }
technic.register_cable_plate(nodename, data)- Registers technic network cable plates. Results in multiple nodes registered with
_1to_6appended to name. - See
technic.register_cable(nodename, data)
- Registers technic network cable plates. Results in multiple nodes registered with
- TBD, functions exported through technic namespace are currently considered to be internal use only.
technic.can_insert_unique_stack(pos, node, stack, direction)technic.insert_object_unique_stack(pos, node, stack, direction)- Functions for the parameters
can_insertandinsert_objectto avoid filling multiple inventory slots with same type of item.
- Functions for the parameters
- groups:
technic_<ltier> = 1ltier is a tier in small letters; this group makes the node connect to the cable(s) of the right tier.technic_machine = 1Currently used for
connect_sides- In addition to the default use (see lua_api.txt), this tells where the machine can be connected.
technic_run(pos, node)- This function is currently used to update the node.
wear_represents = "string"- Specifies how the tool wear level is handled. Available modes:
"mechanical_wear": represents physical damage"technic_RE_charge": represents electrical charge
- Specifies how the tool wear level is handled. Available modes:
<itemdef>.technic_run = function(pos, node) ...- This callback is used to update the node.
<itemdef>.technic_disabled_machine_name = "string"- Specifies the machine's node name to use when it's not connected connected to a network
<itemdef>.technic_on_disable = function(pos, node) ...- This callback is run when the machine is no longer connected to a technic-powered network.
There are currently following types:
technic.receiver = "RE"e.g. grindertechnic.producer = "PR"e.g. solar paneltechnic.producer_receiver = "PR_RE"supply convertertechnic.battery = "BA"e.g. LV batbox
The switching station is required to start electric network and keep it running. Unlike in original mod this node does not handle power distribution logic but instead just resets network timeout. The polyfuse system is activated when there is too much lag, which causes network to skip cycles (it works slower). It is shown in the infotext when activated.
The network logic 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.
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 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 excess power. If total demand exceeds generator supply then draw difference from batteries. If total demand is more than available power all RE nodes will be shut down.
You can only have one network per machine, else the switching station will indicate you that several networks are trying to access the machine.
Nodes connected to the network will have one or more of these parameters as meta data:
<LV|MV|HV>_EU_supply: Exists for PR and BA node types. This is the EU value supplied by the node. Output<LV|MV|HV>_EU_demand: Exists for RE and BA node types. This is the EU value the node requires to run. Output<LV|MV|HV>_EU_input: Exists for RE and BA node types. This is the actual EU value the network can give the node. Input
The reason the LV|MV|HV type is prepended to meta data is because some machine could require several supplies to work. This way the supplies are separated per network.