Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionconsumesingle.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CASingleUseQuantityEdible(UAQuantityConsumed.DEFAULT);
6  }
7 };
8 
10 {
11  const int DEFAULT_CONSUMED_QUANTITY = 1;
12 
13  void ActionConsumeSingle()
14  {
15  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_LICKBATTERY;
16  m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_LICKBATTERY;
17 
18  m_Text = "#eat";
19  }
20 
21  int GetConsumedQuantity()
22  {
24  }
25 
26  override bool HasProneException()
27  {
28  return true;
29  }
30 
31  override bool HasTarget()
32  {
33  return false;
34  }
35 
36  override void CreateConditionComponents()
37  {
39  m_ConditionTarget = new CCTSelf();
40  }
41 
42  override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
43  {
44  return super.ActionCondition(player, target, item) && player.CanEatAndDrink();
45  }
46 
47  override void OnExecuteServer(ActionData action_data)
48  {
49  PlayerBase player = action_data.m_Player;
50 
51  if (player && action_data.m_MainItem)
52  player.Consume(action_data.m_MainItem, GetConsumedQuantity(), EConsumeType.ITEM_SINGLE_TIME);
53  }
54 
55  override void OnEndServer(ActionData action_data)
56  {
57  if (action_data.m_MainItem && (action_data.m_MainItem.GetQuantity() <= 0))
58  action_data.m_MainItem.SetQuantity(0);
59 
60  if (action_data.m_Player.HasBloodyHandsEx() == eBloodyHandsTypes.SALMONELA && !action_data.m_Player.GetInventory().FindAttachment(InventorySlots.GLOVES) && GetProgress(action_data) > 0)
61  action_data.m_Player.SetBloodyHandsPenalty();
62  }
63 }
ItemBase
Definition: inventoryitem.c:730
GetProgress
float GetProgress(ActionData action_data)
Definition: actionbase.c:1061
CASingleUseQuantityEdible
Definition: casingleusequantityedible.c:1
InventorySlots
provides access to slot configuration
Definition: inventoryslots.c:5
eBloodyHandsTypes
eBloodyHandsTypes
Definition: pluginlifespan.c:8
UAQuantityConsumed
Definition: actionconstants.c:3
ActionConsumeSingle
Definition: actionconsumesingle.c:9
DEFAULT_CONSUMED_QUANTITY
ActionForceConsumeSingleCB DEFAULT_CONSUMED_QUANTITY
ActionSingleUseBaseCB
Definition: actionsingleusebase.c:1
EConsumeType
EConsumeType
Definition: econsumetype.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
CCTSelf
Definition: cctself.c:1
CCINotRuinedAndEmpty
Definition: ccinotruinedandempty.c:1
ActionConsumeSingleCB
Definition: actionconsumesingle.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49
ActionSingleUseBase
Definition: actionsingleusebase.c:41
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56