DayZ 1.24
Loading...
Searching...
No Matches
ActionLightItemOnFire.c
Go to the documentation of this file.
21
27
29 {
30 return true;
31 }
32
33 // Removed as a fix for igniting Torch by Matchbox through drag&drop in inventory
34 /*override bool CanBePerformedFromInventory()
35 {
36 return true;
37 }*/
38
39 // Check if ignite candidate is in cargo of something or not.
41 {
42 if (item.GetInventory())
43 {
45 item.GetInventory().GetCurrentInventoryLocation(loc);
46
47 if (loc.GetIdx() > -1)
48 return true;
49 }
50
51 return false;
52 }
53
55 {
56 FireworksBase fireworks = FireworksBase.Cast(action_data.m_Target.GetObject());
57
58 if (fireworks)
59 {
60 return true;//something might begin occluding the item after the ignition began, we don't want that to cancel the ignition process, not the prettiest solution, but it works
61 }
62 else
63 return ActionCondition(action_data.m_Player, action_data.m_Target, action_data.m_MainItem);
64 }
65
66 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
67 {
68 ItemBase targetItem = ItemBase.Cast(target.GetObject());
69
70 if (targetItem && item)
71 {
72 // when igniting item on the ground with igniter in hands
73 if (!targetItem.IsIgnited() && !IsItemInCargoOfSomething(targetItem) && item.CanIgniteItem(targetItem) && targetItem.CanBeIgnitedBy(item))
74 {
75 // oven stage of standard fireplace
76 if (targetItem.IsKindOf("Fireplace"))
77 {
78 if (Fireplace.Cast(targetItem).IsOven())
79 return true;
80
81 if (Fireplace.CanIgniteEntityAsFireplace(targetItem))
82 return true;
83
84 return false;
85 }
86
87 return true;
88 }
89 // when igniting item in hands from something on ground
90 else if (!item.IsIgnited() && !IsItemInCargoOfSomething(item) && targetItem.CanIgniteItem(item) && item.CanBeIgnitedBy(targetItem))
91 return true;
92 }
93
94 return false;
95 }
96
98 {
99 ItemBase target_item = ItemBase.Cast(action_data.m_Target.GetObject());
100 ItemBase item = action_data.m_MainItem;
101
103 ItemBase ignited_item; //item that was lit on fire
104 ItemBase fire_source_item; //item that was the source of fire
105
106 if (item.CanIgniteItem(target_item))
107 {
108 is_ignition_successful = target_item.IsThisIgnitionSuccessful(item);
111 }
112 else if (item.CanBeIgnitedBy(target_item))
113 {
114 is_ignition_successful = target_item.IsTargetIgnitionSuccessful(item);
117 }
118
120 {
121 fire_source_item.OnIgnitedTarget(ignited_item);
122 ignited_item.OnIgnitedThis(fire_source_item);
123 }
124 else
125 {
126 fire_source_item.OnIgnitedTargetFailed(ignited_item);
127 ignited_item.OnIgnitedThisFailed(fire_source_item);
128 }
129 }
130
131 //setup
133 {
134 if (super.SetupAction(player, target, item, action_data, extra_data))
135 {
136 ItemBase target_item = ItemBase.Cast(target.GetObject());
137 if (target_item)
139
140 return true;
141 }
142
143 return false;
144 }
145
147 {
148 if (target_item.HasFlammableMaterial())
149 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_STARTFIRE;
150 else
151 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_CRAFTING;
152 }
153}
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
void CreateConditionComponents()
Definition ActionBase.c:196
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
Definition ActionBase.c:126
bool CanBePerformedFromQuickbar()
Definition ActionBase.c:269
int m_StanceMask
Definition ActionBase.c:53
bool IsItemInCargoOfSomething(ItemBase item)
void SetIgnitingAnimation(ItemBase target_item)
ActionLightItemOnFireCB ActionContinuousBaseCB ActionLightItemOnFire()
ActionData m_ActionData
void OnFinishProgressServer(ActionData action_data)
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void CreateActionComponent()
override bool ActionConditionContinue(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
InventoryLocation.
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
const float DEFAULT
const float FIREPLACE_IGNITE
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597