12 Commits

Author SHA1 Message Date
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
00618d13b5 Drill and laser: call node-specific on_dig (#556)
This properly digs nodes that have a custom on_dig function specified. For normal nodes, the behaviour is kept the same.
2020-06-27 17:29:50 +02:00
6154a04c00 Remove node_ownership support, cleanup (#560) 2020-06-24 21:14:04 +02:00
438c0877f6 Add external machine registration support (#557)
New 'technic.register_base_machine' definition table value: 'modname' (defaults to current run mod)
2020-06-24 21:12:25 +02:00
12 changed files with 395 additions and 327 deletions

View File

@ -8,4 +8,4 @@ jobs:
- name: lint
uses: Roang-zero1/factorio-mod-luacheck@master
with:
luacheckrc_url: https://raw.githubusercontent.com/minetest-mods/technic/master/.luacheckrc
luacheckrc_url: ""

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)
[![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
* Nekogloop
* Nore/Ekdohibs
* ShadowNinja
* VanessaE
* 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,
mainly constructable machines and tools. It is a large modpack, and
tends to dominate gameplay when it is used. This manual describes how
to use the technic modpack, mainly from a player's perspective.
The technic modpack extends Minetest Game (shipped with Minetest by default)
with many new elements, mainly constructable machines and tools. This manual
describes how to use the modpack, mainly from a player's perspective.
The technic modpack depends on some other modpacks:
* 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:
Documentation of the mod dependencies can be found here:
* [Minetest Game Documentation](https://wiki.minetest.net/Main_Page)
* [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)
* [Basic materials Repository](https://gitlab.com/VanessaE/basic_materials)
Recipes for constructable items in technic are generally not guessable,
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.
## Recipes
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
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.
## Substances
Elevation is measured in meters, relative to a reference plane that
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".
### Ores
The ores that matter in technic are coal, iron, copper, tin, zinc,
chromium, uranium, silver, gold, mithril, mese, and diamond.
Technic registers a few ores which are needed to craft machines or items.
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
+64 downwards, so is available right on the surface at the start of
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.
Elevation (Y axis) is measured in meters. The reference is usually at sea
level. Ores can generally be found more commonly by going downwards to -1000m.
Iron is part of the basic Minetest game. It is found from elevation
+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).
Note ¹: *These ores are provided by Minetest Game. See [Ores](https://wiki.minetest.net/Ores#Ores_overview) for a rough overview*
Copper is part of the basic Minetest game (having migrated there from
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
own for its electrical conductivity, or as the base component of alloys.
Note ²: *These ores are provided by moreores. TODO: Add reference link*
#### Coal ¹
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
be the material that most limits your activity.
Tin is part of the basic Minetest game (having migrated there from
moreores). It is found from elevation +8 downwards, with no
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.
#### Tin ¹
Use: batteries, bronze
Zinc is supplied by technic. It is found from elevation +2 downwards,
with no elevation-dependent variations in abundance beyond that point.
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.
Tin is a common metal but is used rarely. 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
downwards, with no elevation-dependent variations in abundance beyond
that point. It is a moderately common metal. Its main use is as the
secondary ingredient in stainless steel (the base being iron).
#### Zinc
Use: brass
Uranium is supplied by technic. It is found only from elevation -80 down
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.
Depth: 2m, more commonly below -32m
Silver is supplied by the moreores mod. It is found from elevation -2
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.
Zinc only has a few uses but is a common metal.
Gold is part of the basic Minetest game (having migrated there from
moreores). It is found from elevation -64 downwards, but is more
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.
#### Chromium
Use: stainless steel
Mithril is supplied by the moreores mod. It is found from elevation
-512 downwards, the deepest ceiling of any minable substance, with
no elevation-dependent variations in abundance beyond that point.
It is a rare precious metal, and unlike all the other metals described
here it is entirely fictional, being derived from J. R. R. Tolkien's
Depth: -100m, more commonly below -200m
#### Uranium
Use: nuclear reactor fuel
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.
Mese is part of the basic Minetest game. It is found from elevation
-64 downwards. The ore is more abundant from elevation -256 downwards,
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.
#### Mese ¹
Use: various
Diamond is part of the basic Minetest game (having migrated there from
technic). It is found from elevation -128 downwards, but is more abundant
from elevation -256 downwards. It is a precious gemstone. It is used
moderately, mainly for reasons connected to its extreme hardness.
Mese is a precious gemstone, and unlike diamond it is entirely fictional.
It is used in small quantities, wherever some magic needs to be imparted.
### rock ###
#### Diamond ¹
Use: mainly for cutting machines
In addition to the ores, there are multiple kinds of rock that need to be
mined in their own right, rather than for minerals. The rock types that
matter in technic are standard stone, desert stone, marble, and granite.
Diamond is a precious gemstone. It is used moderately, mainly for reasons
connected to its extreme hardness.
Standard stone is part of the basic Minetest game. It is extremely
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.
### Rocks
Desert stone is part of the basic Minetest game. It is found specifically
in desert biomes, and only from elevation +2 upwards. Although it is
easily accessible, therefore, its quantity is ultimately quite limited.
It is used in a few recipes.
This section describes the rock types added by technic. Further rock types
are supported by technic machines. These can be processed using the grinder:
Marble is supplied by technic. It is found in dense clusters from
elevation -50 downwards. It has mainly decorative use, but also appears
in one machine recipe.
* Stone (plain)
* Cobblestone
* Desert Stone
Granite is supplied by technic. It is found in dense clusters from
elevation -150 downwards. It is much harder to dig than standard stone,
so impedes mining when it is encountered. It has mainly decorative use,
but also appears in a couple of machine recipes.
#### Marble
Depth: -50m, evenly common
### 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
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.
If you have the moretrees mod installed, the rubber trees you need
are those defined by that mod. If not, technic supplies a copy of the
moretrees rubber tree.
Rubber trees are provided by technic if the moretrees mod is not present.
Extracting rubber requires a specific tool, a tree tap. Using the tree
tap (by left-clicking) on a rubber tree trunk block extracts a lump of
raw latex from the trunk. Each trunk block can be repeatedly tapped for
latex, at intervals of several minutes; its appearance changes to show
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.
Extract raw latex from rubber using the "Tree Tap" tool. Punch/left-click the
tool on a rubber tree trunk to extract a lump of raw latex from the trunk.
Emptied trunks will regenerate at intervals of several minutes, which can be
observed by its appearance.
Raw latex isn't used directly. It must be vulcanized to produce finished
rubber. This can be performed by alloying the latex with coal dust.
To obtain rubber from latex, alloy 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
a common pattern in how metals are handled. Generally, each metal can
exist in five forms: ore, lump, dust, ingot, and block. With a couple of
tricky exceptions in mods outside technic, metals are only *used* in dust,
ingot, and block forms. Metals can be readily converted between these
three forms, but can't be converted from them back to ore or lump forms.
* ore -> stone containing the lump
* lump -> draw metal obtained by digging ("nuggets")
* dust -> grinder output
* ingot -> melted/cooked lump or dust
* block -> placeable node
As in the basic Minetest game, a "lump" of metal is acquired directly by
digging ore, and will then be processed into some other form for use.
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.)
Metals can be converted between dust, ingot and block, but can't be converted
from them back to ore or lump forms.
Not all metals occur directly as ore. Generally, elemental metals (those
consisting of a single chemical element) occur as ore, and alloys (those
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.
#### Grinding
Ores can be processed as follows:
The basic Minetest game offers a single way to refine metals: cook a lump
in a furnace to produce an ingot. With technic this refinement method
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.
* ore -> lump (digging) -> ingot (melting)
* ore -> lump (digging) -> 2x dust (grinding) -> 2x ingot (melting)
An ingot can also be ground back to (one pile of) dust. Thus it is always
possible to convert metal between ingot and dust forms, at the expense
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.
At the expense of some energy consumption, the grinder can extract more material
from the lump, resulting in 2x dust which can be melted to two ingots in total.
#### Alloying
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
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
is also returned in the same form. For example, brass can be produced
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
dust to make three piles of brass dust. The two ways of alloying produce
equivalent results.
is also returned in the same form.
Example: 2x copper ingots + zinc ingot -> 3x brass ingot (alloying)
The same will also work for dust ingredients, resulting in brass dist.
### iron and its alloys ###

View File

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

View File

@ -1,41 +1,115 @@
This file is fairly incomplete. Help is welcome.
# technic API
Tiers
-----
The tier is a string, currently `"LV"`, `"MV"` and `"HV"` are supported.
This file documents the functions within the technic modpack for use in mods.
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)`
* 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
* Use this function when showing players energy values
* `technic.pretty_num(num)`
* Converts the number `num` to a human-readable string with SI prefixes
* `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.get_or_load_node(pos)`
* If the mapblock is loaded, it returns the node at pos,
else it loads the chunk and returns `nil`.
* `technic.config:get(name)`
* Some configuration function
* `technic.tube_inject_item(pos, start_pos, velocity, item)`
* Same as `pipeworks.tube_inject_item`
### Energy modifiers
* `technic.set_RE_wear(itemstack, item_load, max_charge)`
* If the `wear_represents` field in the item's nodedef is
`"technic_RE_charge"`, this function does nothing.
* Modifies the power tool wear of the given itemstack
* `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)`
* This function fully recharges an RE chargeable item.
* If `technic.power_tools[itemstack:get_name()]` is `nil` (or `false`), this
function does nothing, else that value is the maximum 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`.
* `technic.get_cable_tier(nodename)`
* Returns the tier of the cable `nodename` or `nil`.
### Node-specific
* `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`.
* `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)`
* Returns an iteration function (usable in the for loop) to iterate over the
node positions along the specified ray.
@ -43,58 +117,50 @@ Helper functions
* `technic.trace_node_ray_fat(pos, dir, range)`
* Like `technic.trace_node_ray` but includes extra positions near the ray.
* 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
* `technic.register_solar_array(data)`
* 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.
## Item Definition fields
Groups:
Used itemdef fields
-------------------
* groups:
* `technic_<ltier> = 1` ltier is a tier in small letters; this group makes
the node connect to the cable(s) of the right tier.
* `technic_machine = 1` Currently 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)`
* `technic_<tier> = 1`
* Makes the node connect to the cables of the matching tier name
* `<tier>`: name of the tier, in lowercase (ex. `lv`)
* `technic_machine = 1`
* UNRELIABLE. Indicates whether the item or node belongs to technic
* `connect_sides = {"top", "left", ...}`
* Extends the Minetest API. Indicates where the machine can be connected.
Additional definition fields:
* `wear_represents = "string"`
* 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.
Modders have to manually change the information about supply etc. in the
node metadata.
Machine types
-------------
There are currently following 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 batbox
## Node Metadata fields
Nodes connected to the network will have one or more of these parameters as meta
data:
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
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.
### Node meta usage
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
## Deprecated functions
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.
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`
* 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

@ -14,20 +14,7 @@ end
function technic_homedecor_node_is_owned(pos, placer)
local ownername = false
if type(IsPlayerNodeOwner) == "function" then -- node_ownership mod
if HasOwner(pos, placer) then
if not IsPlayerNodeOwner(pos, placer:get_player_name()) then
if type(getLastOwner) == "function" then -- ...is an old version
ownername = getLastOwner(pos)
elseif type(GetNodeOwnerName) == "function" then -- ...is a recent version
ownername = GetNodeOwnerName(pos)
else
ownername = S("someone")
end
end
end
elseif type(isprotect) == "function" then -- glomie's protection mod
if type(isprotect) == "function" then -- glomie's protection mod
if not isprotect(5, pos, placer) then
ownername = S("someone")
end

View File

@ -88,6 +88,7 @@ minetest.register_craft({
local function make_on(mark, length)
return function(pos, node)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
local inv = meta:get_inventory()
local dir = vector.new()
if node.param2 == 3 then dir.x = 1 end
@ -102,6 +103,9 @@ local function make_on(mark, length)
minetest.check_for_falling(pos)
for i = 1, length do
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)
deploy_node(inv, "slot"..i, place_pos, place_node, node)
end
@ -156,6 +160,11 @@ local function make_constructor(mark, length)
for i = 1, length do
inv:set_size("slot"..i, 1)
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,
can_dig = function(pos, player)
local meta = minetest.get_meta(pos)

View File

@ -117,6 +117,8 @@ minetest.register_node("technic:injector", {
return inv:is_empty("main")
end,
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)
if fields.mode_item then meta:set_string("mode", "single items") end
if fields.mode_stack then meta:set_string("mode", "whole stacks") end

View File

@ -39,6 +39,8 @@ function technic.register_base_machine(data)
local tier = data.tier
local ltier = string.lower(tier)
data.modname = data.modname or minetest.get_current_modname()
local groups = {cracky = 2, technic_machine = 1, ["technic_"..ltier] = 1}
if data.tube then
groups.tubedevice = 1
@ -82,7 +84,7 @@ function technic.register_base_machine(data)
local eu_input = meta:get_int(tier.."_EU_input")
local machine_desc_tier = machine_desc:format(tier)
local machine_node = "technic:"..ltier.."_"..machine_name
local machine_node = data.modname..":"..ltier.."_"..machine_name
local machine_demand = data.demand
-- Setup meta data if it does not exist.
@ -157,15 +159,15 @@ function technic.register_base_machine(data)
tentry = ""
end
minetest.register_node("technic:"..ltier.."_"..machine_name, {
minetest.register_node(data.modname..":"..ltier.."_"..machine_name, {
description = machine_desc:format(tier),
tiles = {
"technic_"..ltier.."_"..machine_name.."_top.png"..tentry,
"technic_"..ltier.."_"..machine_name.."_bottom.png"..tentry,
"technic_"..ltier.."_"..machine_name.."_side.png"..tentry,
"technic_"..ltier.."_"..machine_name.."_side.png"..tentry,
"technic_"..ltier.."_"..machine_name.."_side.png"..tentry,
"technic_"..ltier.."_"..machine_name.."_front.png"
data.modname.."_"..ltier.."_"..machine_name.."_top.png"..tentry,
data.modname.."_"..ltier.."_"..machine_name.."_bottom.png"..tentry,
data.modname.."_"..ltier.."_"..machine_name.."_side.png"..tentry,
data.modname.."_"..ltier.."_"..machine_name.."_side.png"..tentry,
data.modname.."_"..ltier.."_"..machine_name.."_side.png"..tentry,
data.modname.."_"..ltier.."_"..machine_name.."_front.png"
},
paramtype2 = "facedir",
groups = groups,
@ -207,9 +209,10 @@ function technic.register_base_machine(data)
after_place_node = data.tube and pipeworks.after_place,
after_dig_node = technic.machine_after_dig_node,
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
fs_helpers.on_receive_fields(pos, fields)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local form_buttons = ""
if not string.find(node.name, ":lv_") then
@ -227,18 +230,18 @@ function technic.register_base_machine(data)
end,
})
minetest.register_node("technic:"..ltier.."_"..machine_name.."_active",{
minetest.register_node(data.modname..":"..ltier.."_"..machine_name.."_active",{
description = machine_desc:format(tier),
tiles = {
"technic_"..ltier.."_"..machine_name.."_top.png"..tentry,
"technic_"..ltier.."_"..machine_name.."_bottom.png"..tentry,
"technic_"..ltier.."_"..machine_name.."_side.png"..tentry,
"technic_"..ltier.."_"..machine_name.."_side.png"..tentry,
"technic_"..ltier.."_"..machine_name.."_side.png"..tentry,
"technic_"..ltier.."_"..machine_name.."_front_active.png"
data.modname.."_"..ltier.."_"..machine_name.."_top.png"..tentry,
data.modname.."_"..ltier.."_"..machine_name.."_bottom.png"..tentry,
data.modname.."_"..ltier.."_"..machine_name.."_side.png"..tentry,
data.modname.."_"..ltier.."_"..machine_name.."_side.png"..tentry,
data.modname.."_"..ltier.."_"..machine_name.."_side.png"..tentry,
data.modname.."_"..ltier.."_"..machine_name.."_front_active.png"
},
paramtype2 = "facedir",
drop = "technic:"..ltier.."_"..machine_name,
drop = data.modname..":"..ltier.."_"..machine_name,
groups = active_groups,
connect_sides = data.connect_sides or connect_default,
legacy_facedir_simple = true,
@ -249,11 +252,12 @@ function technic.register_base_machine(data)
allow_metadata_inventory_take = technic.machine_inventory_take,
allow_metadata_inventory_move = technic.machine_inventory_move,
technic_run = run,
technic_disabled_machine_name = "technic:"..ltier.."_"..machine_name,
technic_disabled_machine_name = data.modname..":"..ltier.."_"..machine_name,
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
fs_helpers.on_receive_fields(pos, fields)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local form_buttons = ""
if not string.find(node.name, ":lv_") then
@ -271,8 +275,8 @@ function technic.register_base_machine(data)
end,
})
technic.register_machine(tier, "technic:"..ltier.."_"..machine_name, technic.receiver)
technic.register_machine(tier, "technic:"..ltier.."_"..machine_name.."_active", technic.receiver)
technic.register_machine(tier, data.modname..":"..ltier.."_"..machine_name, technic.receiver)
technic.register_machine(tier, data.modname..":"..ltier.."_"..machine_name.."_active", technic.receiver)
end -- End registration

View File

@ -181,6 +181,36 @@ local nodes = {
{"trunks:moss", false},
{"trunks:moss_fungus", 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 = {}

View File

@ -51,13 +51,15 @@ local function drill_dig_it0 (pos,player)
minetest.record_protection_violation(pos, player:get_player_name())
return
end
local node=minetest.get_node(pos)
local node = minetest.get_node(pos)
if node.name == "air" or node.name == "ignore" then return end
if node.name == "default:lava_source" then return end
if node.name == "default:lava_flowing" then return end
if node.name == "default:water_source" then minetest.remove_node(pos) return end
if node.name == "default:water_flowing" then minetest.remove_node(pos) return end
minetest.node_dig(pos,node,player)
local def = minetest.registered_nodes[node.name]
if not def then return end
def.on_dig(pos, node, player)
end
local function drill_dig_it1 (player)

View File

@ -46,7 +46,7 @@ local function laser_node(pos, node, player)
})
return
end
minetest.node_dig(pos, node, player)
def.on_dig(pos, node, player)
end
local keep_node = {air = true}