Current location - Recipe Complete Network - Complete cookbook of home-style dishes - Code analysis of famine recipes
Code analysis of famine recipes
During the famine, players can learn about their own version of the latest recipes by reading the code, instead of waiting for a few days to find the latest recipes online. Below, let's share the code analysis of deep space famine recipes. Interested players have a look.

There are probably two shortcomings: the first code is in English, which probably requires junior high school English level to understand, and it may be a bit difficult for some dishes to correspond to the Chinese version; Compared with convenient tools and web pages, the code has no friendly user interface and is a bit boring.

Find the code file. Take SW as an example: enter the game installation folder and enter: data-DLC0002-scripts.

There are three main code files related to recipes. Find cooking.lua in it first, and open it with notepad. What is recorded here is the degree attribute of the basic food. Search "AddIngredientValues" in Notepad and find the place where it first appeared. At present, everyone should:

Native fruit = {pomegranate, pitaya, cave _ banana}

AddIngredientValues (fruit, {fruit= 1}, true)

From the top two lines to the last line where AddIngredientValues appear, the content between these two lines is the food property we care about. These two lines mean:

Fruit is defined as pomegranate, pitaya and banana (cave_banana), and the fruit degree of all foods in fruit is 1 (that is, fruit = 1).

take for example

AddIngredientValues({durian},{fruit= 1,monster= 1},true)

This line says durian has 1 fruit degree (fruit = 1) and 1 monster degree (monster = 1).

A line of code starting with "-"is a comment, which does not affect the game, such as:

- AddIngredientValues({seeds},{seed= 1},true)

This line is annotated, so it has nothing to do with the game. As can be seen from this line, the producer originally wanted to put the seeds into the pot, but later gave up for some reasons.

This explains how to read files. What these degrees do depends on the next document: preparedfoods.lua

In the same location, we found the file preparedfoods.lua, which was also opened with notepad. This document is relatively clear, and all the recipes we want are in braces after local food. Besides all the new dishes of SW, it also includes meatballs and so on.

Take this dish as an example: butterflymuffin, Chinese translation is probably butterfly cake, butterfly muffin and so on, anyway, it is the dish with butterflies, which is one of the original dishes.

Butterfly muffin =

{

Test = function(cooker, names, tags) returns names. butterfly wings and nottags. meat and tags. vegieend,

Priority = 1,

Weight = 1,

foodtype = VEGGIE,

Health = tuning. HEALING_MED,

Hunger = tuning. Calories _ large,

Perishtime = adjustment. Death _ slow,

Sound = adjustment. Reason _ tiny,

Cooking time = 2,

}

In the test line, return the contents after and before the end (name. Butterfly wings, not labels. Meat and labels. Veggie) is a composition formula. This formula means that butterfly wings are needed, but meat (not tags.meat) and vegetables (tags.veggie) are not needed. Each sum is separated by two requirements. No doesn't mean it can't be. Note that Not takes precedence over and.

Explanation of the following lines:

Priority priority, if the ingredients are suitable for cooking more than two dishes, choose the one with higher priority. If the priorities are the same, the results are random and each result has the same possibility.

Weight. Weight? I don't understand, but only butterflymuffin has this attribute, which is not the focus of attention.

The type of food determines the kind of cooking results, which should be used to judge whether Viking women can eat this kind of food.

Skip four lines and cooktime decides the cooking time.

Back to the front, health determines the amount of blood recovered, hunger determines satiety, death determines the decay time, and reason determines the amount of SAN recovered. But it is not clearly written, which requires us to find the third file: tuning.lua.

Also in this folder, open tuning.lua

For example, we see the line health = TUNING. Before HEALING_MED. If we want to know. HEALING_MED is yes, we will search for "HEALING_MED" in tuning.lua at this time. So we found this line:

HEALING_MED = 20,

It is obvious that butterflymuffin has the characteristic of enriching blood by 20 points. The following SAN values reply similarly.

The performance of satiety is slightly more complicated:

Search calories _ big, I found it.

Calories _ Large = Calories _ Daily /2,-Cooked meat

Explain that its satiety recovery is half of the calorie _per_day (remember that the "-"is followed by comments, don't worry about it).

What are the daily calories? Search again and you will find:

Local daily calories = 75

This is very simple, 75/2=37.5, which means the recovery of satiety.

Decay time:

Death _ slow = 15 * total _ day _ time * death _ classics,

That is the decay of 15 days, and the others are similar.

Now go back to preparedfoods.lua, and then select some recipes to continue to explain the formula calculation method and some rare dish attributes.

Frog leg sandwich:

frogglebunwich =

{

Test = function(cooker, names, tags) return (names.froglegs or names.froglegs_cooked) and tags.veggie end,

Priority = 1,

Food type = meat,

Health = tuning. HEALING_MED,

Hunger = tuning. Calories _ large,

Perishtime = adjustment. Death _ slow,

Sound = adjustment. Reason _ tiny,

Cooking time = 2,

},

There is an or in this formula, which means to eat at least one of raw frog legs or cooked frog legs. The whole recipe consists of frog legs (raw or cooked) and vegetables (tags.veggie). Operation priority: notandor, here, in order to calculate or first, everything on both sides of or is enclosed in brackets.