DayZ 1.24
Loading...
Searching...
No Matches
ActionLightItemOnFire.c File Reference

Go to the source code of this file.

Classes

class  ActionLightItemOnFireCB
 

Functions

ActionLightItemOnFireCB ActionContinuousBaseCB ActionLightItemOnFire ()
 
override void CreateActionComponent ()
 
override void CreateConditionComponents ()
 
override bool CanBePerformedFromQuickbar ()
 
bool IsItemInCargoOfSomething (ItemBase item)
 
override bool ActionConditionContinue (ActionData action_data)
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnFinishProgressServer (ActionData action_data)
 
override bool SetupAction (PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
 
void SetIgnitingAnimation (ItemBase target_item)
 

Function Documentation

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )

Definition at line 66 of file ActionLightItemOnFire.c.

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 }
bool IsItemInCargoOfSomething(ItemBase item)

References IsItemInCargoOfSomething().

◆ ActionConditionContinue()

override bool ActionConditionContinue ( ActionData action_data)

Definition at line 54 of file ActionLightItemOnFire.c.

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 }
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)

References AnimatedActionBase::ActionCondition().

◆ ActionLightItemOnFire()

Definition at line 1 of file ActionLightItemOnFire.c.

12 {
13 m_CallbackClass = ActionLightItemOnFireCB;
14 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_STARTFIRE;
15 m_FullBody = true;
16 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
17
19 m_Text = "#ignite";
20 }
bool m_FullBody
Definition ActionBase.c:52
string m_Text
Definition ActionBase.c:49
float m_SpecialtyWeight
Definition ActionBase.c:68
int m_StanceMask
Definition ActionBase.c:53
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

Referenced by ActionConstructor::RegisterActions(), SetActions(), ItemBase::SetActions(), Roadflare::SetActions(), and FlammableBase::SetActions().

◆ CanBePerformedFromQuickbar()

override bool CanBePerformedFromQuickbar ( )

Definition at line 28 of file ActionLightItemOnFire.c.

29 {
30 return true;
31 }

◆ CreateActionComponent()

override void ActionLightItemOnFire::CreateActionComponent ( )

Definition at line 12 of file ActionLightItemOnFire.c.

12 {
13 m_CallbackClass = ActionLightItemOnFireCB;
14 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_STARTFIRE;
15 m_FullBody = true;

References m_FullBody, m_SpecialtyWeight, m_StanceMask, m_Text, and UASoftSkillsWeight::ROUGH_HIGH.

◆ CreateConditionComponents()

override void CreateConditionComponents ( )

Definition at line 22 of file ActionLightItemOnFire.c.

23 {
26 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
const float DEFAULT

References UAMaxDistances::DEFAULT, m_ConditionItem, and m_ConditionTarget.

◆ IsItemInCargoOfSomething()

bool IsItemInCargoOfSomething ( ItemBase item)

Definition at line 40 of file ActionLightItemOnFire.c.

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 }
InventoryLocation.

Referenced by ActionCondition().

◆ OnFinishProgressServer()

override void OnFinishProgressServer ( ActionData action_data)

Definition at line 97 of file ActionLightItemOnFire.c.

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 }

◆ SetIgnitingAnimation()

void SetIgnitingAnimation ( ItemBase target_item)

Definition at line 146 of file ActionLightItemOnFire.c.

147 {
148 if (target_item.HasFlammableMaterial())
149 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_STARTFIRE;
150 else
151 m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_CRAFTING;
152 }

Referenced by SetupAction().

◆ SetupAction()

override bool SetupAction ( PlayerBase player,
ActionTarget target,
ItemBase item,
out ActionData action_data,
Param extra_data = NULL )

Definition at line 132 of file ActionLightItemOnFire.c.

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 }
void SetIgnitingAnimation(ItemBase target_item)

References SetIgnitingAnimation().