Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
smallguts.c
Go to the documentation of this file.
1 class SmallGuts extends Edible_Base
2 {
3  override bool CanPutAsAttachment( EntityAI parent )
4  {
5  if(!super.CanPutAsAttachment(parent)) {return false;}
6  const int SLOTS_ARRAY = 8;
7  bool is_barrel = false;
8  bool is_opened_barrel = false;
9  bool slot_test = true;
10  string slot_names[SLOTS_ARRAY] = { "BerryR", "BerryB", "Nails", "OakBark", "BirchBark", "Lime", "Disinfectant" };
11 
12 
13  // is barrel
14  if ( parent.IsKindOf("Barrel_ColorBase") )
15  {
16  is_barrel = true;
17  }
18 
19  // is opened barrel
20  if ( is_barrel && parent.GetAnimationPhase("Lid") == 1 )
21  {
22  is_opened_barrel = true;
23  }
24 
25  // all of the barrel slots are empty
26  for ( int i = 0; i < SLOTS_ARRAY ; i++ )
27  {
28  if ( parent.FindAttachmentBySlotName(slot_names[i]) != NULL )
29  {
30  slot_test = false;
31  break;
32  }
33  }
34 
35  if ( ( is_opened_barrel && slot_test ) || !is_barrel )
36  {
37  return true;
38  }
39  return false;
40  }
41 
42  override bool CanDetachAttachment( EntityAI parent )
43  {
44 
45  bool is_barrel = false;
46  bool is_opened_barrel = false;
47 
48  // is barrel
49  if ( parent.IsKindOf("Barrel_ColorBase") )
50  {
51  is_barrel = true;
52  }
53 
54  // is opened barrel
55  if ( is_barrel && parent.GetAnimationPhase("Lid") == 1 )
56  {
57  is_opened_barrel = true;
58  }
59 
60  if ( is_opened_barrel || !is_barrel )
61  {
62  return true;
63  }
64  return false;
65  }
66 
67  override void SetActions()
68  {
69  super.SetActions();
70 
73  }
74 }
CanPutAsAttachment
override bool CanPutAsAttachment(EntityAI parent)
Definition: itembase.c:4021
ActionEatBig
Definition: actioneat.c:9
AddAction
void AddAction(typename actionName)
Definition: advancedcommunication.c:86
SetActions
void SetActions()
Definition: advancedcommunication.c:79
ActionForceFeed
ActionForceFeedSmallCB ActionForceFeed
Definition: actionforcefeed.c:11
EntityAI
Definition: building.c:5
Edible_Base
Definition: bearsteakmeat.c:1