Modding:Advanced Items/ru: Difference between revisions

From Vintage Story Wiki
no edit summary
(Created page with "Нам нужно знать, с какой стороны стоит игрок (на какую сторону он ориентируется) и находится ли он в творческом режиме или режиме выживания (нужно ли сбрасывать добытые предметы или нет). Прежде чем переопределять <code>OnBlockBrokenWith</code>, мы должны создать метод, кото...")
No edit summary
 
(11 intermediate revisions by 2 users not shown)
Line 75: Line 75:
{
{


<!--T:20-->
}
}
</syntaxhighlight>
</syntaxhighlight>
Line 118: Line 117:


<!--T:27-->
<!--T:27-->
<div lang="en" dir="ltr" class="mw-content-ltr">
Теперь мы можем реализовать <code>OnBlockBroken</code> довольно легко, позаботившись обо всех возможных осях, с которыми может столкнуться игрок:
Now we can implement <code>OnBlockBroken</code> rather easily, by taken care of every possible axis the player could face:
</div>
<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
public override bool OnBlockBrokenWith(IWorldAccessor world, Entity byEntity, ItemSlot itemslot, BlockSelection blockSel, float dropQuantityMultiplier = 1)
public override bool OnBlockBrokenWith(IWorldAccessor world, Entity byEntity, ItemSlot itemslot, BlockSelection blockSel, float dropQuantityMultiplier = 1)
Line 152: Line 149:


<!--T:29-->
<!--T:29-->
<div lang="en" dir="ltr" class="mw-content-ltr">
Если вы всё сделали правильно, то ваш файл должен быть похож на:
If you have done everything right, your file should look similar to this:
</div>
<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
using Vintagestory.API.Common;
using Vintagestory.API.Common;
Line 160: Line 155:
using Vintagestory.API.MathTools;
using Vintagestory.API.MathTools;


<!--T:30-->
namespace ExampleMods
namespace ExampleMods
{
{
Line 166: Line 160:
     {
     {


        <!--T:31-->
public override void Start(ICoreAPI api)
public override void Start(ICoreAPI api)
         {
         {
Line 173: Line 166:
         }
         }


    <!--T:32-->
}
}


    <!--T:33-->
public class TunnlerItem : Item
public class TunnlerItem : Item
     {
     {


        <!--T:34-->
public void DestroyBlocks(IWorldAccessor world, BlockPos min, BlockPos max, IPlayer player)
public void DestroyBlocks(IWorldAccessor world, BlockPos min, BlockPos max, IPlayer player)
         {
         {
Line 200: Line 190:
         }
         }


        <!--T:35-->
public override bool OnBlockBrokenWith(IWorldAccessor world, Entity byEntity, ItemSlot itemslot, BlockSelection blockSel, float dropQuantityMultiplier = 1)
public override bool OnBlockBrokenWith(IWorldAccessor world, Entity byEntity, ItemSlot itemslot, BlockSelection blockSel, float dropQuantityMultiplier = 1)
         {
         {
Line 226: Line 215:
         }
         }


    <!--T:36-->
}
}
}
}


<!--T:37-->
</syntaxhighlight>
</syntaxhighlight>


<!--T:38-->
<!--T:38-->
<div lang="en" dir="ltr" class="mw-content-ltr">
Вы также можете скачать файл напрямую: [https://wiki.vintagestory.at/images/a/ad/Tunnler.cs Tunnler.cs].
You can also download the file directly: [https://wiki.vintagestory.at/images/a/ad/Tunnler.cs Tunnler.cs].
</div>


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


<!--T:40-->
<!--T:40-->
<div lang="en" dir="ltr" class="mw-content-ltr">
Вот как это выглядит в игре:
This is how it looks ingame:
</div>


<!--T:41-->
<!--T:41-->
<youtube>2MRzYKguVFY</youtube>
<youtube>2MRzYKguVFY</youtube>


<div lang="en" dir="ltr" class="mw-content-ltr">
== Распространение == <!--T:42-->
== Distribution ==
</div> <!--T:42-->


<div lang="en" dir="ltr" class="mw-content-ltr">
=== Использование нового Шаблона Мода === <!--T:43-->
=== Using the new Mod Template ===
Если вы используете шаблон мода, следуйте инструкциям [[Modding:Setting up your Development Environment#Packaging the Mod|Настройка среды разработки]], чтобы упаковать ваш мод для дальнейшего распространения.
</div> <!--T:43-->
<div lang="en" dir="ltr" class="mw-content-ltr">
If using the mod template setup, follow the instructions on [[Modding:Setting up your Development Environment#Packaging%20the%20Mod|Setting up your Development Environment]] to pack and distribute your mod.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== Использование Modtools (старый способ) === <!--T:44-->
=== Using the (old) Modtools ===
Если вы используете программу modtools, откройте её и введите <code>pack <your mod id></code>. Теперь вы можете взять zip-файл и поделиться им с другими людьми. Он будет работать так же, как и обычные моды, вы можете установить его, скопировав в папку <code>mods</code>.
</div> <!--T:44-->
= Скачать Мод =
<div lang="en" dir="ltr" class="mw-content-ltr">
If using the modtools program, open the modtools and type in <code>pack <your mod id></code>. Now you can take the zip file and share it with other people. It will work in the same way as ordinary mods, you can install it by copying it into the <code>mods</code> folder.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
= Mod Download =
</div>


<!--T:45-->
<!--T:45-->
<div lang="en" dir="ltr" class="mw-content-ltr">
Варианты мода из этого руководства:  
Here is my version:
</div>
* for VS v1.9: [https://wiki.vintagestory.at/images/7/7b/Tunnler_vs1.9_v1.0.0.zip Tunnler_vs1.9_v1.0.0.zip]
* for VS v1.9: [https://wiki.vintagestory.at/images/7/7b/Tunnler_vs1.9_v1.0.0.zip Tunnler_vs1.9_v1.0.0.zip]
* for VS v1.8: [https://wiki.vintagestory.at/images/6/66/Tunnler.zip Tunnler.zip]
* for VS v1.8: [https://wiki.vintagestory.at/images/6/66/Tunnler.zip Tunnler.zip]
Confirmedusers
409

edits