Greetings to you Naikoraptor.
Today we'll talk about
- Establishing its technology
- System migrations
- About layers games (Collision)
(I specifically to dwell and then are put on, because their construction properties have so much that I'm afraid anything simply forget them, I'll highlight a single lesson)
And so let's start:
Establishing its technology
To begin, think, for what purpose we need it? We will unlock the recipes? Or improve anything? Because the technology is a little different in these cases.
Here are the codes from API.
- Reload ()-this function allows you to restart the researched technology on maps, useful if you have made edits, and new map you create.
- ForSE = LuaForse-what power applies this technology (player, porotivnik) this line missing always, no one has yet found it use, and however useless it but amiable developer just in case gave us.
- name = string-the name of the technology
- localised_name = string-localized name (but then we remember that we all make through locale.cfg?)
- enabled = bool-Row locks on rows in the likeness of the recipes are, in principle, it did not enjoy. Did that unlock via script
- upgrade = bool-Is an indication of improving it or not
- prerequisites = dictionary string → LuaTechnology-Table technology which should be studied to this technology became available for study
- research_unit_count = uint-what and how many jars to 1 study
- research_unit_energy = double-how long to study 1.
- order = string string sorting technology
Now let's try to make themselves the technology our casks from past examples.
To start with "zablokirvoat'" all of our recipes have barrels that each recipe add line: enabled = false
or enabled = "false
" no difference.
Then create a file Tehnology.lua
It prescribes the data: extend ({})
Technologies like everything else prescribed in individual {}, {}, {}.
Type = "technology", name = "Aisberg" icon = "__base__/graphics/icons/fluid/empty-crude-oil-barrel.png"[[ картинка технологии, и хоть в api про них ничего не сказано, но в игре их обязательно нужно указывать ]] icon_size = 32,-[[ НЕ обязательно, но если картинку обрезает, указываем её размер (картинка всегда квадрат) ]] effects =-[[Что будет делать Технология после исследования]] { { Type = "unlock-recipe" recipe = "empty-barrel-M" }, { Type = "unlock-recipe" recipe = "fill-barrel" }, { Type = "unlock-recipe" recipe = "empty-barrel" }, }, prerequisites = {}, Unit = { count = 35,-number of studies ingredients = { {"science-pack-1", 1}-[[ ресурс и количество, кстати чтобы не было ошибок я вам напомню что есть: science-pack-1, science-pack-2,science-pack-3, alien-science-pack]] }, time = 30-one time }
The technology works, recipes for not previously available.
Migrations
For another, this section can be called: "Updating fashion."
After all, the first time it is not possible to do so, it eventually, right? Therefore, it can often be that recipes items will vary. But how about those phones where the recipes already researched? There they will remain the same though you tresni (Game Technology and researched recipes stores separately, to simplify loading and saving memory).
Consider the very real situation: when we realized that the balance is disturbed.
Suppose you needed a barrel for water from 10 iron is expensive. So we are changing in her recipe for 9. But going on our map where we play for several Zilionov or bromilionov hours we find that barrel all the same kraftitsja of iron 10. We think we can do something wrong saw and open the list of technologies. But there, too, the recipe will be giving out 10 sheets. What-do we do?
Create in the root of fashion folder migrations.
There are creating a file with the name of the new version of fashion "
For example I have now called MyMod_ 0.1.1 Means I create MyMod_0.1.2.lua file in the folder
This file does not need to connect!
This file is activated then, and only then when you go to the map of the old version. He Rewrites this card under the version of our fashion and activates the file.
Most often it will write here it is:
for i, player in ipairs (game. players) do Player.. reset_technologies () Player.. reset_recipes () end
This updates all recipes and all the technology.
Now go to the info. json and there change to 0.1.1 to 0.1.2 and pereimenovyvaem folder the same way fashion
Finish! The mod has been updated!
Of course for the more advanced, I advise to use this file as a one-time script and if you wish you can shove and conditions and commands.
Layers of games (Collision)
The whole game though and looks single, in fact it's split into contact layers.
For example, a layer of water and a layer of buildings. After all, no building could be placed on water right?
Here is a list of layers:
"ground-tile-layer, move the character (1-th layer)
"water-tile-Layer not available la movement (0-th layer)
"resource-layer" layer of ores (3-th layer)
"floor-layer" layer of concrete or bricks (2-th layer)
"object-layer" layer objects (Supreme 4-th layer)
"player-layer" layer (the highest 4-th layer)
Notice that the 2 layers are at level 1? Layer the character is not used by anything except character, although it is equivalent to the layers of objects.
All this while and not particularly important, but gives space to create interesting pieces for some. For example when I dabbled with these settings I created something like Blocks "bridge" that stavjat'sja the water but allow you to put anything over them. Or for example I created a "fish farm" which depend only on the water.
Line segments are at all objects and surfaces (entities and tiles) But think it is too willing to find themselves
Comments: