Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
disinfectantspray.c
Go to the documentation of this file.
1 class DisinfectantSpray extends Edible_Base
2 {
3 
4  override void InitItemVariables()
5  {
6  super.InitItemVariables();
8  }
9 
10  override bool CanPutAsAttachment( EntityAI parent )
11  {
12  if(!super.CanPutAsAttachment(parent)) {return false;}
13  const int SLOTS_ARRAY = 8;
14  bool is_barrel = false;
15  bool is_opened_barrel = false;
16  bool slot_test = true;
17  string slot_names[SLOTS_ARRAY] = { "BerryR", "BerryB", "Plant", "Nails", "OakBark", "BirchBark", "Lime", "Guts" };
18 
19 
20  // is barrel
21  if ( parent.IsKindOf("Barrel_ColorBase") )
22  {
23  is_barrel = true;
24  }
25 
26  // is opened barrel
27  if ( is_barrel && parent.GetAnimationPhase("Lid") == 1 )
28  {
29  is_opened_barrel = true;
30  }
31 
32  // all of the barrel slots are empty
33  for ( int i = 0; i < SLOTS_ARRAY ; i++ )
34  {
35  if ( parent.FindAttachmentBySlotName(slot_names[i]) != NULL )
36  {
37  slot_test = false;
38  break;
39  }
40  }
41 
42  if ( ( is_opened_barrel && slot_test ) || !is_barrel )
43  {
44  return true;
45  }
46  return false;
47  }
48 
49  override bool CanDetachAttachment( EntityAI parent )
50  {
51 
52  bool is_barrel = false;
53  bool is_opened_barrel = false;
54 
55  // is barrel
56  if ( parent.IsKindOf("Barrel_ColorBase") )
57  {
58  is_barrel = true;
59  }
60 
61  // is opened barrel
62  if ( is_barrel && parent.GetAnimationPhase("Lid") == 1 )
63  {
64  is_opened_barrel = true;
65  }
66 
67  if ( is_opened_barrel || !is_barrel )
68  {
69  return true;
70  }
71  return false;
72  }
73 
74  override float GetDisinfectQuantity(int system = 0, Param param1 = null)
75  {
76  return (GetQuantityMax() * 0.15);
77  }
78 
79  override void SetActions()
80  {
81  super.SetActions();
82 
87  //AddAction(ActionForceDrinkDisinfectant);
88  //AddAction(ActionDrinkDisinfectant);
89 
90 
91 
92  }
93 }
GetDisinfectQuantity
float GetDisinfectQuantity(int system=0, Param param1=null)
Definition: itembase.c:662
can_this_be_combined
bool can_this_be_combined
Definition: itembase.c:62
Param
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition: param.c:11
ActionDisinfectTarget
Definition: actiondisinfecttarget.c:10
CanPutAsAttachment
override bool CanPutAsAttachment(EntityAI parent)
Definition: itembase.c:4021
ActionDisinfectPlant
Definition: actiondisinfectplant.c:9
GetQuantityMax
override int GetQuantityMax()
Definition: itembase.c:3262
InitItemVariables
void InitItemVariables()
Definition: itembase.c:182
ActionWashHandsItemContinuous
Definition: actionwashhandsitemcontinuous.c:9
AddAction
void AddAction(typename actionName)
Definition: advancedcommunication.c:86
SetActions
void SetActions()
Definition: advancedcommunication.c:79
ActionDisinfectSelf
void ActionDisinfectSelf()
Definition: actiondisinfectself.c:24
EntityAI
Definition: building.c:5
Edible_Base
Definition: bearsteakmeat.c:1