Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionconsume.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousQuantityEdible(UAQuantityConsumed.DEFAULT, UATimeSpent.DEFAULT);
6  }
7 };
8 
10 {
11  void ActionConsume()
12  {
13  m_CallbackClass = ActionConsumeCB;
14  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_EAT;
15  m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_EAT;
16 
17  m_Text = "#eat";
18  }
19 
20  override bool HasProneException()
21  {
22  return true;
23  }
24 
25  override bool HasTarget()
26  {
27  return false;
28  }
29 
30  override void CreateConditionComponents()
31  {
33  m_ConditionTarget = new CCTSelf();
34  }
35 
36  override void OnEndServer(ActionData action_data)
37  {
38  ItemBase item = action_data.m_MainItem;
39 
40  if (item && item.GetQuantity() <= 0.01)
41  {
42  item.SetQuantity(0);
43  }
44  else if (item && GetProgress(action_data) > 0)
45  {
46  // we don't want to inject an agent into an empty container
47  PlayerBase player = action_data.m_Player;
48  PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
49  plugin.TransmitAgents(player, item, AGT_UACTION_TO_ITEM);
50  }
51  }
52 };
ItemBase
Definition: inventoryitem.c:730
GetProgress
float GetProgress(ActionData action_data)
Definition: actionbase.c:1061
UAQuantityConsumed
Definition: actionconstants.c:3
AGT_UACTION_TO_ITEM
const int AGT_UACTION_TO_ITEM
Definition: constants.c:474
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition: pluginmanager.c:316
ActionConsume
Definition: actionconsume.c:9
PlayerBase
Definition: playerbaseclient.c:1
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
ActionConsumeCB
Definition: actionconsume.c:1
CCTSelf
Definition: cctself.c:1
CAContinuousQuantityEdible
Definition: cacontinuousquantityedible.c:1
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
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