Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
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
11{
13 {
15 m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_LOW;
16 m_Text = "#sort_ammunition";
17 }
18
19 override void CreateConditionComponents()
20 {
23 }
24
25 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
26 {
27 return false;
28 }
29
30 override void OnEndAnimationLoopServer( ActionData action_data )
31 {
32 SortAmmo(action_data.m_MainItem);
33 }
34
35 void SortAmmo(ItemBase item)
36 {
37 Magazine magazine;
38 Magazine piles[5];
39 //string pile_classname = magazine.ConfigGetString("spawnPileType");
40 if( Class.CastTo(magazine, item) )
41 {
42 float health;
43 string ammo_type;
44 while( magazine.GetAmmoCount() > 0)
45 {
46 int count = magazine.GetAmmoCount();
47 if(magazine.ServerAcquireCartridge(health, ammo_type))
48 {
49 int health_label = MiscGameplayFunctions.GetHealthLevelForAmmo(ammo_type,health);
50 if( piles[health_label] == null )
51 {
52 piles[health_label] = Magazine.Cast( GetGame().CreateObjectEx( item.ClassName(), item.GetPosition(), ECE_PLACE_ON_SURFACE ) );
53 }
54 piles[health_label].ServerStoreCartridge(health,ammo_type);
55 }
56 }
57 }
58 }
59};
const int ECE_PLACE_ON_SURFACE
ActionData m_ActionData
float m_SpecialtyWeight
Definition actionbase.c:77
string m_Text
Definition actionbase.c:58
ref CCIBase m_ConditionItem
Definition actionbase.c:64
ref CCTBase m_ConditionTarget
Definition actionbase.c:65
Super root of all classes in Enforce script.
Definition enscript.c:11
proto native CGame GetGame()