Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actioncookonstick.c
Go to the documentation of this file.
2 {
3  private const float COOKING_ON_STICK_UPDATE_TIME = 1;
4 
5  override void CreateActionComponent()
6  {
7  m_ActionData.m_ActionComponent = new CAContinuousTimeCooking( COOKING_ON_STICK_UPDATE_TIME );
8  }
9 };
10 
12 {
13  void ActionCookOnStick()
14  {
15  m_CallbackClass = ActionCookOnStickCB;
16  m_CommandUID = DayZPlayerConstants.CMD_GESTUREFB_CAMPFIRE;
17  m_FullBody = true;
18  m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
20 
21  m_LockTargetOnUse = false;
22  m_Text = "#cook_on_stick";
23  }
24 
25  override void CreateConditionComponents()
26  {
29  }
30 
31  override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
32  {
33  FireplaceBase fireplace_target = FireplaceBase.Cast(target.GetObject());
34  Object targetObject = target.GetObject();
35  Edible_Base item_on_stick = Edible_Base.Cast(item.GetAttachmentByType(Edible_Base));
36  if (fireplace_target && fireplace_target.CanCookOnStick() && item_on_stick && item_on_stick.CanBeCookedOnStick())
37  {
38  //fireplace
39  if (fireplace_target.IsBaseFireplace())
40  {
41  Fireplace fireplace = Fireplace.Cast(fireplace_target);
42  if (!fireplace.IsOven() && fireplace_target.CanCookOnStick())
43  {
44  return true;
45  }
46  }
47 
48  //fireplace indoor
49  if (fireplace_target.IsFireplaceIndoor())
50  {
51  if (fireplace_target.CanCookOnStick())
52  {
53  return true;
54  }
55  }
56  }
57 
58  return false;
59  }
60 
61  override void OnEndServer(ActionData action_data)
62  {
63  super.OnEndServer(action_data);
64 
65  ItemBase stick = action_data.m_MainItem;
66  Edible_Base item_on_stick = Edible_Base.Cast(stick.GetAttachmentByType(Edible_Base));
67 
68  if (item_on_stick)
69  {
70  item_on_stick.MakeSoundsOnClient(false);
71  }
72  }
73 };
ItemBase
Definition: inventoryitem.c:730
CAContinuousTimeCooking
Definition: cacontinuoustimecooking.c:1
UASoftSkillsWeight
Definition: actionconstants.c:118
FireplaceBase
Definition: barrelholes_colorbase.c:1
UAMaxDistances
Definition: actionconstants.c:104
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
ActionCookOnStick
Definition: actioncookonstick.c:11
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
ActionCookOnStickCB
Definition: actioncookonstick.c:1
CCTNonRuined
Definition: cctnonruined.c:1
Object
Definition: objecttyped.c:1
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
m_LockTargetOnUse
protected bool m_LockTargetOnUse
Definition: actionbase.c:51
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
CCINonRuined
Definition: ccinonruined.c:1
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
Edible_Base
Definition: bearsteakmeat.c:1