Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
firearmactionloadbullet.c
Go to the documentation of this file.
1
class
FirearmActionLoadBullet
:
FirearmActionBase
2
{
3
void
FirearmActionLoadBullet
()
4
{
5
m_Text
=
"#load_bullet"
;
6
}
7
8
override
int
GetActionCategory
()
9
{
10
return
AC_SINGLE_USE
;
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
22
Magazine mag = null;
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
33
Weapon_Base
weapon =
Weapon_Base
.Cast(item);
34
return
mag && player.GetWeaponManager().CanLoadBullet(weapon, mag) && hcw && hcw.
GetRunningAction
() !=
WeaponActions
.CHAMBERING;
35
}
36
37
override
void
Start
(
ActionData
action_data)
38
{
39
super.Start(action_data);
40
41
Magazine mag;
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
{
48
mag = Magazine.Cast(arrowManager.
AcquireFirstArrow
(
false
));
49
mag.SetPosition(action_data.m_Player.GetPosition());
50
}
51
}
52
else
53
mag = Magazine.Cast(action_data.m_Target.GetObject());
54
55
action_data.m_Player.GetWeaponManager().LoadBullet(mag,
this
);
56
}
57
58
override
Object
GetDisplayInteractObject
(
PlayerBase
player,
ActionTarget
target)
59
{
60
EntityAI
entity =
EntityAI
.Cast(target.GetObject());
61
if
(!entity || (entity && entity.IsManagingArrows() && !entity.IsDamageDestroyed()))
62
return
null;
63
64
ArrowManagerBase
arrowManager = entity.GetArrowManager();
65
if
(arrowManager)
66
return
arrowManager.
GetFirstArrow
();
67
68
return
null;
69
}
70
71
override
bool
CanBePerformedFromInventory
()
72
{
73
return
true
;
74
}
75
76
override
bool
CanBePerformedFromQuickbar
()
77
{
78
return
true
;
79
}
80
}
81
82
class
FirearmActionLoadBulletQuick
:
FirearmActionBase
83
{
84
void
FirearmActionLoadBulletQuick
();
85
86
override
typename
GetInputType
()
87
{
88
return
ContinuousWeaponManipulationActionInput
;
89
}
90
91
override
void
CreateConditionComponents
()
92
{
93
m_ConditionItem =
new
CCINonRuined
();
94
m_ConditionTarget =
new
CCTSelf
();
95
}
96
97
override
bool
HasProgress
()
98
{
99
return
false
;
100
}
101
102
override
bool
ActionCondition
(PlayerBase player,
ActionTarget
target,
ItemBase
item)
103
{
104
if
(!super.ActionCondition(player, target, item))
105
return
false
;
106
107
HumanCommandWeapons
hcw = player.GetCommandModifier_Weapons();
108
Weapon_Base weapon = Weapon_Base.Cast(item);
109
110
return
player.GetWeaponManager().CanLoadBullet(weapon, player.GetWeaponManager().GetPreparedMagazine(),
true
) && hcw && hcw.
GetRunningAction
() !=
WeaponActions
.CHAMBERING;
111
}
112
113
override
bool
SetupAction
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item, out
ActionData
action_data,
Param
extra_data = NULL)
114
{
115
if
(super.SetupAction(player, target, item, action_data, extra_data))
116
{
117
#ifndef SERVER
118
ActionTarget
newTarget =
new
ActionTarget
(player.GetWeaponManager().GetPreparedMagazine(), null, -1,
vector
.
Zero
, -1);
119
action_data.m_Target = newTarget;
120
#endif
121
122
return
true
;
123
}
124
125
return
false
;
126
}
127
128
override
void
Start
(
ActionData
action_data)
129
{
130
super.Start(action_data);
131
132
Magazine mag = Magazine.Cast(action_data.m_Target.GetObject());
133
action_data.m_Player.GetWeaponManager().LoadBullet(mag,
this
);
134
}
135
}
AC_SINGLE_USE
const int AC_SINGLE_USE
Definition
_constants.c:2
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionBase::CreateConditionComponents
void CreateConditionComponents()
Definition
actionbase.c:236
ActionBase::SetupAction
bool SetupAction(PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
Definition
actionbase.c:162
ActionBase::HasProgress
bool HasProgress()
For UI: hiding of progress bar.
Definition
actionbase.c:256
ArrowManagerBase
Definition
arrowmanagerbase.c:2
ArrowManagerBase::AcquireFirstArrow
EntityAI AcquireFirstArrow(bool keepTransform=false)
Definition
arrowmanagerbase.c:92
ArrowManagerBase::GetFirstArrow
EntityAI GetFirstArrow()
Definition
arrowmanagerbase.c:82
CCINonRuined
Definition
ccinonruined.c:2
CCTSelf
Definition
cctself.c:2
ContinuousWeaponManipulationActionInput
Definition
actioninput.c:913
EntityAI
Definition
inventoryitem.c:2
FirearmActionBase
Definition
firearmactionbase.c:2
FirearmActionBase::FirearmActionBase
void FirearmActionBase()
FirearmActionBase::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
firearmactionbase.c:26
FirearmActionBase::GetInputType
override GetInputType()
Definition
firearmactionbase.c:15
FirearmActionLoadBullet::FirearmActionLoadBullet
void FirearmActionLoadBullet()
Definition
firearmactionloadbullet.c:3
FirearmActionLoadBullet::Start
override void Start(ActionData action_data)
Definition
firearmactionloadbullet.c:37
FirearmActionLoadBullet::CanBePerformedFromInventory
override bool CanBePerformedFromInventory()
Definition
firearmactionloadbullet.c:71
FirearmActionLoadBullet::CanBePerformedFromQuickbar
override bool CanBePerformedFromQuickbar()
Definition
firearmactionloadbullet.c:76
FirearmActionLoadBullet::GetActionCategory
override int GetActionCategory()
Definition
firearmactionloadbullet.c:8
FirearmActionLoadBullet::GetDisplayInteractObject
override Object GetDisplayInteractObject(PlayerBase player, ActionTarget target)
Definition
firearmactionloadbullet.c:58
FirearmActionLoadBullet::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
firearmactionloadbullet.c:13
HumanCommandWeapons
Definition
human.c:1000
HumanCommandWeapons::GetRunningAction
proto native int GetRunningAction()
returns -1 when no action is running or RELOAD,MECHANISM, ....
ItemBase
Definition
inventoryitem.c:742
Object
Definition
objecttyped.c:2
Param
Base Param Class with no parameters.
Definition
param.c:12
PlayerBase
Definition
playerbaseclient.c:2
Weapon_Base
shorthand
Definition
boltactionrifle_base.c:6
vector
Definition
enconvert.c:119
vector::Zero
static const vector Zero
Definition
enconvert.c:123
Start
void Start()
Plays all elements this effects consists of.
Definition
effect.c:157
FirearmActionLoadBulletQuick
FirearmActionLoadBullet FirearmActionBase FirearmActionLoadBulletQuick()
ItemBase
class GP5GasMask extends MaskBase ItemBase
WeaponActions
WeaponActions
actions
Definition
human.c:816
HumanCommandWeapons
void HumanCommandWeapons()
Definition
human.c:1128
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
weapons
firearmactionloadbullet.c
Generated by
1.17.0