Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actiondrinkpondcontinuous.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousRepeat(UATimeSpent.DRINK_POND);
6  }
7 }
8 
10 {
11  private const float WATER_DRANK_PER_SEC = 35;
12  protected const string ALLOWED_WATER_SURFACES = string.Format("%1|%2", UAWaterType.FRESH, UAWaterType.STILL);
13 
15  {
16  m_CallbackClass = ActionDrinkPondContinuousCB;
17  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_DRINKPOND;
18  m_FullBody = true;
19  m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
20  m_Text = "#drink";
21  }
22 
23  override bool IsDrink()
24  {
25  return true;
26  }
27 
28  override typename GetInputType()
29  {
31  }
32 
33  override void CreateConditionComponents()
34  {
35  m_ConditionItem = new CCINone();
37  }
38 
39  override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
40  {
41  if (item && item.IsHeavyBehaviour())
42  return false;
43 
44  return player.CanEatAndDrink();
45  }
46 
47  override void OnStart(ActionData action_data)
48  {
49  super.OnStart(action_data);
50 
51  action_data.m_Player.TryHideItemInHands(true);
52  }
53 
54  override void OnEnd(ActionData action_data)
55  {
56  action_data.m_Player.TryHideItemInHands(false);
57  }
58 
59  override void OnFinishProgressServer(ActionData action_data)
60  {
61  Param1<float> nacdata = Param1<float>.Cast(action_data.m_ActionComponent.GetACData());
62  float amount = UAQuantityConsumed.DRINK;
63  action_data.m_Player.Consume(null, amount, EConsumeType.ENVIRO_POND);
64  }
65 
66  override void OnEndAnimationLoopServer(ActionData action_data)
67  {
68  if (action_data.m_Player.HasBloodyHands() && !action_data.m_Player.GetInventory().FindAttachment(InventorySlots.GLOVES))
69  {
70  action_data.m_Player.SetBloodyHandsPenalty();
71  }
72  }
73 
74  override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
75  {
76  super.WriteToContext(ctx, action_data);
77 
78  if (HasTarget())
79  {
80  ctx.Write(action_data.m_Target.GetCursorHitPos());
81  return;
82  }
83 
84  ctx.Write(vector.Zero);
85  }
86 
87  override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
88  {
89  super.ReadFromContext(ctx, action_recive_data);
90 
91  if (HasTarget())
92  {
93  vector cursorPosition;
94  if (!ctx.Read(cursorPosition))
95  return false;
96 
97  action_recive_data.m_Target.SetCursorHitPos(cursorPosition);
98  }
99 
100  return true;
101  }
102 }
OnEnd
override void OnEnd(ActionData action_data)
Definition: actiondrinkpondcontinuous.c:54
ItemBase
Definition: inventoryitem.c:730
OnStart
override void OnStart(ActionData action_data)
Definition: actiondrinkpondcontinuous.c:47
CreateConditionComponents
override void CreateConditionComponents()
Definition: actiondrinkpondcontinuous.c:33
CAContinuousRepeat
Definition: cacontinuousrepeat.c:1
InventorySlots
provides access to slot configuration
Definition: inventoryslots.c:5
ContinuousInteractActionInput
Definition: actioninput.c:521
ActionDrinkPondContinuousCB
Definition: actiondrinkpondcontinuous.c:1
CCTWaterSurface
Definition: cctwatersurface.c:1
CCINone
Definition: ccinone.c:1
UAQuantityConsumed
Definition: actionconstants.c:3
ReadFromContext
override bool ReadFromContext(ParamsReadContext ctx, out ActionReciveData action_recive_data)
Definition: actiondrinkpondcontinuous.c:87
WATER_DRANK_PER_SEC
ActionDrinkPondContinuousCB WATER_DRANK_PER_SEC
UAWaterType
Definition: actionconstants.c:144
UAMaxDistances
Definition: actionconstants.c:104
HasTarget
bool HasTarget()
Definition: actionbase.c:232
Serializer
Serialization general interface. Serializer API works with:
Definition: serializer.c:55
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
EConsumeType
EConsumeType
Definition: econsumetype.c:1
PlayerBase
Definition: playerbaseclient.c:1
vector
Definition: enconvert.c:105
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
GetInputType
override GetInputType()
Definition: actiondrinkpondcontinuous.c:28
WriteToContext
override void WriteToContext(ParamsWriteContext ctx, ActionData action_data)
Definition: actiondrinkpondcontinuous.c:74
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
IsDrink
override bool IsDrink()
Definition: actiondrinkpondcontinuous.c:23
OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition: actiondrinkpondcontinuous.c:59
OnEndAnimationLoopServer
override void OnEndAnimationLoopServer(ActionData action_data)
Definition: actiondrinkpondcontinuous.c:66
ALLOWED_WATER_SURFACES
const protected string ALLOWED_WATER_SURFACES
Definition: actiondrinkpondcontinuous.c:12
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
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
ActionDrinkPondContinuous
void ActionDrinkPondContinuous()
Definition: actiondrinkpondcontinuous.c:14
ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition: actiondrinkpondcontinuous.c:39