DayZ 1.24
Loading...
Searching...
No Matches
FirearmActionLoadBullet.c
Go to the documentation of this file.
2{
4 {
5 m_Text = "#load_bullet";
6 }
7
8 override int GetActionCategory()
9 {
11 }
12
13 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
14 {
15 if (!super.ActionCondition(player, target, item))
16 return false;
17
18 HumanCommandWeapons hcw = player.GetCommandModifier_Weapons();
19 if (!target.GetObject())
20 return false;
21
23 EntityAI entity = EntityAI.Cast(target.GetObject());
24 if (entity && entity.IsManagingArrows() && entity.IsDamageDestroyed())
25 {
26 ArrowManagerBase arrowManager = ArrowManagerBase.Cast(entity.GetArrowManager());
27 if (arrowManager)
28 mag = Magazine.Cast(arrowManager.GetFirstArrow());
29 }
30 else
31 mag = Magazine.Cast(target.GetObject());
32
34 return mag && player.GetWeaponManager().CanLoadBullet(weapon, mag) && hcw && hcw.GetRunningAction() != WeaponActions.CHAMBERING;
35 }
36
38 {
39 super.Start(action_data);
40
42 EntityAI entity = EntityAI.Cast(action_data.m_Target.GetObject());
43 if (entity && entity.IsManagingArrows() && entity.IsDamageDestroyed())
44 {
45 ArrowManagerBase arrowManager = ArrowManagerBase.Cast(entity.GetArrowManager());
46 if (arrowManager)
47 mag = Magazine.Cast(arrowManager.AcquireFirstArrow(false));
48 }
49 else
50 mag = Magazine.Cast(action_data.m_Target.GetObject());
51
52 action_data.m_Player.GetWeaponManager().LoadBullet(mag, this);
53 }
54
56 {
57 EntityAI entity = EntityAI.Cast(target.GetObject());
58 if (!entity || (entity && entity.IsManagingArrows() && !entity.IsDamageDestroyed()))
59 return null;
60
61 ArrowManagerBase arrowManager = entity.GetArrowManager();
62 if (arrowManager)
63 return arrowManager.GetFirstArrow();
64
65 return null;
66 }
67
69 {
70 return true;
71 }
72
74 {
75 return true;
76 }
77}
78
80{
82
83 override typename GetInputType()
84 {
86 }
87
89 {
92 }
93
94 override bool HasProgress()
95 {
96 return false;
97 }
98
99 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
100 {
101 if (!super.ActionCondition(player, target, item))
102 return false;
103
104 HumanCommandWeapons hcw = player.GetCommandModifier_Weapons();
106
107 return player.GetWeaponManager().CanLoadBullet(weapon, player.GetWeaponManager().GetPreparedMagazine(), true) && hcw && hcw.GetRunningAction() != WeaponActions.CHAMBERING;
108 }
109
111 {
112 if (super.SetupAction(player, target, item, action_data, extra_data))
113 {
114#ifndef SERVER
115 ActionTarget newTarget = new ActionTarget(player.GetWeaponManager().GetPreparedMagazine(), null, -1, vector.Zero, -1);
116 action_data.m_Target = newTarget;
117#endif
118
119 return true;
120 }
121
122 return false;
123 }
124
125 override void Start(ActionData action_data)
126 {
127 super.Start(action_data);
128
129 Magazine mag = Magazine.Cast(action_data.m_Target.GetObject());
130 action_data.m_Player.GetWeaponManager().LoadBullet(mag, this);
131 }
132}
const int AC_SINGLE_USE
Definition _constants.c:2
string m_Text
Definition ActionBase.c:49
void CreateConditionComponents()
Definition ActionBase.c:196
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
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 HasProgress()
For UI: hiding of progress bar.
Definition ActionBase.c:216
class ActionTargets ActionTarget
void Start()
Plays all elements this effects consists of.
Definition Effect.c:149
FirearmActionLoadBullet FirearmActionBase FirearmActionLoadBulletQuick()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override bool CanBePerformedFromQuickbar()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void Start(ActionData action_data)
override Object GetDisplayInteractObject(PlayerBase player, ActionTarget target)
override bool CanBePerformedFromInventory()
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
static const vector Zero
Definition EnConvert.c:110
WeaponActions
actions
Definition human.c:796