DayZ 1.24
Loading...
Searching...
No Matches
CutOutSeeds.c
Go to the documentation of this file.
1class CutOutSeeds extends RecipeBase
2{
3 override void Init()
4 {
5
6 }
7
8 override bool CanDo(ItemBase ingredients[], PlayerBase player)//final check for recipe's validity
9 {
10 return true;
11 }
12
13 override void Do(ItemBase ingredients[], PlayerBase player, array<ItemBase> results, float specialty_weight)//gets called upon recipe's completion
14 {
15 // Adjusts quantity of results to the quantity of the 1st ingredient
17
18 float MaxQuantity = item_ingredient.GetQuantityMax();
19 float CurrentQuantity = item_ingredient.GetQuantity();
21
22 FoodStageType stage = item_ingredient.GetFoodStageType();
23
24 float seedMultiplier = Math.RandomFloat(0.5, 1);
25
26 //Set seeds amount proportional to ingredient quantity. No seeds if the is less that 30% of ingredient
27 if (qtPercentage < 0.3)
29 else
31
32 //Set seeds amount based on the stage of the ingredient
33 switch (stage)
34 {
35 case FoodStageType.BURNED:
36 case FoodStageType.BOILED:
37 case FoodStageType.BAKED:
38 seedMultiplier *= 0;
39 break;
40 case FoodStageType.DRIED:
41 case FoodStageType.ROTTEN:
42 seedMultiplier *= 0.5;
43 break;
44 case FoodStageType.RAW:
45 default:
46 seedMultiplier *= 1;
47 break;
48 }
49
51 float maxQuantity = result.GetQuantityMax();
52 float resultQty = m_ResultSetQuantity[0] / maxQuantity;
54
56
57 result.SetQuantity(resultQty);
58
59 Debug.Log("Recipe Do method called", "recipes");
60 }
61};
FoodStageType
Definition FoodStage.c:2
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133
Definition EnMath.c:7
override bool CanDo(ItemBase ingredients[], PlayerBase player)
Definition CutOutSeeds.c:8
override void Do(ItemBase ingredients[], PlayerBase player, array< ItemBase > results, float specialty_weight)
Definition CutOutSeeds.c:13
override void Init()
Definition CutOutSeeds.c:3
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static proto float Ceil(float f)
Returns ceil of value.