@@ -80,10 +80,39 @@ Available functions:
8080 * `technic.producer = "PR"`: Provides energy
8181 * `technic.battery = "BA"`: Energy storage
8282 * See also `Machine types`
83+ * ` technic.handle_machine_upgrades(meta) `
84+ * Retrieves the count of `upgrade1` and `upgrade2` items.
85+ * Use the returned values to improve the capabilities of a machine.
86+ As a rule of thumb, each upgrade should result in a 10% improvement.
87+ * Return values:
88+ * `EU_upgrade`: integer, to improve power consumption or capacity
89+ * `tube_upgrade`: integer, to speed up pipeworks item actions
90+
91+ ### Inventory actions and lists
92+
93+ If a node is registered as a technic machine, the following node inventory
94+ lists have a defined purpose because stack movement functions depend on them.
95+
96+ * ` src ` : input slot of any size
97+ * ` dst ` : output slot of any size
98+ * ` upgrade1 ` : optional, 1x1 slot for machine upgrades
99+ * ` upgrade2 ` : optional, same as ` upgrade1 ` .
83100
84- Callbacks for pipeworks item transfer :
101+ These functions protect access to the aforementioned inventory lists :
85102
103+ * ` technic.machine_inventory_put(...) `
104+ * Helper for `<nodedef>.allow_metadata_inventory_put`
105+ * ` technic.machine_inventory_take(...) `
106+ * Helper for `<nodedef>.allow_metadata_inventory_take`
107+ * ` technic.machine_inventory_move(...) `
108+ * Helper for `<nodedef>.allow_metadata_inventory_move`
109+
110+ ### pipeworks helper functions
111+
112+ * ` technic.default_can_insert(pos, node, stack, direction) `
113+ * Returns boolean, whether the stack fits.
86114* ` technic.can_insert_unique_stack(pos, node, stack, direction) `
115+ * Is based on `technic.default_can_insert`
87116* ` technic.insert_object_unique_stack(pos, node, stack, direction) `
88117 * Functions for the parameters `can_insert` and `insert_object` to avoid
89118 filling multiple inventory slots with same type of item.
@@ -166,7 +195,7 @@ Unsorted functions:
166195* ` technic.set_charge(itemstack, charge) `
167196 * Modifies the charge of the given itemstack.
168197
169- ### Node-specific
198+ ### Node manipulation
170199* ` technic.get_or_load_node(pos) `
171200 * If the mapblock is loaded, it returns the node at pos,
172201 else it loads the chunk and returns `nil`.
@@ -192,7 +221,7 @@ Groups:
192221* ` technic_machine = 1 `
193222 * UNRELIABLE. Indicates whether the item or node belongs to technic
194223* ` connect_sides = {"top", "left", ...} `
195- * Extends the Minetest API. Indicates where the machine can be connected.
224+ * Extends the Luanti API. Indicates where the machine can be connected.
196225
197226Additional definition fields:
198227
@@ -240,6 +269,20 @@ data:
240269` technic.register_tier ` (ex. ` LV ` ). It is possible for the machine to depend on
241270multiple tiers (or networks).
242271
272+ Furthermore, the following fields are reserved for machines:
273+
274+ * ` public ` : integer, optional.
275+ * Controls the behaviour of the `technic.machine_inventory_*` helper functions.
276+ * `0` (default): Inventory lists are protected according to `core.is_protected`.
277+ * `1`: Inventory lists are accessible to everyone.
278+ Except for: `upgrade1`, `upgrade2`.
279+ * ` splitstacks ` : integer, optional.
280+ * Defines the behaviour of technic-specific insertion functions, commonly used
281+ for pipeworks compatibility.
282+ * ` 0 ` (default): entire stacks will be inserted.
283+ * ` 1 ` : Insert one item (i.e. stack size 1) at a time.
284+ * ` tube_time ` : internal counter for outgoing tube items.
285+
243286
244287## Manual: Network basics
245288
0 commit comments