Minetest.register node

## Синтаксис

```
nil = minetest.register_node(string name, table node_definition)

```

## Описание

Регистрирует новую ноду под именем `name`, добавляя её описание в глобальные таблицы minetest.registered\_items и minetest.registered\_nodes.

**ВАЖНО**: функции регистрации работают только во время инициализации; вызов во время игровой сессии порождает ошибку и падение сервера.

Таблица `node_definition` может содержать следующие поля:

* `string description`;
* `table groups`;
* `string inventory_image`;
* `string wield_image`;
* `Position wield_scale`;
* `number stack_max = 99`;
* `number range = 4`;
* `boolean liquids_pointable = false`;
* `table tool_capabilities`;
* `string node_placement_prediction`;
* `function on_place(ItemStack stack, Player placer, PointedThing point) = minetest.item_place`;
* `function on_secondary_use(ItemStack stack, Player user, PointedThing point)`;
* `function on_drop(ItemStack stack, Player dropper, Position pos) = minetest.item_drop`;
* `function on_use(ItemStack stack, Player user, PointedThing point)`;
* `function after_use(ItemStack stack, Player user, NodeTable node, table dig_params)`;
* `string drawtype = normal`;
* `number visual_scale = 1`;
* `table tiles`;
* `table special_tiles`;
* `number alpha = 255`;
* `boolean use_texture_alpha = false`;
* `ColorSpec post_effect_color`;
* `string paramtype = none`;
* `string paramtype2 = none`;
* `number place_param2`;
* `boolean is_ground_content = true`;
* `boolean sunlight_propagates = false`;
* `boolean walkable = true`;
* `boolean pointable = true`;
* `boolean diggable = true`;
* `boolean climbable = false`;
* `boolean buildable_to = false`;
* `boolean floodable = false`;
* `string liquidtype = none`;
* `string liquid_alternative_flowing`;
* `string liquid_alternative_source`;
* `number liquid_viscosity = 0`;
* `boolean liquid_renewable = true`;
* `number liquid_range = 8`;
* `number leveled = 0`;
* `number drowning = 0`;
* `number light_source = 0`;
* `number damage_per_second = 0`;
* `table node_box`;
* `table | string connects_to`;
* `table connect_sides`;
* `string mesh`;
* `table selection_box = {type = "regular"}`;
* `table collision_box = {type = "regular"}`;
* `boolean legacy_facedir_simple = false`;
* `boolean legacy_wallmounted = false`;
* `table sounds`;
* `string | table drop`;
* `function on_construct(Position pos)`;
* `function on_destruct(Position pos)`;
* `function after_destruct(Position pos, NodeTable old_node)`;
* `function after_place_node(Position pos, Player placer, ItemStack stack, PointedThing point)`;
* `function after_dig_node(Position pos, NodeTable old_node, NodeMetaRef old_meta, Player digger)`;
* `function can_dig(Position pos [, Player player ])`;
* `function on_punch(Position pos, NodeTable node, Player puncher, PointedThing point) = minetest.node_punch`;
* `function on_rightclick(Position pos, NodeTable node, Player clicker, ItemStack stack, PointedThing point)`;
* `function on_dig(Position pos, NodeTable node, Player digger) = minetest.node_dig`;
* `function on_timer(Position pos, number elapsed)`;
* `function on_receive_fields(Position pos, string form_name, table fields, Player sender)`;
* `function allow_metadata_inventory_move(Position pos, string from_list, number from_index, string to_list, number to_index, number count, Player player)`;
* `function allow_metadata_inventory_put(Position pos, string list_name, number index, ItemStack stack, Player player)`;
* `function allow_metadata_inventory_take(Position pos, string list_name, number index, ItemStack stack, Player player)`;
* `function on_metadata_inventory_move(Position pos, string from_list, number from_index, string to_list, number to_index, number count, Player player)`;
* `function on_metadata_inventory_put(Position pos, string list_name, number index, ItemStack stack, Player player)`;
* `function on_metadata_inventory_take(Position pos, string list_name, number index, ItemStack stack, Player player)`;
* `function on_blast(Position pos, number intensity)`.

## Примеры

```
minetest.register\_node("default:stone", {
	description = "Stone",
	tiles = {"default\_stone.png"},
	groups = {cracky = 3, stone = 1},
	drop = "default:cobble",
	legacy\_mineral = true,
	sounds = default.node\_sound\_stone\_defaults(),
})

```

## Примечания

1. ↑ TODO: здесь только список, необходимо добавить описания.