67 m_Name =
"RecipeBase default name";
101 if (item1 == NULL || item2 == NULL)
return false;
111 for (
int x = 0;
x < tempArray.Count();
x++)
118 if (tempArray.Get(
x) == item.GetType() ||
GetGame().IsKindOf(item.GetType(),tempArray.Get(
x)))
130 if (!found)
return false;
151 ptr.Insert(ingredient);
162 for (
int i = 0; i < ptr.Count(); i++)
164 if (ptr[i] == ingredient)
193 spawned_objects.Clear();
203 string color = item.ConfigGetString(
"color");
205 item_to_spawn = new_class_name;
218 object = player.GetInventory().CreateInInventory(item_to_spawn);
236 Error(
"failed to spawn entity "+item_to_spawn+
" , make sure the classname exists and item can be spawned");
238 spawned_objects.Insert(
ItemBase.Cast(
object));
246 float all_ingredients_health = 0;
247 float all_ingredients_health01 = 0;
252 all_ingredients_health += ingrd.GetHealth(
"",
"");
253 all_ingredients_health01 += ingrd.GetHealth01(
"",
"");
264 if (res.IsItemBase())
270 if (!resIb.IsMagazine())
274 resIb.SetQuantityMax();
276 else if (value_delta != -1)
283 Magazine mgzn = Magazine.Cast(resIb);
286 mgzn.ServerSetAmmoMax();
288 else if (value_delta != -1)
290 mgzn.ServerSetAmmoCount(value_delta);
297 res.SetHealth(
"",
"",value_delta);
308 float ing_health01 = ing.GetHealth01(
"",
"");
309 res.SetHealth(
"",
"", ing_health01 * res.GetMaxHealth(
"",
""));
316 res.SetHealth(
"",
"", average_health01 * res.GetMaxHealth(
"",
""));
329 MiscGameplayFunctions.TransferItemProperties(ingr, res);
330 MiscGameplayFunctions.TransferInventory(ingr, res, player);
365 ingredient.AddHealth(
"",
"",health_delta);
370 ingredient.SetHealth(
"",
"",new_health);
376 if (!ingredient.IsMagazine())
379 bool isDestroyed = obj.AddQuantity(quantity_delta,
true);
387 Magazine mag = Magazine.Cast(ingredient);
388 int newQuantity = mag.GetAmmoCount() + quantity_delta;
389 if (newQuantity <= 0)
396 mag.ServerSetAmmoCount(newQuantity);
410 if (!ingredient.IsMagazine())
425 Magazine mag1 = Magazine.Cast(ingredient);
437 int dmg3 = ingredient.GetHealthLevel();
440 int dmg = ingredient.GetHealthLevel();
446 int dmg2 = ingredient.GetHealthLevel();
457 if (item1 == NULL || item2 == NULL)
459 Error(
"recipe invalid, at least one of the ingredients is NULL");
463 ItemBase item_in_hand = player.GetItemInHands();
465 if (!
IsRecipeAnywhere() && (item1 != item_in_hand && item2 != item_in_hand))
492 if (item1 == NULL || item2 == NULL)
494 Error(
"CheckRecipe: recipe invalid, at least one of the ingredients is NULL");
509 if (item1 == NULL || item2 == NULL)
511 Error(
"PerformRecipe: recipe invalid, at least one of the ingredients is NULL");
512 Debug.
Log(
"PerformRecipe: at least one of the ingredients is NULL",
"recipes");
529 Debug.
Log(
"CheckRecipe failed on server",
"recipes");
542 if (ingredients[i].GetInventory() && ingredients[i].GetInventory().AttachmentCount() > 0)
571 for (
int x = 0;
x < ptr.Count();
x++)
573 items.Insert(ptr.Get(
x));
580 string itemType = item.GetType();
583 for (
int x = 0;
x < ptr.Count();
x++)
585 if (
GetGame().IsKindOf(itemType, ptr.Get(
x)))
599 for (
int x = 0;
x < ptr.Count();
x++)
601 if (ptr.Get(
x) == item)
return true;
616 for (
int x = 0;
x < ptr.Count();
x++)
618 if (ptr.Get(
x) == item)
const float DEFAULT_SPAWN_DISTANCE
const int MAXIMUM_RESULTS
const int MAX_NUMBER_OF_INGREDIENTS
ScriptConsoleEnfScriptTab ScriptConsoleTabBase OnSelected()
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.
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
string m_ItemsToCreate[MAXIMUM_RESULTS]
void InsertIngredientEx(int index, string ingredient, string soundCategory, DayZPlayerConstants uid=DayZPlayerConstants.CMD_ACTIONFB_CRAFTING)
bool m_IngredientDestroy[MAX_NUMBER_OF_INGREDIENTS]
void SpawnItems(ItemBase ingredients[], PlayerBase player, array< ItemBase > spawned_objects)
int m_ResultToInventory[MAXIMUM_RESULTS]
void SetAnimation(DayZPlayerConstants uid)
bool CheckIngredientMatch(ItemBase item1, ItemBase item2)
bool m_IngredientUseSoftSkills[MAX_NUMBER_OF_INGREDIENTS]
float m_ResultSetHealth[MAXIMUM_RESULTS]
void DeleleIngredientsPass()
float m_ResultSetQuantity[MAXIMUM_RESULTS]
int GetAnimationCommandUID()
void Do(ItemBase ingredients[], PlayerBase player, array< ItemBase > results, float specialty_weight)
bool m_ResultSetFullQuantity[MAXIMUM_RESULTS]
bool CanDo(ItemBase ingredients[], PlayerBase player)
bool IsItemInRecipe(string item)
ref array< string > m_SoundCategories[MAX_NUMBER_OF_INGREDIENTS]
void OnSelected(ItemBase item1, ItemBase item2, PlayerBase player)
string GetSoundCategory(int ingredientIndex, ItemBase item)
ref array< int > m_AnimationUIDs
ref array< string > m_Ingredients[MAX_NUMBER_OF_INGREDIENTS]
int GetIngredientMaskForItem(string item)
returns a mask which marks ingredient positions for a given item in this recipe(for example mask of v...
float m_ResultSpawnDistance[MAXIMUM_RESULTS]
void AddResult(string item)
bool m_ResultUseSoftSkills[MAXIMUM_RESULTS]
ItemBase m_Items[MAX_NUMBER_OF_INGREDIENTS]
ItemBase m_IngredientsSorted[MAX_NUMBER_OF_INGREDIENTS]
void ApplyModificationsIngredients(ItemBase sorted[], PlayerBase player)
int m_ResultReplacesIngredient[MAXIMUM_RESULTS]
void ApplySoftSkillsSpecialty(PlayerBase player)
void OnSelectedRecipe(ItemBase item1, ItemBase item2, PlayerBase player)
float m_IngredientAddHealth[MAX_NUMBER_OF_INGREDIENTS]
bool CheckConditions(ItemBase sorted[])
float m_IngredientSetHealth[MAX_NUMBER_OF_INGREDIENTS]
int m_ResultInheritsHealth[MAXIMUM_RESULTS]
void PerformRecipe(ItemBase item1, ItemBase item2, PlayerBase player)
float m_MinQuantityIngredient[MAX_NUMBER_OF_INGREDIENTS]
void ApplyModificationsResults(ItemBase sorted[], array< ItemBase > results, ItemBase result, PlayerBase player)
int m_ResultInheritsColor[MAXIMUM_RESULTS]
float m_MaxQuantityIngredient[MAX_NUMBER_OF_INGREDIENTS]
float m_IngredientAddQuantity[MAX_NUMBER_OF_INGREDIENTS]
float m_MinDamageIngredient[MAX_NUMBER_OF_INGREDIENTS]
void RemoveIngredient(int index, string ingredient)
void GetAllItems(array< string > items)
float m_MaxDamageIngredient[MAX_NUMBER_OF_INGREDIENTS]
void CheckIngredientAnimOverride()
bool m_AnywhereInInventory
void InsertIngredient(int index, string ingredient, DayZPlayerConstants uid=DayZPlayerConstants.CMD_ACTIONFB_CRAFTING)
bool CheckRecipe(ItemBase item1, ItemBase item2, PlayerBase player)
ref array< ItemBase > m_IngredientsToBeDeleted
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerConstants
defined in C++
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
const float CRAFTING_TIME_UNIT_SIZE
static proto float Pow(float v, float power)
Return power of v ^ power.