Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionlightitemonfirewithblowtorch.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.FIREPLACE_IGNITE);
6  }
7 }
8 
10 {
12  {
13  m_CallbackClass = ActionLightItemOnFireWithBlowtorchCB;
14  }
15 
16  override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
17  {
18  Blowtorch bt = Blowtorch.Cast(item);
19  if (!bt.HasEnoughEnergyForRepair(UATimeSpent.FIREPLACE_IGNITE))
20  {
21  return false;
22  }
23 
24  ItemBase target_item = ItemBase.Cast(target.GetObject());
25  if (target_item && item)
26  {
27  // when igniting item on the ground with igniter in hands
28  if (!target_item.IsIgnited() && !IsItemInCargoOfSomething(target_item) && target_item.CanBeIgnitedBy(item))
29  {
30  // oven stage of standard fireplace
31  if (target_item.IsKindOf("Fireplace"))
32  {
33  if (Fireplace.Cast(target_item).IsOven())
34  {
35  return true;
36  }
37 
38  if (Fireplace.CanIgniteEntityAsFireplace(target_item))
39  {
40  return true;
41  }
42 
43  return false;
44  }
45 
46  return true;
47  }
48  // when igniting item in hands from something on ground
49  else if (!item.IsIgnited() && !IsItemInCargoOfSomething(item) && target_item.CanIgniteItem(item) && item.CanBeIgnitedBy(target_item))
50  {
51  return true;
52  }
53  }
54 
55  return false;
56  }
57 
58  override void OnUpdateServer(ActionData action_data)
59  {
60  super.OnUpdate(action_data);
61 
62  if (action_data.m_State == UA_PROCESSING && !action_data.m_MainItem.GetCompEM().IsWorking())
63  {
64  Interrupt(action_data);
65  }
66  }
67 
68  override void OnExecuteServer(ActionData action_data)
69  {
70  super.OnExecuteServer(action_data);
71 
72  action_data.m_MainItem.GetCompEM().SwitchOn();
73  }
74 
75  override void OnFinishProgressServer(ActionData action_data)
76  {
77  super.OnFinishProgressServer(action_data);
78 
79  action_data.m_MainItem.GetCompEM().SwitchOff();
80  }
81 
82  override void OnEndServer(ActionData action_data)
83  {
84  super.OnEndServer(action_data);
85 
86  action_data.m_MainItem.GetCompEM().SwitchOff();
87  }
88 }
ItemBase
Definition: inventoryitem.c:730
ActionLightItemOnFireWithBlowtorch
ActionLightItemOnFireWithBlowtorchCB ActionLightItemOnFireCB ActionLightItemOnFireWithBlowtorch()
Definition: actionlightitemonfirewithblowtorch.c:11
CAContinuousTime
Definition: cacontinuoustime.c:1
ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition: actionlightitemonfirewithblowtorch.c:16
OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition: actionlightitemonfirewithblowtorch.c:75
IsItemInCargoOfSomething
bool IsItemInCargoOfSomething(ItemBase item)
Definition: actionlightitemonfire.c:40
ActionLightItemOnFireWithBlowtorchCB
Definition: actionlightitemonfirewithblowtorch.c:1
ActionLightItemOnFireCB
Definition: actionlightitemonfire.c:1
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
OnExecuteServer
override void OnExecuteServer(ActionData action_data)
Definition: actionlightitemonfirewithblowtorch.c:68
ActionLightItemOnFire
ActionLightItemOnFireCB ActionContinuousBaseCB ActionLightItemOnFire()
Definition: actionlightitemonfire.c:11
Interrupt
void Interrupt(ActionData action_data)
Definition: actionbase.c:616
OnEndServer
override void OnEndServer(ActionData action_data)
Definition: actionlightitemonfirewithblowtorch.c:82
UATimeSpent
Definition: actionconstants.c:26
UA_PROCESSING
const int UA_PROCESSING
Definition: constants.c:434
OnUpdateServer
override void OnUpdateServer(ActionData action_data)
Definition: actionlightitemonfirewithblowtorch.c:58