RU/Resources: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Few translations)
Line 2: Line 2:
Ресурсы - ключевая часть MTA. Ресурс представляет из себя каталог или zip архив, содержащий набор файлов, таких как скрипты, плю ''meta'' файл, описывающий то, как ресурс должен загружаться. Отчасти, ресурс можно рассматривать как эквивалент программе, работающей под управлением операционной системы - он может быть запущен, остановлен, и множество ресурсов может работать одновременно. Несмотря на это важно помнить, что, в отличии от программ, между ресурсами нет многозадачности.
Ресурсы - ключевая часть MTA. Ресурс представляет из себя каталог или zip архив, содержащий набор файлов, таких как скрипты, плю ''meta'' файл, описывающий то, как ресурс должен загружаться. Отчасти, ресурс можно рассматривать как эквивалент программе, работающей под управлением операционной системы - он может быть запущен, остановлен, и множество ресурсов может работать одновременно. Несмотря на это важно помнить, что, в отличии от программ, между ресурсами нет многозадачности.


==Terminology==
==Терминология==
* '''Resource''' - A zip file or folder containing a meta.xml file and a number of resource items. These are placed in the ''mods/deathmatch/resources'' folder in the server directory.
* '''Ресурс''' - Zip-архив или каталог, содержащий файл meta.xml и некоторое количество других элементов. Они размещаются в каталоге ''mods/deathmatch/resources'' сервера.
* '''Resource item''' - A file contained within a resource, currently this can be a map, script, images etc.
* '''Элемент ресурса''' - Файл, содержащийся в ресурсе, на данный момент это может быть, скрипт, рисунок и т.д.


==The Meta File==
==Мета-файл==
''See main article [[Meta.xml]] for details''
''Прочитайте статью [[RU/Meta.xml]] чтобы узнать подробности''


The Meta file is the core of each the resource. It describes exactly what files in the resource should be used, and how. The following is an example that covers every option there is, your meta files can have as many or as few of these tags as you require:
Мета-файл это основа любого ресурса. Он описывает, какие файлы в ресурсе должны использоваться и как. Следующий пример показывает все доступные опции. Ваши мета-файлы могут содержать столько тэгов, сколько вам понадобится:


<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
Line 39: Line 39:
</meta>
</meta>
</syntaxhighlight>
</syntaxhighlight>
While a CTF map may have a meta.xml that looks like:
В то же время карта CTF может содержать следующий  meta.xml:
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
<meta>
<meta>
Line 50: Line 50:




Script/type, Config/type and File/type attributes specify if the script/resource should be sent to clients or not, and defaults to "server".
Script/type, Config/type и File/type атрибуты определяют, должен ли скрипт/ресурс отправляться клиенту, и по умолчанию равны "server".


The include tag specifies other resources that should be started before this resoucre is started.  In other words, if your resource is dependent on another, you can include it so that the other resource is started first,
The include tag specifies other resources that should be started before this resoucre is started.  In other words, if your resource is dependent on another, you can include it so that the other resource is started first,

Revision as of 12:50, 22 June 2009

Warning.png This page requires local translation. If page will remain not translated in reasonable period of time it would be deleted.
After translating the page completely, please remove the ‎{{translate}}‎ tag from the page.

Ресурсы - ключевая часть MTA. Ресурс представляет из себя каталог или zip архив, содержащий набор файлов, таких как скрипты, плю meta файл, описывающий то, как ресурс должен загружаться. Отчасти, ресурс можно рассматривать как эквивалент программе, работающей под управлением операционной системы - он может быть запущен, остановлен, и множество ресурсов может работать одновременно. Несмотря на это важно помнить, что, в отличии от программ, между ресурсами нет многозадачности.

Терминология

  • Ресурс - Zip-архив или каталог, содержащий файл meta.xml и некоторое количество других элементов. Они размещаются в каталоге mods/deathmatch/resources сервера.
  • Элемент ресурса - Файл, содержащийся в ресурсе, на данный момент это может быть, скрипт, рисунок и т.д.

Мета-файл

Прочитайте статью RU/Meta.xml чтобы узнать подробности

Мета-файл это основа любого ресурса. Он описывает, какие файлы в ресурсе должны использоваться и как. Следующий пример показывает все доступные опции. Ваши мета-файлы могут содержать столько тэгов, сколько вам понадобится:

<meta>
    <info author="eAi" description="This is a basic CTF script" version="4"/>

    <include resource="radarblips"/>
    <include resource="markermanagement" />

    <script src="ctf.lua" />
    <script src="flag.lua" />
    <script src="ctf_client.lua" type="client" />

    <file src="model.dff" />
    <file src="quitbutton.png" />
    <file src="killed.png"  />

    <html src="test.htm" default="true"/>
    <html src="logo.png" raw="true" />

    <export function="multiply" http="true" />
    <export function="getPlayerList" />
    <export function="getElementOwner" type="client"/>

    <config src="vehicle-list.xml" type="client" />
    <config src="markerconfig.xml" type="server"  />

    <map src="somestuff.map" dimension="99" />
</meta>

В то же время карта CTF может содержать следующий meta.xml:

<meta>
    <include resource="ctf" />
    <map src="myuberl33tctfmap.map" />

    <info author="Tom" instructions="this is uber l33t !!!!!1111111" type="map" />
</meta>


Script/type, Config/type и File/type атрибуты определяют, должен ли скрипт/ресурс отправляться клиенту, и по умолчанию равны "server".

The include tag specifies other resources that should be started before this resoucre is started. In other words, if your resource is dependent on another, you can include it so that the other resource is started first,


Each resource has its own virtual machine (VM). This contains every script in the resource. This means that variables are not shared with other resources. The best way to communictate with other resources is by using the export tag and exporting a function. This will enable other resources to fire this function using the call scripting function.


Scripts sent to clients are started as soon as all the scripts have been downloaded.


Scripts are able to read and write to their own resource folder with functions such as xmlCreateFile and fileCreate. They can also read and write to other resources, but must have ACL access.


Each resource can only be loaded once, the server will ensure this. If a resource is included more than once, the same instance will be used by each resource that includes it.

File storage

Resource files can either be stored in a zip or a directory. This is located in:

mods/deathmatch/resources/

Each resource can have a zip file, a directory or both. In the case of both existing, the directory has precedence over the zip file, as such files can be placed in the directory to over-ride the files in the zip file. This allows directories to be used for testing and developing of maps/scripts while zip files used by end-users.

Script functions

The resource system can be manipulated by script. As such, the following Serverside scripting functions are provided:


The following events are also provided: