Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actiondisinfectplant.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousDisinfectPlant(UAQuantityConsumed.GARDEN_DISINFECT_PLANT);
6  }
7 };
8 
10 {
11  PlantBase m_Plant;
12 
14  {
15  m_CallbackClass = ActionDisinfectPlantCB;
17 
18  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_SPRAYPLANT;
19  //m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
20  m_FullBody = true;
21 
22  m_Text = "#apply";
23  }
24 
25  override void CreateConditionComponents()
26  {
29  }
30 
31  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
32  {
33  GardenBase garden_base;
34  if ( Class.CastTo(garden_base, target.GetObject()))
35  {
36  Slot slot;
37 
38  array<string> selections = new array<string>;
39  garden_base.GetActionComponentNameList(target.GetComponentIndex(), selections);
40  string selection;
41 
42  for (int s = 0; s < selections.Count(); s++)
43  {
44  selection = selections[s];
45  slot = garden_base.GetSlotBySelection( selection );
46  if (slot)
47  break;
48  }
49 
50  if ( slot && slot.GetPlant() )
51  {
52  m_Plant = PlantBase.Cast(slot.GetPlant());
53  if ( m_Plant.IsGrowing() && m_Plant.NeedsSpraying() )
54  {
55  if ( m_Plant.GetPlantStateIndex() < 1 )
56  return false;
57 
58  if ( item.GetQuantity() > 0 )
59  {
60  return true;
61  }
62  }
63  }
64  }
65  return false;
66  /*PlantBase plant;
67  if ( Class.CastTo(plant, target.GetObject() ) && !item.IsDamageDestroyed() )
68  {
69  if ( plant.IsGrowing() && plant.NeedsSpraying() )
70  {
71  if ( item.GetQuantity() > 0 )
72  {
73  return true;
74  }
75  }
76  }
77 
78  return false;*/
79  }
80 
81  override void OnFinishProgressServer( ActionData action_data)
82  {
83  Object targetObject = action_data.m_Target.GetObject();
84  Param1<float> nacdata = Param1<float>.Cast( action_data.m_ActionComponent.GetACData() );
85  if (nacdata)
86  {
87  action_data.m_Player.GetSoftSkillsManager().AddSpecialty( m_SpecialtyWeight );
88  }
89  }
90 
91  override void OnFinishProgressClient( ActionData action_data)
92  {
93  Object targetObject = action_data.m_Target.GetObject();
94  Param1<float> nacdata = Param1<float>.Cast( action_data.m_ActionComponent.GetACData() );
95  if (nacdata)
96  {
97  action_data.m_Player.GetSoftSkillsManager().AddSpecialty( m_SpecialtyWeight );
98  }
99  }
100 };
ItemBase
Definition: inventoryitem.c:730
ActionDisinfectPlantCB
Definition: actiondisinfectplant.c:1
UASoftSkillsWeight
Definition: actionconstants.c:118
UAQuantityConsumed
Definition: actionconstants.c:3
ActionDisinfectPlant
Definition: actiondisinfectplant.c:9
UAMaxDistances
Definition: actionconstants.c:104
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
CAContinuousDisinfectPlant
Definition: cacontinuousdisinfectplant.c:1
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
CCTNonRuined
Definition: cctnonruined.c:1
Object
Definition: objecttyped.c:1
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
array< string >
CCINotRuinedAndEmpty
Definition: ccinotruinedandempty.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionContinuousBase
Definition: actioncontinuousbase.c:132
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
GardenBase
Definition: gardenplot.c:1
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68