I want to be a Dev … Part 0

Поделиться

Hello everyone again. Today I would like to talk about fashion and base unit on creating the simplest of items. This lesson will be introductory and some difficult moments will be described briefly (later we'll look at them in more detail).

More precisely, we consider:

  • The overall architecture of mods
  • Sorting files in fashion
  • Connection files
  • Create a basic object

 

The general architecture of the mods

To begin, go to the folder mods in the root directory of the game. It is here that will contain all the fashion.

In addition to the mods there is file mod-list. json-this file is responsible for what mods incorporated at the moment, it is also possible to choose which fashion will be turned on or off (without the required entry and perezahoda in the game).

RCs9mz2

 

Fashion themselves can contain both folders and archives (the first is easier to edit, the second for distribution).

The important thing is that the file or folder fashion must have a name constructed from the name of fashion, an underscore, and the version of fashion. This is the root folder fashion.

Example: MyMod_ 0.1.4

 

Version is always written as 3 numbers through the points. Developers explain it like this:

The first major upgrade, drastic changes.

The second small renewal, adding pairs of items

Third-bugfixes

 

Now on to the architecture of fashion:

There are "reserved" and "free" files and names, as well as the only required file.

Let's probably immediately going to create it, and will not return to this:Screenshot_21

create a folder of our fashion, and create a file "json info.".

This file is the face of fashion. He is responsible for its display in the list of mods in the game.

In the file set operator brackets {}.

Inside write row labels (in the picture you specify required) and their values in quotation marks. Do not forget that the name of the folder corresponding to the version and the name of fashion.

  • name-the name of fashion
  • version-version
  • title-the name of the fashion in the list
  • dependencies-dependency (such as Bob-series mods have dependencies on other mods)Screenshot_22
  • author-the name of the creator
  • descriprion-description of fashion

 

You can add and their lines, but do not forget: "brevity is the soul-sister of talent."

You can now deal with "free" and "reserved" names.

There are a number of special folders that the game will be perceived differently, and if there are not those files, you will get an error.

For example, you want all icons of objects lying in a certain place and create a folder called migration. However, the game will assume that this folder files to transfer data between versions. You will get an error.

To avoid this, here's a list of all reserved names for the root folder of the fashion:

  • campaigns
  • locale
  • Scenarios
  • migration

Otherwise, you have complete freedom in creating the folders and files but not to arrange a bacchanal in which hard work, there are easier methods of sorting. About this right now.

Sort files in fashion

This part is not mandatory and, in theory, you can do so, as you prefer. Opportunities for perversion here quite a lot. So I will tell you about the 2 convenient file storage method: first, as done by the developers, the second is purely my own.

     A method for developer3YC0bAts:

In the original game, all items, recipes, and files contained in the folder Prototypes. Graphics-Graphics folder. Sounds-Sounds. Thus, developers divide all files by type.

Inside the folder they are holding to the sub-type: for example, the folder rabienie goes Prototypes Recipes, Entity, Items, and Technologies. This guarantees you quick finding subject in folders, but if you have a lot, it would be difficult to find a specific item.

    Naikoraptor'a method (which Nick unreadable, that the text before the edits …)  (re: it is read as: Naiko Raptor) (Drug Japtor? ..)

It seems to me that when a subject all of its components are easier to keep close by, so I create a folder of all "objects", and in it under the folder for each "phenomenon"Screenshot_23

For example, the Prototypes folder Carbon lies in her lie files: Item.lua, recipe.lua, technology.lua, Carbon.png, Carbon_Tech.png.

Thus, if you change anything associated with the subject, all the files will be much closer and more convenient sorted.

 

Connection files.

The first thing is at the root of our fashion will create file data.luScreenshot_24a.

This file will be automatically started when you turn on fashion.

Any other lua files will be ignored.

Let us, for example, will create in our fashion Items folder and it will create Items.lua.

 

Now open the back our root file data.lua and store the new command:Screenshot_25

require()

 

Team propisyvaet'sja at the beginning of the file.

Inside the brackets indicates the path to the plugin file in lua quotes (!) that starts from the root of fashion.

Folder names are case sensitive and are separated by periods. The file itself is spelled without an extension ".LUA".

Files can be connected anywhere (i.e. I can create technology and connect a list of recipes, etc.).

Thus you are connecting all files lua (sounds and graphics we will consider later).

 

 

Now a few of my own: how it can be beneficial to use?

Remember, I advise you ob'edenjat' files in some objects and do sort of belonging to one or another subject? So, here it is very useful.

In each folder (the same "Carbon" in the example) create data.lua, and connect all the components.Screenshot_26

 

And in the main file connect this data.lua file. Thus, an object with your recipe will be submitted to a single file that you can easily enable or disable if you wishScreenshot_27.

 

 

 

 

 

Creating your subject

Lo and behold, we smoothly switched to create something of his own.

The most important thing in creating fashion is an idea. If you don't know what you are doing-the result will be flawed. You need idea (preferably original) to write something.

For example, I will create a full barrels of water (by analogy with barrels of oil). What for? And remember, when you create a map, you can specify that the water was only in the middle of the map? And suddenly, we need water for our "station" three-nine lands, and pull back the tube-is not beneficial, and to haul the train.

Create folder assigned under this object (Yes, I'll use their sorting, but you can do as you see fit), there are creating data.lua and item.lua

Okryvaem File item.lua and set back: data: extend ({})

Within double brackets will go an enumeration of all the objects. Thus we describe their base properties.

Each object within the "data: extend" written in their own brackets {}, {}, {}.

And do not forget to put commas between the brackets, or else you will find error.

Next is the filling of the subject: it is quite simple, as you need to fill all the rows and not just the ones you need (in other words you need to fill in what you need to fill in: lol:).

Now I will give you a list and description of all possible strings, and after-example of creating our "barrels".

  • type = string-This line tells the game that before her subject (other types will learn as guides, not immediately raskazhesh').
  • icon = string-specifies the path to the picture file (and the file clip art. AGA).
  • name = string-Specifies the subject name of the INSIDE fashion, rather than in the game itself. Owned by this name we will inform other parts of the code that we want to, but don't get confused to write as it is (only in English).
  • localised_name = string-name lokalizovanoe Gives the subject (it can be seen in the game). But we will not ever use this line because there is a simple and correct way to localize (more on this in the trace. times).
  • the STACK_SIZE = uint-surely, some frightened type "Uint"? Don't worry, it's just a long 32-bit unsigned integer (32-bit unsigned integer type. number in the range from 0 to 4 294 967 295. not bad, eh?). This parameter size staka.
  • fuel_value = float if you specify this string, then tell the game that this object-fuel, and its need to poke into the slot for fuel (in the oven too). Here you can specify how many object gives energy when burned. For example, coal provides 4.0, and solid fuels-15.5 can be written and shot. (float-signed floating-point number. account value is meaningless, and the number may vary within 1.40129846432481707 e-45 … 3.40282346638528860 e +38).
  • order = string-a string that specifies the order in which to sort the items. About this the following Allstars. Until put "aaa" (Latin).
  • Group = string-string sorting by group. Also leave for later (do not fill it).
  • subgroup = string-String sorting by Strip. And it'll leave for later (specify a raw-material)
  • place_result = string is an indication of what will happen if you put an object on the ground. About the buildings we will also speak.
  • float speed =-indicates the speed of the object, if it is a weapon or tool.
  • magazine_size = float-specifies the number of cartridges in the holder, if this weapon.
  • resistance = Resistance-another "magic" data type. About it later. This line is responsible for resistance to Armor damage if the subject-armor.
  • item_to_clear = LuaItemPrototype-this line identifies the resource with which you can clean the drawing from content.
  • Stackable = bool-if false then this prohibits subject stakat'sja. However, it is easier to do this by specifying the stack_size = 1.
  • module_effects-this line does not have a type. She is responsible for the effects if the created object-module effects.
  • flags = string-the most interesting line. Gives the object properties (flags). This, like almost everyone, I will tell BW, but not now.

And now let's create our barrel:

data: extend ({
{

Type = "item",

name = "WaterB"

icon = "__MyMod__/Prototypes/WaterT/empty-barrel.png"

flags = {"goes-to-main-inventory"},

subgroup = "raw material"

order = "aaa"

the STACK_SIZE = 10,

},
})

 

 

Now I will tell you about missed two things: flags and picture.

To create a simple object need only 1 of the 2 flags: "goes-to-main-inventory" or "goes to the quickbar.

The first will be to transfer the subject with Kraft in inventory and second suggest to the hot bar. While that is all that you need to know (well, that and they cannot be put together).

Now about the images: the picture must be png format and size of 32 x 32. Otherwise the game will generate an error. If you are lazy to invent and draw a picture (or if you do not know how to draw)-you can plug already finished out the game.

Go to the folder base, and there's a graph in icons are looking for our barrel.

Here's to you just in case her path: __base__/graphics/icons/fluid/empty-barrel.png

Copy this file to a folder (you can add back anything) and writhe like this icon = "__MyMod__/Prototypes/WaterT/empty-barrel.png"

 

Tell more in detail about how to connect your pictures:

First, specify the name of the fashion with double underscores: _ _ Name _ _ fashion (without gaps, you can mount and base game and foreign fashion;))

then, through "/" folder names are specified, then the file with the extension.

 

Now connect our's in data.lua and go into the game (check for errors). If they do not exist Screenshot_28and the game starts, all OK. However, a subject so far we can only see, for example, in the trunk because he does not have a prescription.

Well, that's all. We created our first item (and, although he does not have a prescription, you can find it in list of items). About how to add recipes will tell the times, otherwise it will be too much information (and too much will have someone edit text … : cry:).


Поделиться

Comments:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.