diff --git a/doc/en/block-properties.md b/doc/en/block-properties.md index f3137dd60..d98a8cac5 100644 --- a/doc/en/block-properties.md +++ b/doc/en/block-properties.md @@ -1,6 +1,6 @@ # Block properties -## Visual +## Visual & Audio ### *texture* @@ -70,6 +70,18 @@ Rotation profile (set of available block rotations and behaviour of placing bloc - "pane" - panels, doors, signs - "stairs" - "pane" + flipped variants +### *particles* + +Particles are specified as a JSON object. Property names can be found [in the particles section](particles.md). + +When camera is near to the block, the engine will create an emitter that will run +until the block is destroyed or the camera moves away a certain distance. + +### Material - *material* + +Defines the name of the block's material in the format `pack:material_name`, which affects the selection of block interaction sounds. +Material definitions are located in /block_materials. + ## Variants Some properties can vary dynamically, depending on the variant number stored in the user bits of the block. diff --git a/doc/ru/block-properties.md b/doc/ru/block-properties.md index 50bd7f023..e139f635d 100644 --- a/doc/ru/block-properties.md +++ b/doc/ru/block-properties.md @@ -1,6 +1,6 @@ # Свойства блоков -## Вид +## Вид & Звук ### Текстура - *texture* @@ -78,6 +78,11 @@ При приближении к блоку движок создаст эмиттер, который будет работать до разрушения блока или отдаления камеры на некоторое расстояние. +### Материал - *material* + +Определяет имя материала блока в формате `пак:имя_материала`, что влияет на выбор звуков взаимодействия с блоком. +Определения материалов расположены в /block_materials. + ## Варианты Некоторые свойства могут варьироваться динамически, в зависимости от номера варианта, хранимого в пользовательских битах блока. diff --git a/res/content/base/config/defaults.toml b/res/content/base/config/defaults.toml index 650c24d74..d2c5142cc 100644 --- a/res/content/base/config/defaults.toml +++ b/res/content/base/config/defaults.toml @@ -1,3 +1,4 @@ generator = "base:demo" player-entity = "base:player" hand-skeleton = "base:hand" +block-material = "base:stone" diff --git a/res/layouts/pages/content.xml.lua b/res/layouts/pages/content.xml.lua index 2937542f4..cb63a96c7 100644 --- a/res/layouts/pages/content.xml.lua +++ b/res/layouts/pages/content.xml.lua @@ -3,6 +3,7 @@ function on_open(params) mode = params.mode end refresh() + document.search_textbox.focused = true end -- add - packs to be added to the world (after apply) diff --git a/src/content/ContentBuilder.cpp b/src/content/ContentBuilder.cpp index 25029963b..97498b497 100644 --- a/src/content/ContentBuilder.cpp +++ b/src/content/ContentBuilder.cpp @@ -39,6 +39,9 @@ std::unique_ptr ContentBuilder::build() { } else { def.defaults.rt.solid = isSolid(def.defaults) || def.explictlySolid; } + if (def.material.empty()) { + defaults.at("block-material").get(def.material); + } const float EPSILON = 0.01f; def.rt.solid = diff --git a/src/voxels/Block.hpp b/src/voxels/Block.hpp index 5ba3bb267..ded51244e 100644 --- a/src/voxels/Block.hpp +++ b/src/voxels/Block.hpp @@ -37,8 +37,6 @@ inline constexpr size_t MAX_USER_BLOCK_FIELDS_SIZE = 240; inline constexpr int BLOCK_MAX_VARIANTS = 16; -inline std::string DEFAULT_MATERIAL = "base:stone"; - struct BlockFuncsSet { bool init : 1; bool update : 1; @@ -206,7 +204,7 @@ public: dv::value properties = nullptr; /// @brief id of used BlockMaterial, may specify non-existing material - std::string material = DEFAULT_MATERIAL; + std::string material; /// @brief Light emission R, G, B, S (sky lights: sun, moon, radioactive /// clouds)