DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ CookWithEquipment()

int CookWithEquipment ( ItemBase cooking_equipment,
float cooking_time_coef = 1 )
protected

См. определение в файле Cooking.c строка 117

118 {
119 bool is_empty = true;
120
121 //check cooking conditions
122 if (cooking_equipment == null)
123 return 0;
124
125 if (cooking_equipment.IsRuined())
126 return 0;
127
128 //manage items in cooking equipment
129 Param2<bool, bool> stateFlags = new Param2<bool, bool>(false, false); // 1st - done; 2nd - burned
130 Param2<CookingMethodType, float> cookingMethodWithTime = GetCookingMethodWithTimeOverride(cooking_equipment);
131 if (cooking_time_coef != 1)
132 cookingMethodWithTime.param2 = cooking_time_coef;
133
134 //handle the cooking equipment/direct cooking first
135 ProcessItemToCook(cooking_equipment, cooking_equipment, cookingMethodWithTime, stateFlags);
136
137 //cooking method may have changed due to liquid evaporating, refresh..
138 if (cooking_equipment.IsCookware() && cooking_equipment.IsLiquidContainer())
139 {
140 cookingMethodWithTime = GetCookingMethodWithTimeOverride(cooking_equipment);
141 if (cooking_time_coef != 1)
142 cookingMethodWithTime.param2 = cooking_time_coef;
143 }
144
145 //handle the cooking inside of a container last
146 CargoBase cargo = cooking_equipment.GetInventory().GetCargo();
147 if (cargo)
148 {
149 int count = cargo.GetItemCount();
150 is_empty = count == 0;
151
152 //process items
153 for (int i = 0; i < count; i++)
154 {
155 ProcessItemToCook(ItemBase.Cast(cargo.GetItem(i)), cooking_equipment, cookingMethodWithTime, stateFlags);
156 }
157 }
158
159 //manage equipment EFFECTS
160 int liquidType = cooking_equipment.GetLiquidType();
161 //handle liquid boiling EFFECTS
162 if (cooking_equipment.IsLiquidContainer() && liquidType != LIQUID_NONE)
163 {
164 if (cooking_equipment.GetTemperature() >= Liquid.GetBoilThreshold(liquidType))
165 {
166 //handle boiling audiovisuals for any liquid container
167 cooking_equipment.RefreshAudioVisualsOnClient(cookingMethodWithTime.param1, stateFlags.param1, is_empty, stateFlags.param2);
168 }
169 else
170 {
171 cooking_equipment.RemoveAudioVisualsOnClient();
172 }
173 }
174 else if (cooking_equipment.IsCookware())
175 {
176 //handle non-boiling audiovisuals for cookware only
177 cooking_equipment.RefreshAudioVisualsOnClient(cookingMethodWithTime.param1, stateFlags.param1, is_empty, stateFlags.param2);
178 }
179
180 return 1;
181 }
void ProcessItemToCook(notnull ItemBase pItem, ItemBase cookingEquip, Param2< CookingMethodType, float > pCookingMethod, out Param2< bool, bool > pStateFlags)
Определения Cooking.c:44
Param2< CookingMethodType, float > GetCookingMethodWithTimeOverride(ItemBase cooking_equipment)
Определения Cooking.c:430
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
represents base for cargo storage for entities
Определения Cargo.c:7
Определения InventoryItem.c:731
Определения PPEConstants.c:68
const int LIQUID_NONE
Определения constants.c:527

Перекрестные ссылки GetCookingMethodWithTimeOverride(), CargoBase::GetItem(), CargoBase::GetItemCount(), LIQUID_NONE и ProcessItemToCook().