DayZ 1.24
Loading...
Searching...
No Matches
OpenItem.c
Go to the documentation of this file.
2{
5 {
7
8 if (item_tool.ConfigIsExisting("OpenItemSpillRange"))
9 item_tool.ConfigGetIntArray("OpenItemSpillRange", spill_range);
10 else
11 {
12 Debug.LogError("OpenItemSpillRange config parameter missing, default values used ! ");
13 Error("OpenItemSpillRange config parameter missing, default values used !");
14 spill_range.Insert(0);
15 spill_range.Insert(100);
16 }
18
20 }
21
24 {
25 string old_name = old_item.GetType();
26 string new_name = old_name + "_Opened";
28 l.SetTransferParams(true, true, true, true);
29 MiscGameplayFunctions.TurnItemIntoItemEx(player, l);
30 }
31};
32
33
35{
39
41 {
42 super.CopyOldPropertiesToNew(old_item, new_item);
43 }
44
46 {
47 super.OnSuccess(new_item);
48
50 if (new_item)
51 {
52 float quantity_old = ib.GetQuantity();
54 spill_amount = m_Player.GetSoftSkillsManager().SubtractSpecialtyBonus(spill_amount, m_SpecialtyWeight);
56
57 Debug.Log("quantity before spill: " + quantity_old.ToString());
58 Debug.Log("spill_amount: " + spill_amount.ToString());
59 Debug.Log("quantity_new: " + quantity_new.ToString());
60
61 ib.SetQuantity(quantity_new);
62 }
63 }
64};
65
DayZPlayer m_Player
Definition Hand_Events.c:42
Definition Debug.c:14
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Definition Debug.c:341
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
void OpenAndSwitchLambda(EntityAI old_item, string new_item_type, PlayerBase player, float spill_modificator, float specialty_weight)
Definition OpenItem.c:38
float m_SpecialtyWeight
Definition OpenItem.c:37
override void OnSuccess(EntityAI new_item)
Definition OpenItem.c:45
override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
Definition OpenItem.c:40
static void SwitchItems(EntityAI old_item, PlayerBase player, float spill_modificator, float specialty_weight)
Will switch the 'item' for a new game entity, the new entity's classname will be formed by adding the...
Definition OpenItem.c:23
static void OpenAndSwitch(ItemBase item_tool, ItemBase item_target, PlayerBase player, float specialty_weight=0)
WIll open the 'item_target' by spawning a new entity and transferring item variables to the new one.
Definition OpenItem.c:4
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54