Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionsortammopile.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.DEFAULT_SORT);
6  }
7 };
8 
10 {
11  void ActionSortAmmoPile()
12  {
13  m_CallbackClass = ActionSortAmmoPileCB;
15  m_Text = "#sort_ammunition";
16  }
17 
18  override void CreateConditionComponents()
19  {
22  }
23 
24  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
25  {
26  return false;
27  }
28 
29  override void OnEndAnimationLoopServer( ActionData action_data )
30  {
31  SortAmmo(action_data.m_MainItem);
32  }
33 
34  void SortAmmo(ItemBase item)
35  {
36  Magazine magazine;
37  Magazine piles[5];
38  //string pile_classname = magazine.ConfigGetString("spawnPileType");
39  if( Class.CastTo(magazine, item) )
40  {
41  float health;
42  string ammo_type;
43  while( magazine.GetAmmoCount() > 0)
44  {
45  int count = magazine.GetAmmoCount();
46  if(magazine.ServerAcquireCartridge(health, ammo_type))
47  {
48  int health_label = MiscGameplayFunctions.GetHealthLevelForAmmo(ammo_type,health);
49  if( piles[health_label] == null )
50  {
51  piles[health_label] = Magazine.Cast( GetGame().CreateObjectEx( item.ClassName(), item.GetPosition(), ECE_PLACE_ON_SURFACE ) );
52  }
53  piles[health_label].ServerStoreCartridge(health,ammo_type);
54  }
55  }
56  }
57  }
58 };
ItemBase
Definition: inventoryitem.c:730
GetGame
proto native CGame GetGame()
CAContinuousTime
Definition: cacontinuoustime.c:1
UASoftSkillsWeight
Definition: actionconstants.c:118
ECE_PLACE_ON_SURFACE
const int ECE_PLACE_ON_SURFACE
Definition: centraleconomy.c:37
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
CCTSelf
Definition: cctself.c:1
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
ActionSortAmmoPile
Definition: actionsortammopile.c:9
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
ActionContinuousBase
Definition: actioncontinuousbase.c:132
CCINonRuined
Definition: ccinonruined.c:1
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
ActionSortAmmoPileCB
Definition: actionsortammopile.c:1
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68