Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
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 {
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}
void OnUpdateServer(float deltatime, float blood_scale, bool no_blood_loss)
override void OnFinishProgressServer(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnEndServer(ActionData action_data)
override void OnExecuteServer(ActionData action_data)
bool IsItemInCargoOfSomething(ItemBase item)
ActionLightItemOnFireCB ActionContinuousBaseCB ActionLightItemOnFire()
ActionLightItemOnFireWithBlowtorchCB ActionLightItemOnFireCB ActionLightItemOnFireWithBlowtorch()
void Interrupt()
ActionData m_ActionData
override bool IsIgnited()
Definition blowtorch.c:76
const int UA_PROCESSING
Definition constants.c:464