10 Commits

Author SHA1 Message Date
11e43ffe13 nuclear_reactor: Add error messages on start failure (#574) 2021-01-06 18:12:51 +01:00
d8fe9ad16c Merge new documentation with technic/doc 2020-09-19 14:14:31 +02:00
c06a56daff Denser documentation. 'Slay The Dragon' Part 2 2020-09-16 18:56:10 +02:00
cd5a3ee1ef Denser documentation. 'Slay The Dragon' Part 1 2020-09-15 19:55:16 +02:00
a5b36b041e Prevent protection check on MV machine close (#569) 2020-09-12 10:27:31 +02:00
b9f89a0e39 Add ethereal support to chainsaw (#570) 2020-09-11 19:19:12 +02:00
03bb4dab46 Protect self-contained injector formspec buttons (#568)
Fixes #536.
2020-09-11 19:15:51 +02:00
d7336670f2 Constructor: Add protection check (#564)
Check if the player who placed constructor can access protected positions before placing or removing nodes.
2020-09-09 18:44:12 +02:00
3c85abb3b2 Restore recipe for bronze block to ingots (#566) 2020-09-07 17:41:34 +02:00
11f2b4f4b3 Fix warning reported by LuaCheck (#563) 2020-09-05 18:54:37 +02:00
9 changed files with 393 additions and 306 deletions

View File

@ -1,26 +1,54 @@
Technic # Technic
=======
[![Build status](https://github.com/minetest-mods/technic/workflows/Check%20&%20Release/badge.svg)](https://github.com/minetest-mods/technic/actions) [![Build status](https://github.com/minetest-mods/technic/workflows/Check%20&%20Release/badge.svg)](https://github.com/minetest-mods/technic/actions)
[![License](https://img.shields.io/badge/license-LGPLv2.0%2B-purple.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.en.html) [![License](https://img.shields.io/badge/license-LGPLv2.0%2B-purple.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.en.html)
Credits for contributing to the project (in alphabetical order): This Minetest modpack adds machinery and automation procedure content to your
world. A few notable features:
* Electric circuits
* Automated material processing (ores, wood, ...)
* Extended chest functionalities
## Dependencies
* Minetest 5.0.0 or newer
* [Minetest Game](https://github.com/minetest/minetest_game/)
* [mesecons](https://github.com/minetest-mods/mesecons) -> signalling events
* [pipeworks](https://gitlab.com/VanessaE/pipeworks/) -> automation of item transport
* [moreores](https://github.com/minetest-mods/moreores/) -> additional ores
* [basic_materials](https://gitlab.com/VanessaE/basic_materials) -> basic craft items
* Supports [moretrees](https://gitlab.com/VanessaE/moretrees) -> rubber trees
* Consult `depends.txt` or `mod.conf` of each mod for further dependency information.
## FAQ
The modpack is explained in the [Manual](manual.md) included in this repository.
1. My technic circuit doesn't work. No power is distributed.
* Make sure you have a switching station connected.
2. My wires do not connect to the machines.
* Each machine type requires its own cable type. If you do not have a
matching circuit, consider using a "Supply Converter" for simplicity.
The API documentation can be found here: [Technic API](technic/doc/api.md)
## License
Unless otherwise stated, all components of this modpack are licensed under the
LGPLv2 or later. See also the individual mod folders for their
secondary/alternate licenses, if any.
### Credits
Contributors in alphabetical order:
* kpoppel * kpoppel
* Nekogloop * Nekogloop
* Nore/Ekdohibs * Nore/Ekdohibs
* ShadowNinja * ShadowNinja
* VanessaE * VanessaE
* And many others... * And many others...
FAQ
---
1. My technic circuit doesn't work. No power is distrubuted.
* A: Make sure you have a switching station connected.
License
-------
Unless otherwise stated, all components of this modpack are licensed under the
LGPL, V2 or later. See also the individual mod folders for their
secondary/alternate licenses, if any.

321
manual.md
View File

@ -1,22 +1,10 @@
Minetest technic modpack user manual # Technic User Manual
====================================
The technic modpack extends the Minetest game with many new elements, The technic modpack extends Minetest Game (shipped with Minetest by default)
mainly constructable machines and tools. It is a large modpack, and with many new elements, mainly constructable machines and tools. This manual
tends to dominate gameplay when it is used. This manual describes how describes how to use the modpack, mainly from a player's perspective.
to use the technic modpack, mainly from a player's perspective.
The technic modpack depends on some other modpacks: Documentation of the mod dependencies can be found here:
* the basic Minetest game
* mesecons, which supports the construction of logic systems based on
signalling elements
* pipeworks, which supports the automation of item transport
* moreores, which provides some additional ore types
* basic_materials, which provides some basic craft items
This manual doesn't explain how to use these other modpacks, which have
their own manuals:
* [Minetest Game Documentation](https://wiki.minetest.net/Main_Page) * [Minetest Game Documentation](https://wiki.minetest.net/Main_Page)
* [Mesecons Documentation](http://mesecons.net/items.html) * [Mesecons Documentation](http://mesecons.net/items.html)
@ -24,226 +12,175 @@ their own manuals:
* [Moreores Forum Post](https://forum.minetest.net/viewtopic.php?t=549) * [Moreores Forum Post](https://forum.minetest.net/viewtopic.php?t=549)
* [Basic materials Repository](https://gitlab.com/VanessaE/basic_materials) * [Basic materials Repository](https://gitlab.com/VanessaE/basic_materials)
Recipes for constructable items in technic are generally not guessable, ## Recipes
and are also not specifically documented here. You should use a
craft guide mod to look up the recipes in-game. For the best possible
guidance, use the unified\_inventory mod, with which technic registers
its specialised recipe types.
substances Recipes for items registered by technic are not specifically documented here.
---------- Please consult a craft guide mod to look up the recipes in-game.
### ore ### **Recommended mod:** [Unified Inventory](https://github.com/minetest-mods/unified_inventory)
The technic mod makes extensive use of not just the default ores but also ## Substances
some that are added by mods. You will need to mine for all the ore types
in the course of the game. Each ore type is found at a specific range of
elevations, and while the ranges mostly overlap, some have non-overlapping
ranges, so you will ultimately need to mine at more than one elevation
to find all the ores. Also, because one of the best elevations to mine
at is very deep, you will be unable to mine there early in the game.
Elevation is measured in meters, relative to a reference plane that ### Ores
is not quite sea level. (The standard sea level is at an elevation
of about +1.4.) Positive elevations are above the reference plane and
negative elevations below. Because elevations are always described this
way round, greater numbers when higher, we avoid the word "depth".
The ores that matter in technic are coal, iron, copper, tin, zinc, Technic registers a few ores which are needed to craft machines or items.
chromium, uranium, silver, gold, mithril, mese, and diamond. Each ore type is found at a specific range of elevations so you will
ultimately need to mine at more than one elevation to find all the ores.
Coal is part of the basic Minetest game. It is found from elevation Elevation (Y axis) is measured in meters. The reference is usually at sea
+64 downwards, so is available right on the surface at the start of level. Ores can generally be found more commonly by going downwards to -1000m.
the game, but it is far less abundant above elevation 0 than below.
It is initially used as a fuel, driving important machines in the early
part of the game. It becomes less important as a fuel once most of your
machines are electrically powered, but burning fuel remains a way to
generate electrical power. Coal is also used, usually in dust form, as
an ingredient in alloying recipes, wherever elemental carbon is required.
Iron is part of the basic Minetest game. It is found from elevation Note ¹: *These ores are provided by Minetest Game. See [Ores](https://wiki.minetest.net/Ores#Ores_overview) for a rough overview*
+2 downwards, and its abundance increases in stages as one descends,
reaching its maximum from elevation -64 downwards. It is a common metal,
used frequently as a structural component. In technic, unlike the basic
game, iron is used in multiple forms, mainly alloys based on iron and
including carbon (coal).
Copper is part of the basic Minetest game (having migrated there from Note ²: *These ores are provided by moreores. TODO: Add reference link*
moreores). It is found from elevation -16 downwards, but is more abundant
from elevation -64 downwards. It is a common metal, used either on its #### Coal ¹
own for its electrical conductivity, or as the base component of alloys. Use: Fuel, alloy as carbon
Burning coal is a way to generate electrical power. Coal is also used,
usually in dust form, as an ingredient in alloying recipes, wherever
elemental carbon is required.
#### Iron ¹
Use: multiple, mainly for alloys with carbon (coal).
#### Copper ¹
Copper is a common metal, used either on its own for its electrical
conductivity, or as the base component of alloys.
Although common, it is very heavily used, and most of the time it will Although common, it is very heavily used, and most of the time it will
be the material that most limits your activity. be the material that most limits your activity.
Tin is part of the basic Minetest game (having migrated there from #### Tin ¹
moreores). It is found from elevation +8 downwards, with no Use: batteries, bronze
elevation-dependent variations in abundance beyond that point.
It is a common metal. Its main use in pure form is as a component
of electrical batteries. Apart from that its main purpose is
as the secondary ingredient in bronze (the base being copper), but bronze
is itself little used. Its abundance is well in excess of its usage,
so you will usually have a surplus of it.
Zinc is supplied by technic. It is found from elevation +2 downwards, Tin is a common metal but is used rarely. Its abundance is well in excess
with no elevation-dependent variations in abundance beyond that point. of its usage, so you will usually have a surplus of it.
It is a common metal. Its main use is as the secondary ingredient
in brass (the base being copper), but brass is itself little used.
Its abundance is well in excess of its usage, so you will usually have
a surplus of it.
Chromium is supplied by technic. It is found from elevation -100 #### Zinc
downwards, with no elevation-dependent variations in abundance beyond Use: brass
that point. It is a moderately common metal. Its main use is as the
secondary ingredient in stainless steel (the base being iron).
Uranium is supplied by technic. It is found only from elevation -80 down Depth: 2m, more commonly below -32m
to -300; using it therefore requires one to mine above elevation -300 even
though deeper mining is otherwise more productive. It is a moderately
common metal, useful only for reasons related to radioactivity: it forms
the fuel for nuclear reactors, and is also one of the best radiation
shielding materials available. It is not difficult to find enough uranium
ore to satisfy these uses. Beware that the ore is slightly radioactive:
it will slightly harm you if you stand as close as possible to it.
It is safe when more than a meter away or when mined.
Silver is supplied by the moreores mod. It is found from elevation -2 Zinc only has a few uses but is a common metal.
downwards, with no elevation-dependent variations in abundance beyond
that point. It is a semi-precious metal. It is little used, being most
notably used in electrical items due to its conductivity, being the best
conductor of all the pure elements.
Gold is part of the basic Minetest game (having migrated there from #### Chromium
moreores). It is found from elevation -64 downwards, but is more Use: stainless steel
abundant from elevation -256 downwards. It is a precious metal. It is
little used, being most notably used in electrical items due to its
combination of good conductivity (third best of all the pure elements)
and corrosion resistance.
Mithril is supplied by the moreores mod. It is found from elevation Depth: -100m, more commonly below -200m
-512 downwards, the deepest ceiling of any minable substance, with
no elevation-dependent variations in abundance beyond that point. #### Uranium
It is a rare precious metal, and unlike all the other metals described Use: nuclear reactor fuel
here it is entirely fictional, being derived from J. R. R. Tolkien's
Depth: -80m until -300m, more commonly between -100m and -200m
It is a moderately common metal, useful only for reasons related to radioactivity:
it forms the fuel for nuclear reactors, and is also one of the best radiation
shielding materials available.
Keep a safety distance of a meter to avoid being harmed by radiation.
#### Silver ²
Use: conductors
Depth: -2m, evenly common
Silver is a semi-precious metal and is the best conductor of all the pure elements.
#### Gold ¹
Use: various
Depth: -64m, more commonly below -256m
Gold is a precious metal. It is most notably used in electrical items due to
its combination of good conductivity and corrosion resistance.
#### Mithril ²
Use: chests
Depth: -512m, evenly common
Mithril is a fictional ore, being derived from J. R. R. Tolkien's
Middle-Earth setting. It is little used. Middle-Earth setting. It is little used.
Mese is part of the basic Minetest game. It is found from elevation #### Mese ¹
-64 downwards. The ore is more abundant from elevation -256 downwards, Use: various
and from elevation -1024 downwards there are also occasional blocks of
solid mese (each yielding as much mese as nine blocks of ore). It is a
precious gemstone, and unlike diamond it is entirely fictional. It is
used in many recipes, though mainly not in large quantities, wherever
some magical quality needs to be imparted.
Diamond is part of the basic Minetest game (having migrated there from Mese is a precious gemstone, and unlike diamond it is entirely fictional.
technic). It is found from elevation -128 downwards, but is more abundant It is used in small quantities, wherever some magic needs to be imparted.
from elevation -256 downwards. It is a precious gemstone. It is used
moderately, mainly for reasons connected to its extreme hardness.
### rock ### #### Diamond ¹
Use: mainly for cutting machines
In addition to the ores, there are multiple kinds of rock that need to be Diamond is a precious gemstone. It is used moderately, mainly for reasons
mined in their own right, rather than for minerals. The rock types that connected to its extreme hardness.
matter in technic are standard stone, desert stone, marble, and granite.
Standard stone is part of the basic Minetest game. It is extremely ### Rocks
common. As in the basic game, when dug it yields cobblestone, which can
be cooked to turn it back into standard stone. Cobblestone is used in
recipes only for some relatively primitive machines. Standard stone is
used in a couple of machine recipes. These rock types gain additional
significance with technic because the grinder can be used to turn them
into dirt and sand. This, especially when combined with an automated
cobblestone generator, can be an easier way to acquire sand than
collecting it where it occurs naturally.
Desert stone is part of the basic Minetest game. It is found specifically This section describes the rock types added by technic. Further rock types
in desert biomes, and only from elevation +2 upwards. Although it is are supported by technic machines. These can be processed using the grinder:
easily accessible, therefore, its quantity is ultimately quite limited.
It is used in a few recipes.
Marble is supplied by technic. It is found in dense clusters from * Stone (plain)
elevation -50 downwards. It has mainly decorative use, but also appears * Cobblestone
in one machine recipe. * Desert Stone
Granite is supplied by technic. It is found in dense clusters from #### Marble
elevation -150 downwards. It is much harder to dig than standard stone, Depth: -50m, evenly common
so impedes mining when it is encountered. It has mainly decorative use,
but also appears in a couple of machine recipes.
### rubber ### Marble is found in dense clusters and has mainly decorative use, but also
appears in one machine recipe.
#### Granite
Depth: -150m, evenly common
Granite is found in dense clusters and is much harder to dig than standard
stone. It has mainly decorative use, but also appears in a couple of
machine recipes.
### Rubber
Rubber is a biologically-derived material that has industrial uses due Rubber is a biologically-derived material that has industrial uses due
to its electrical resistivity and its impermeability. In technic, it to its electrical resistivity and its impermeability. In technic, it
is used in a few recipes, and it must be acquired by tapping rubber trees. is used in a few recipes, and it must be acquired by tapping rubber trees.
If you have the moretrees mod installed, the rubber trees you need Rubber trees are provided by technic if the moretrees mod is not present.
are those defined by that mod. If not, technic supplies a copy of the
moretrees rubber tree.
Extracting rubber requires a specific tool, a tree tap. Using the tree Extract raw latex from rubber using the "Tree Tap" tool. Punch/left-click the
tap (by left-clicking) on a rubber tree trunk block extracts a lump of tool on a rubber tree trunk to extract a lump of raw latex from the trunk.
raw latex from the trunk. Each trunk block can be repeatedly tapped for Emptied trunks will regenerate at intervals of several minutes, which can be
latex, at intervals of several minutes; its appearance changes to show observed by its appearance.
whether it is currently ripe for tapping. Each tree has several trunk
blocks, so several latex lumps can be extracted from a tree in one visit.
Raw latex isn't used directly. It must be vulcanized to produce finished To obtain rubber from latex, alloy latex with coal dust.
rubber. This can be performed by alloying the latex with coal dust.
### metal ### ### Metals
Generally, each metal can exist in five forms:
Many of the substances important in technic are metals, and there is * ore -> stone containing the lump
a common pattern in how metals are handled. Generally, each metal can * lump -> draw metal obtained by digging ("nuggets")
exist in five forms: ore, lump, dust, ingot, and block. With a couple of * dust -> grinder output
tricky exceptions in mods outside technic, metals are only *used* in dust, * ingot -> melted/cooked lump or dust
ingot, and block forms. Metals can be readily converted between these * block -> placeable node
three forms, but can't be converted from them back to ore or lump forms.
As in the basic Minetest game, a "lump" of metal is acquired directly by Metals can be converted between dust, ingot and block, but can't be converted
digging ore, and will then be processed into some other form for use. from them back to ore or lump forms.
A lump is thus more akin to ore than to refined metal. (In real life,
metal ore rarely yields lumps ("nuggets") of pure metal directly.
More often the desired metal is chemically bound into the rock as an
oxide or some other compound, and the ore must be chemically processed
to yield pure metal.)
Not all metals occur directly as ore. Generally, elemental metals (those #### Grinding
consisting of a single chemical element) occur as ore, and alloys (those Ores can be processed as follows:
consisting of a mixture of multiple elements) do not. In fact, if the
fictional mithril is taken to be elemental, this pattern is currently
followed perfectly. (It is not clear in the Middle-Earth setting whether
mithril is elemental or an alloy.) This might change in the future:
in real life some alloys do occur as ore, and some elemental metals
rarely occur naturally outside such alloys. Metals that do not occur
as ore also lack the "lump" form.
The basic Minetest game offers a single way to refine metals: cook a lump * ore -> lump (digging) -> ingot (melting)
in a furnace to produce an ingot. With technic this refinement method * ore -> lump (digging) -> 2x dust (grinding) -> 2x ingot (melting)
still exists, but is rarely used outside the early part of the game,
because technic offers a more efficient method once some machines have
been built. The grinder, available only in electrically-powered forms,
can grind a metal lump into two piles of metal dust. Each dust pile
can then be cooked into an ingot, yielding two ingots from one lump.
This doubling of material value means that you should only cook a lump
directly when you have no choice, mainly early in the game when you
haven't yet built a grinder.
An ingot can also be ground back to (one pile of) dust. Thus it is always At the expense of some energy consumption, the grinder can extract more material
possible to convert metal between ingot and dust forms, at the expense from the lump, resulting in 2x dust which can be melted to two ingots in total.
of some energy consumption. Nine ingots of a metal can be crafted into
a block, which can be used for building. The block can also be crafted
back to nine ingots. Thus it is possible to freely convert metal between
ingot and block forms, which is convenient to store the metal compactly.
Every metal has dust, ingot, and block forms.
#### Alloying
Alloying recipes in which a metal is the base ingredient, to produce a Alloying recipes in which a metal is the base ingredient, to produce a
metal alloy, always come in two forms, using the metal either as dust metal alloy, always come in two forms, using the metal either as dust
or as an ingot. If the secondary ingredient is also a metal, it must or as an ingot. If the secondary ingredient is also a metal, it must
be supplied in the same form as the base ingredient. The output alloy be supplied in the same form as the base ingredient. The output alloy
is also returned in the same form. For example, brass can be produced is also returned in the same form.
by alloying two copper ingots with one zinc ingot to make three brass
ingots, or by alloying two piles of copper dust with one pile of zinc Example: 2x copper ingots + zinc ingot -> 3x brass ingot (alloying)
dust to make three piles of brass dust. The two ways of alloying produce
equivalent results. The same will also work for dust ingredients, resulting in brass dist.
### iron and its alloys ### ### iron and its alloys ###

View File

@ -7,6 +7,13 @@ minetest.clear_craft({
type = "shapeless", type = "shapeless",
output = "default:bronze_ingot" output = "default:bronze_ingot"
}) })
-- Restore recipe for bronze block to ingots
minetest.register_craft({
output = "default:bronze_ingot 9",
recipe = {
{"default:bronzeblock"}
}
})
-- Accelerator tube -- Accelerator tube
if pipeworks.enable_accelerator_tube then if pipeworks.enable_accelerator_tube then

View File

@ -1,41 +1,115 @@
This file is fairly incomplete. Help is welcome. # technic API
Tiers This file documents the functions within the technic modpack for use in mods.
-----
The tier is a string, currently `"LV"`, `"MV"` and `"HV"` are supported.
Network
-------
The network is the cable with the connected machine nodes. Currently the
switching station handles the network activity.
Helper functions ## Tiers
---------------- Tier are network types. List of pre-registered tiers:
* `"LV"`, Low Voltage
* `"MV"`, Medium Voltage
* `"HV"`, High Voltage
Available functions:
* `technic.register_tier(tier, description)`
* Registers a network type (tier)
* `tier`: string, short name (ex. `LV`)
* `description`: string, long name (ex. `Low Voltage`)
* See also `tiers`
## Cables
* `technic.register_cable(tier, size)`
* Registers an existing node as cable
* `tier`: string
* `size`: number, visual size of the wire
* `technic.get_cable_tier(nodename)`
* Retrieves the tier assigned to the provided node name
* `nodename`: string, name of the node
* Returns the tier (string) or `nil`
* `technic.is_tier_cable(nodename, tier)`
* Tells whether the node `nodename` is the cable of the tier `tier`.
* Short version of `technic.get_cable_tier(nodename) == tier`
## Machines
The machine type indicates the direction of power flow.
List of pre-registered machine types:
* `technic.receiver = "RE"` e.g. grinder
* `technic.producer = "PR"` e.g. solar panel
* `technic.producer_receiver = "PR_RE"` supply converter
* `technic.battery = "BA"` e.g. LV battery box
Available functions:
* `technic.register_machine(tier, nodename, machine_type)`
* Register an existing node as machine, bound to the network tier
* `tier`: see `register_tier`
* `nodename`: string, node name
* `machine_type`: string, following options are possible:
* `"RE"`: Receiver
* `"PR"`: Producer
* `"BA"`: Battery, energy storage
* See also `Machine types`
Functions to use for callbacks:
* `technic.can_insert_unique_stack(pos, node, stack, direction)`
* `technic.insert_object_unique_stack(pos, node, stack, direction)`
* Functions for the parameters `can_insert` and `insert_object` to avoid
filling multiple inventory slots with same type of item.
### Specific machines
* `technic.register_solar_array(data)`
* data is a table (TODO)
## Tools
* `technic.register_power_tool(itemname, max_charge)`
* Register or configure the maximal charge held by an existing item
* `craftitem`: string, item or node name
* `max_charge`: number, maximal EU capacity
## Helper functions
Unsorted functions:
* `technic.EU_string(num)` * `technic.EU_string(num)`
* Converts num to a human-readable string (see pretty_num) * Converts num to a human-readable string (see `pretty_num`)
and adds the `EU` unit and adds the `EU` unit
* Use this function when showing players energy values * Use this function when showing players energy values
* `technic.pretty_num(num)` * `technic.pretty_num(num)`
* Converts the number `num` to a human-readable string with SI prefixes * Converts the number `num` to a human-readable string with SI prefixes
* `technic.swap_node(pos, nodename)` * `technic.config:get(name)`
* Same as `mintest.swap_node` but it only changes the nodename. * Some configuration function
* It uses `minetest.get_node` before swapping to ensure the new nodename * `technic.tube_inject_item(pos, start_pos, velocity, item)`
is not the same as the current one. * Same as `pipeworks.tube_inject_item`
* `technic.get_or_load_node(pos)`
* If the mapblock is loaded, it returns the node at pos, ### Energy modifiers
else it loads the chunk and returns `nil`.
* `technic.set_RE_wear(itemstack, item_load, max_charge)` * `technic.set_RE_wear(itemstack, item_load, max_charge)`
* If the `wear_represents` field in the item's nodedef is * Modifies the power tool wear of the given itemstack
`"technic_RE_charge"`, this function does nothing. * `itemstack`: ItemStack to modify
* `item_load`: number, used energy in EU
* `max_charge`: number, maximal EU capacity of the tool
* The itemdef field `wear_represents` must be set to `"technic_RE_charge"`,
otherwise this function will do nothing.
* Returns the modified itemstack
* `technic.refill_RE_charge(itemstack)` * `technic.refill_RE_charge(itemstack)`
* This function fully recharges an RE chargeable item. * This function fully recharges an RE chargeable item.
* If `technic.power_tools[itemstack:get_name()]` is `nil` (or `false`), this * If `technic.power_tools[itemstack:get_name()]` is `nil` (or `false`), this
function does nothing, else that value is the maximum charge. function does nothing, else that value is the maximum charge.
* The itemstack metadata is changed to contain the charge. * The itemstack metadata is changed to contain the charge.
* `technic.is_tier_cable(nodename, tier)`
* Tells whether the node `nodename` is the cable of the tier `tier`. ### Node-specific
* `technic.get_cable_tier(nodename)` * `technic.get_or_load_node(pos)`
* Returns the tier of the cable `nodename` or `nil`. * If the mapblock is loaded, it returns the node at pos,
else it loads the chunk and returns `nil`.
* `technic.swap_node(pos, nodename)`
* Same as `mintest.swap_node` but it only changes the nodename.
* It uses `minetest.get_node` before swapping to ensure the new nodename
is not the same as the current one.
* `technic.trace_node_ray(pos, dir, range)` * `technic.trace_node_ray(pos, dir, range)`
* Returns an iteration function (usable in the for loop) to iterate over the * Returns an iteration function (usable in the for loop) to iterate over the
node positions along the specified ray. node positions along the specified ray.
@ -43,58 +117,50 @@ Helper functions
* `technic.trace_node_ray_fat(pos, dir, range)` * `technic.trace_node_ray_fat(pos, dir, range)`
* Like `technic.trace_node_ray` but includes extra positions near the ray. * Like `technic.trace_node_ray` but includes extra positions near the ray.
* The node ray functions are used for mining lasers. * The node ray functions are used for mining lasers.
* `technic.config:get(name)`
* Some configuration function
* `technic.tube_inject_item(pos, start_pos, velocity, item)`
* Same as `pipeworks.tube_inject_item`
Registration functions
----------------------
* `technic.register_power_tool(itemname, max_charge)`
* Same as `technic.power_tools[itemname] = max_charge`
* This function makes the craftitem `itemname` chargeable.
* `technic.register_machine(tier, nodename, machine_type)`
* Same as `technic.machines[tier][nodename] = machine_type`
* Currently this is requisite to make technic recognize your node.
* See also `Machine types`
* `technic.register_tier(tier)`
* Same as `technic.machines[tier] = {}`
* See also `tiers`
### Specific machines ## Item Definition fields
* `technic.register_solar_array(data)` Groups:
* data is a table
* `technic.can_insert_unique_stack(pos, node, stack, direction)`
* `technic.insert_object_unique_stack(pos, node, stack, direction)`
* Functions for the parameters `can_insert` and `insert_object` to avoid
filling multiple inventory slots with same type of item.
Used itemdef fields * `technic_<tier> = 1`
------------------- * Makes the node connect to the cables of the matching tier name
* groups: * `<tier>`: name of the tier, in lowercase (ex. `lv`)
* `technic_<ltier> = 1` ltier is a tier in small letters; this group makes * `technic_machine = 1`
the node connect to the cable(s) of the right tier. * UNRELIABLE. Indicates whether the item or node belongs to technic
* `technic_machine = 1` Currently used for * `connect_sides = {"top", "left", ...}`
* `connect_sides` * Extends the Minetest API. Indicates where the machine can be connected.
* In addition to the default use (see lua_api.txt), this tells where the
machine can be connected. Additional definition fields:
#
# * `wear_represents = "string"`
* `technic_run(pos, node)` * Specifies how the tool wear level is handled. Available modes:
* `"mechanical_wear"`: represents physical damage
* `"technic_RE_charge"`: represents electrical charge
* `<itemdef>.technic_run(pos, node)`
* This function is currently used to update the node. * This function is currently used to update the node.
Modders have to manually change the information about supply etc. in the Modders have to manually change the information about supply etc. in the
node metadata. node metadata.
Machine types ## Node Metadata fields
------------- Nodes connected to the network will have one or more of these parameters as meta
There are currently following types: data:
* `technic.receiver = "RE"` e.g. grinder
* `technic.producer = "PR"` e.g. solar panel
* `technic.producer_receiver = "PR_RE"` supply converter
* `technic.battery = "BA"` e.g. LV batbox
Switching Station * `<tier>_EU_supply` - direction: output
----------------- * For nodes registered as `PR` or `BA` tier
* This is the EU value supplied by the node.
* `<tier>_EU_demand` - direction: output
* For nodes registered as `RE` or `BA` tier
* This is the EU value the node requires to run.
* `<tier>_EU_input` - direction: input
* For nodes registered as `RE` or `BA` tier
* This is the actual EU value the network can give the node.
`<tier>` corresponds to the tier name registered using
`technic.register_tier` (ex. `LV`). It is possible for the machine to depend on
multiple tiers (or networks).
## Switching Station mechanics
The switching station is the center of all power distribution on an electric The switching station is the center of all power distribution on an electric
network. network.
@ -122,16 +188,12 @@ down. We have a brown-out situation.
Hence for now all the power distribution logic resides in this single node. Hence for now all the power distribution logic resides in this single node.
### Node meta usage ## Deprecated functions
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 Following functions are either no longer used by technic, or are planned to
could require several supplies to work. be removed soon. Please update mods depending on technic accordingly.
This way the supplies are separated per network.
* `technic.get_RE_item_load`
* Scales the tool wear to a certain numeric range
* `technic.set_RE_item_load`
* Scales a certain numeric range to the tool wear

View File

@ -217,24 +217,33 @@ end
local function start_reactor(pos, meta) local function start_reactor(pos, meta)
local correct_fuel_count = 6
local msg_fuel_missing = "Error: You need to insert " .. correct_fuel_count .. " pieces of Uranium Fuel."
if minetest.get_node(pos).name ~= "technic:hv_nuclear_reactor_core" then if minetest.get_node(pos).name ~= "technic:hv_nuclear_reactor_core" then
return false return msg_fuel_missing
end end
local inv = meta:get_inventory() local inv = meta:get_inventory()
if inv:is_empty("src") then if inv:is_empty("src") then
return false return msg_fuel_missing
end end
local src_list = inv:get_list("src") local src_list = inv:get_list("src")
local correct_fuel_count = 0 local fuel_count = 0
for _, src_stack in pairs(src_list) do for _, src_stack in pairs(src_list) do
if src_stack and src_stack:get_name() == fuel_type then if src_stack and src_stack:get_name() == fuel_type then
correct_fuel_count = correct_fuel_count + 1 fuel_count = fuel_count + 1
end end
end end
-- Check that the reactor is complete and has the correct fuel -- Check that the has the correct fuel
if correct_fuel_count ~= 6 or reactor_structure_badness(pos) ~= 0 then if fuel_count ~= correct_fuel_count then
return false return msg_fuel_missing
end end
-- Check that the reactor is complete
if reactor_structure_badness(pos) ~= 0 then
return "Error: The power plant seems to be built incorrectly."
end
meta:set_int("burn_time", 1) meta:set_int("burn_time", 1)
technic.swap_node(pos, "technic:hv_nuclear_reactor_core_active") technic.swap_node(pos, "technic:hv_nuclear_reactor_core_active")
meta:set_int("HV_EU_supply", power_supply) meta:set_int("HV_EU_supply", power_supply)
@ -242,7 +251,8 @@ local function start_reactor(pos, meta)
src_stack:take_item() src_stack:take_item()
inv:set_stack("src", idx, src_stack) inv:set_stack("src", idx, src_stack)
end end
return true
return nil
end end
@ -281,7 +291,7 @@ local function run(pos, node)
"fuel used", 6, true) "fuel used", 6, true)
end end
if meta:get_string("autostart") == "true" then if meta:get_string("autostart") == "true" then
if start_reactor(pos, meta) then if not start_reactor(pos, meta) then
return return
end end
end end
@ -313,11 +323,11 @@ local nuclear_reactor_receive_fields = function(pos, formname, fields, sender)
meta:set_string("remote_channel", fields.remote_channel) meta:set_string("remote_channel", fields.remote_channel)
end end
if fields.start then if fields.start then
local b = start_reactor(pos, meta) local start_error_msg = start_reactor(pos, meta)
if b then if not start_error_msg then
minetest.chat_send_player(player_name, "Start successful") minetest.chat_send_player(player_name, "Start successful")
else else
minetest.chat_send_player(player_name, "Error") minetest.chat_send_player(player_name, start_error_msg)
end end
end end
if fields.autostart then if fields.autostart then
@ -385,11 +395,11 @@ local digiline_remote_def = function(pos, channel, msg)
melt_down_reactor(pos) melt_down_reactor(pos)
end end
elseif msg.command == "start" then elseif msg.command == "start" then
local b = start_reactor(pos, meta) local start_error_msg = start_reactor(pos, meta)
if b then if not start_error_msg then
digiline_remote.send_to_node(pos, channel, "Start successful", 6, true) digiline_remote.send_to_node(pos, channel, "Start successful", 6, true)
else else
digiline_remote.send_to_node(pos, channel, "Error", 6, true) digiline_remote.send_to_node(pos, channel, start_error_msg, 6, true)
end end
end end
end end

View File

@ -88,6 +88,7 @@ minetest.register_craft({
local function make_on(mark, length) local function make_on(mark, length)
return function(pos, node) return function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
local inv = meta:get_inventory() local inv = meta:get_inventory()
local dir = vector.new() local dir = vector.new()
if node.param2 == 3 then dir.x = 1 end if node.param2 == 3 then dir.x = 1 end
@ -102,6 +103,9 @@ local function make_on(mark, length)
minetest.check_for_falling(pos) minetest.check_for_falling(pos)
for i = 1, length do for i = 1, length do
place_pos = vector.add(place_pos, dir) place_pos = vector.add(place_pos, dir)
if owner ~= "" and minetest.is_protected(place_pos, owner) then
return
end
local place_node = minetest.get_node(place_pos) local place_node = minetest.get_node(place_pos)
deploy_node(inv, "slot"..i, place_pos, place_node, node) deploy_node(inv, "slot"..i, place_pos, place_node, node)
end end
@ -156,6 +160,11 @@ local function make_constructor(mark, length)
for i = 1, length do for i = 1, length do
inv:set_size("slot"..i, 1) inv:set_size("slot"..i, 1)
end end
meta:set_string("owner", "?")
end,
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", (placer and placer:get_player_name() or "?"))
end, end,
can_dig = function(pos, player) can_dig = function(pos, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

View File

@ -117,6 +117,8 @@ minetest.register_node("technic:injector", {
return inv:is_empty("main") return inv:is_empty("main")
end, end,
on_receive_fields = function(pos, formanme, fields, sender) on_receive_fields = function(pos, formanme, fields, sender)
if minetest.is_protected(pos, sender:get_player_name()) then return end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if fields.mode_item then meta:set_string("mode", "single items") end if fields.mode_item then meta:set_string("mode", "single items") end
if fields.mode_stack then meta:set_string("mode", "whole stacks") end if fields.mode_stack then meta:set_string("mode", "whole stacks") end

View File

@ -209,9 +209,10 @@ function technic.register_base_machine(data)
after_place_node = data.tube and pipeworks.after_place, after_place_node = data.tube and pipeworks.after_place,
after_dig_node = technic.machine_after_dig_node, after_dig_node = technic.machine_after_dig_node,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
local node = minetest.get_node(pos) if fields.quit then return end
if not pipeworks.may_configure(pos, sender) then return end if not pipeworks.may_configure(pos, sender) then return end
fs_helpers.on_receive_fields(pos, fields) fs_helpers.on_receive_fields(pos, fields)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local form_buttons = "" local form_buttons = ""
if not string.find(node.name, ":lv_") then if not string.find(node.name, ":lv_") then
@ -253,9 +254,10 @@ function technic.register_base_machine(data)
technic_run = run, technic_run = run,
technic_disabled_machine_name = data.modname..":"..ltier.."_"..machine_name, technic_disabled_machine_name = data.modname..":"..ltier.."_"..machine_name,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
local node = minetest.get_node(pos) if fields.quit then return end
if not pipeworks.may_configure(pos, sender) then return end if not pipeworks.may_configure(pos, sender) then return end
fs_helpers.on_receive_fields(pos, fields) fs_helpers.on_receive_fields(pos, fields)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local form_buttons = "" local form_buttons = ""
if not string.find(node.name, ":lv_") then if not string.find(node.name, ":lv_") then

View File

@ -181,6 +181,36 @@ local nodes = {
{"trunks:moss", false}, {"trunks:moss", false},
{"trunks:moss_fungus", false}, {"trunks:moss_fungus", false},
{"trunks:treeroot", false}, {"trunks:treeroot", false},
-- Support ethereal
{"ethereal:bamboo", true},
{"ethereal:bamboo_leaves", false},
{"ethereal:banana_trunk", true},
{"ethereal:bananaleaves", false},
{"ethereal:banana", false},
{"ethereal:birch_trunk", true},
{"ethereal:birch_leaves", false},
{"ethereal:frost_tree", true},
{"ethereal:frost_leaves", false},
{"ethereal:mushroom_trunk", true},
{"ethereal:mushroom", false},
{"ethereal:mushroom_pore", true},
{"ethereal:orangeleaves", false},
{"ethereal:orange", false},
{"ethereal:palm_trunk", true},
{"ethereal:palmleaves", false},
{"ethereal:coconut", false},
{"ethereal:redwood_trunk", true},
{"ethereal:redwood_leaves", false},
{"ethereal:sakura_trunk", true},
{"ethereal:sakura_leaves", false},
{"ethereal:sakura_leaves2", false},
{"ethereal:scorched_tree", true},
{"ethereal:willow_trunk", true},
{"ethereal:willow_twig", false},
{"ethereal:yellow_trunk", true},
{"ethereal:yellowleaves", false},
{"ethereal:golden_apple", false},
} }
local timber_nodenames = {} local timber_nodenames = {}