DayZ 1.24
Loading...
Searching...
No Matches
ActionEmptyMagazine Class Reference
Inheritance diagram for ActionEmptyMagazine:
[legend]
Collaboration diagram for ActionEmptyMagazine:
[legend]

Private Member Functions

void ActionEmptyMagazine ()
 
override bool SetupAction (PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=NULL)
 
override ActionData CreateActionData ()
 
override void CreateConditionComponents ()
 
override bool HasProneException ()
 
bool CanEmpty (ItemBase item)
 
override bool ActionConditionContinue (ActionData action_data)
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override bool HasTarget ()
 
override void OnExecuteServer (ActionData action_data)
 
- Private Member Functions inherited from ActionContinuousBase
void OnStartAnimationLoopServer (ActionData action_data)
 
void OnStartAnimationLoopClient (ActionData action_data)
 
void OnEndAnimationLoopServer (ActionData action_data)
 
void OnEndAnimationLoopClient (ActionData action_data)
 
void OnFinishProgressServer (ActionData action_data)
 
void OnFinishProgressClient (ActionData action_data)
 

Detailed Description

Definition at line 14 of file ActionEmptyMagazine.c.

Constructor & Destructor Documentation

◆ ActionEmptyMagazine()

void ActionEmptyMagazine::ActionEmptyMagazine ( )
inlineprivate

Member Function Documentation

◆ ActionCondition()

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

Definition at line 63 of file ActionEmptyMagazine.c.

64 {
66 return CanEmpty(item);
67 }
bool CanEmpty(ItemBase item)

References CanEmpty().

◆ ActionConditionContinue()

override bool ActionEmptyMagazine::ActionConditionContinue ( ActionData action_data)
inlineprivate

Definition at line 58 of file ActionEmptyMagazine.c.

59 {
60 return CanEmpty(action_data.m_MainItem);
61 }

References CanEmpty().

◆ CanEmpty()

bool ActionEmptyMagazine::CanEmpty ( ItemBase item)
inlineprivate

Definition at line 52 of file ActionEmptyMagazine.c.

53 {
55 return (item && Class.CastTo(mag, item) && mag.GetAmmoCount() > 0);
56 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo().

Referenced by ActionCondition(), and ActionConditionContinue().

◆ CreateActionData()

override ActionData ActionEmptyMagazine::CreateActionData ( )
inlineprivate

◆ CreateConditionComponents()

override void ActionEmptyMagazine::CreateConditionComponents ( )
inlineprivate

Definition at line 41 of file ActionEmptyMagazine.c.

42 {
45 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ HasProneException()

override bool ActionEmptyMagazine::HasProneException ( )
inlineprivate

Definition at line 47 of file ActionEmptyMagazine.c.

48 {
49 return true;
50 }

◆ HasTarget()

override bool ActionEmptyMagazine::HasTarget ( )
inlineprivate

Definition at line 69 of file ActionEmptyMagazine.c.

70 {
71 return false;
72 }

◆ OnExecuteServer()

override void ActionEmptyMagazine::OnExecuteServer ( ActionData action_data)
inlineprivate

Definition at line 74 of file ActionEmptyMagazine.c.

75 {
77
79 if (!Class.CastTo(mag, action_data.m_MainItem))
80 return;
81
82 //float dmg;
83 //string bulletType;
84
85 /*int ammoCount = mag.GetAmmoCount();
86 if(GetAmmoCount() > 0)
87 {
88 mag.Get
89 mag.SetAmmoCount( ammoCount - 1 );
90 array< Magazine > piles;
91
92 if( !callback.m_magazinePile )
93 {
94 piles = MiscGameplayFunctions.CreateMagazinePilesFromBullet(bulletType, action_data.m_Player.GetPosition(),1,dmg);
95 if( piles.Count() > 0 )
96 callback.m_magazinePile = piles.Get(0);
97 }
98 else
99 {
100 if( callback.m_magazinePile.GetAmmoMax() > callback.m_magazinePile.GetAmmoCount() && (vector.Distance(action_data.m_Player.GetPosition(), callback.m_magazinePile.GetPosition()) < MAX_GROUND_PILE_DISTANCE ) )
101 {
102 callback.m_magazinePile.StoreCartridge(dmg, bulletType);
103 }
104 else
105 {
106 piles = MiscGameplayFunctions.CreateMagazinePilesFromBullet(bulletType, action_data.m_Player.GetPosition(),1,dmg);
107 if( piles.Count() > 0 )
108 callback.m_magazinePile = piles.Get(0);
109 }
110 }
111
112
113
114 } */
115
116
117 //----Uncomment after AcquireCartridge will work
118
119 float dmg;
120 string ammoType;
121
122 if (!mag.ServerAcquireCartridge(dmg, ammoType))
123 return;
124
125 mag.ApplyManipulationDamage();
126
127 string magazineTypeName;
128 GetGame().ConfigGetText("CfgAmmo " + ammoType + " spawnPileType", magazineTypeName);
129
130 if (!DayZPlayerUtils.HandleStoreCartridge(action_data.m_Player, NULL, -1, dmg, ammoType, magazineTypeName, false))
131 {
133
134 if (!emActionData.m_magazinePile)
135 {
136 piles = MiscGameplayFunctions.CreateMagazinePilesFromBullet(ammoType, action_data.m_Player.GetPosition(), 1, dmg);
137 if (piles.Count() > 0)
138 emActionData.m_magazinePile = piles.Get(0);
139 }
140 else
141 {
142 if (emActionData.m_magazinePile.GetAmmoMax() > emActionData.m_magazinePile.GetAmmoCount() && (vector.DistanceSq(action_data.m_Player.GetPosition(), emActionData.m_magazinePile.GetPosition()) < (UAMaxDistances.DEFAULT * UAMaxDistances.DEFAULT)))
143 emActionData.m_magazinePile.ServerStoreCartridge(dmg, ammoType);
144 else
145 {
146 piles = MiscGameplayFunctions.CreateMagazinePilesFromBullet(ammoType, action_data.m_Player.GetPosition(), 1, dmg);
147 if (piles.Count() > 0)
148 emActionData.m_magazinePile = piles.Get(0);
149 }
150 }
151 //emActionData.m_magazinePile.SetSynchDirty();
152 }
153 //mag.SetSynchDirty();
154 }
void DayZPlayerUtils()
cannot be instantiated
const float DEFAULT
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
proto native CGame GetGame()

References Class::CastTo(), DayZPlayerUtils(), UAMaxDistances::DEFAULT, vector::DistanceSq(), and GetGame().

◆ SetupAction()

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

Definition at line 24 of file ActionEmptyMagazine.c.

25 {
26 if (super.SetupAction(player, target, item, action_data, extra_data))
27 {
29 emActionData.m_magazinePile = NULL;
30 return true;
31 }
32 return false;
33 }

The documentation for this class was generated from the following file: