Modding:Block and Item Interactions/ru: Difference between revisions

From Vintage Story Wiki
no edit summary
(Created page with "Modding:Взаимодействие Блоков и Предметов")
Tags: Mobile edit Mobile web edit
 
No edit summary
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
<languages/>
<languages/>
__FORCETOC__
__FORCETOC__
<div lang="en" dir="ltr" class="mw-content-ltr">
{{GameVersion|1.19.3}}
{{GameVersion|1.19.3}}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Этот урок познакомит вас с основами создания пользовательских взаимодействий. Мы создадим волшебную палочку, которая будет создавать частицы при нажатии правой кнопки мыши.
This tutorial will introduce you into the basics of custom interactions. We will create a magic wand which will spawn particles when holding right click.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
= Подготовка =
= Preparations =
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Я настоятельно рекомендую сначала прочитать о [[Modding:Advanced Items|Классах Предмета]]. Кроме того, вы можете скачать необходимые ассеты [https://wiki.vintagestory.at/images/4/4d/MagicWand_-_No_CS_File.zip здесь].
I highly recommend to read about [[Advanced Items|The Item Class]] first. Additionally you can download the assets [https://wiki.vintagestory.at/images/4/4d/MagicWand_-_No_CS_File.zip here].
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Все это уже должно быть вам знакомо: создание и регистрация класса предмета ...
All of this should be familiar to you, creating and registering the item class ...
</div>


<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
Line 39: Line 29:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
== Добавление частиц ==
== Adding particles ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Теперь нам нужно реализовать функцию взаимодействия. Прежде всего нам нужно указать, что игрок может "использовать" этот инструмент, поэтому нам нужно установить handling в <code>handled</code> ...
Now we need to implement the interact function. First of all we need to specify that the player can "use" this tool, therefore we need to set handling to <code>handled</code> ...
</div>


<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
Line 54: Line 40:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
Метод <code>OnHeldInteractStep</code> позволяет нам создавать частицы за тик, до тех пор, пока игрок использует предмет, но лучше перед этим реализовать анимацию. Частицы должны появляться после завершения анимации ...
The method <code>OnHeldInteractStep</code> allows us to spawn particles per tick while the player is using the item, but it would be better to implement an animation first. Particles should spawn after the animation is done ...
</div>


<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
Line 74: Line 58:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
Удерживая правую кнопку мыши ...
Holding rightclick ...
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
[[File:Magic Stick Interact.gif|300px]]
[[File:Magic Stick Interact.gif|300px]]
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Итак, давайте начнем работу с частицами, нам нужен статический тип частиц...
So let's start to mess around with particles, therefore we need a static particle type ...
</div>


<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
Line 102: Line 80:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
Частицы должны появиться после завершения анимации. Это произойдет через <code>0.6</code> секунд ...
Particles should spawn once the animation is completed. This will be the case after <code>0.6</code> seconds ...
</div>


<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
Line 113: Line 89:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
Рекомендую сначала прочитать руководство по [[Modding:Simple Particles|Простым Частицам]]. Этот код будет создавать частицы перед игроком с рандомизированным цветом и синусоидально изменяющегося размера ...
I suggest to read the tutorial about [[Simple Particles]] first. This code will spawn particles in front of the player with a randomized color and a sinus evolving size ...
</div>


<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
Line 134: Line 108:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
Если мы соберем все вместе, то метод <code>OnHeldInteractStep</code> будет выглядеть следующим образом...
If we put everything together the <code>OnHeldInteractStep</code> method will look like this ...
</div>


<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
Line 172: Line 144:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
== Тестирование ==
== Testing ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Теперь мы можем запустить наш первый тест, не правда ли, это выглядит прекрасно?
Now we can run our first test, doesn't it look beautiful?
</div>


<youtube>bTPXL97Gfns</youtube>
<youtube>bTPXL97Gfns</youtube>


<div lang="en" dir="ltr" class="mw-content-ltr">
= Скачать Мод =
= Mod Download =
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Не стесняйтесь попробовать это самостоятельно:
Feel free to try it out yourself:
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Варианты мода из этого руководства:  
Here is my version:  
* for VS v1.9: [https://wiki.vintagestory.at/images/7/72/Magicwand_vs1.9_v1.0.0.zip Magicwand_vs1.9_v1.0.0.zip]
* for VS v1.9: [https://wiki.vintagestory.at/images/7/72/Magicwand_vs1.9_v1.0.0.zip Magicwand_vs1.9_v1.0.0.zip]
* for VS v1.8: [https://wiki.vintagestory.at/images/3/38/MagicWand.zip MagicWand.zip]
* for VS v1.8: [https://wiki.vintagestory.at/images/3/38/MagicWand.zip MagicWand.zip]
</div>






{{Navbox/modding|Vintage Story}}
{{Navbox/modding|Vintage Story}}
Confirmedusers
409

edits