Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionbreaklongwoodenstick.c
Go to the documentation of this file.
2 {
3  private const float TIME_TO_BREAK_STICKS = 5.0;
4 
5  override void CreateActionComponent()
6  {
7  //float adjusted_time = m_ActionData.m_Player.GetSoftSkillsManager().AdjustCraftingTime(TIME_TO_BREAK_STICKS,UASoftSkillsWeight.ROUGH_HIGH);
8  m_ActionData.m_ActionComponent = new CAContinuousTime(TIME_TO_BREAK_STICKS);
9  }
10 };
11 
13 {
15  {
16  m_CallbackClass = ActionBreakLongWoodenStickCB;
17  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_CRAFTING;
18  m_FullBody = true;
19  m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
21  m_Text = "#STR_split0";
22  }
23 
24  override void CreateConditionComponents()
25  {
28  }
29 
30  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
31  {
32  if (item.IsEmpty() && (!item.GetCompEM() || !item.GetCompEM().IsWorking()))
33  {
34  return true;
35  }
36  else
37  {
38  return false;
39  }
40  }
41 
42  override bool HasTarget()
43  {
44  return false;
45  }
46 
47  override void OnFinishProgressServer( ActionData action_data )
48  {
49  ItemBase startingItem = action_data.m_MainItem;
50 
51  BreakLongWoodenStick lambda = new BreakLongWoodenStick(action_data.m_MainItem, "WoodenStick", action_data.m_Player, 3);
52  action_data.m_Player.ServerReplaceItemInHandsWithNew(lambda);
53 
54  if (LongWoodenStick.Cast(startingItem) == null) // case if it is a broom
55  {
56  EntityAI longStick = action_data.m_Player.SpawnEntityOnGroundPos("LongWoodenStick", action_data.m_Player.GetPosition());
57 
58  ItemBase item_result;
59  Class.CastTo(item_result, longStick);
60 
61  MiscGameplayFunctions.TransferItemProperties(action_data.m_MainItem, item_result);
62  }
63  }
64 };
65 
67 {
68  int m_ItemCount;
69 
70  void BreakLongWoodenStick(EntityAI old_item, string new_item_type, PlayerBase player, int count)
71  {
72  m_ItemCount = count;
73  }
74 
75  override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
76  {
77  super.CopyOldPropertiesToNew(old_item, new_item);
78 
79  ItemBase sticks;
80  Class.CastTo(sticks, new_item);
81 
82  ItemBase ingredient;
83  Class.CastTo(ingredient, old_item);
84 
85  MiscGameplayFunctions.TransferItemProperties(ingredient, sticks);
86 
87  sticks.SetQuantity(m_ItemCount);
88  }
89 };
ItemBase
Definition: inventoryitem.c:730
CAContinuousTime
Definition: cacontinuoustime.c:1
ActionBreakLongWoodenStick
Definition: actionbreaklongwoodenstick.c:12
UASoftSkillsWeight
Definition: actionconstants.c:118
CCTNone
Definition: cctnone.c:1
m_ItemCount
class SeedPackBase extends Inventory_Base m_ItemCount
LongWoodenStick
Definition: crafting.c:33
m_FullBody
protected bool m_FullBody
Definition: actionbase.c:52
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
ActionBreakLongWoodenStickCB
Definition: actionbreaklongwoodenstick.c:1
BreakLongWoodenStick
Definition: actionbreaklongwoodenstick.c:66
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
ReplaceItemWithNewLambdaBase
base class for transformation operations (creating one item from another)
Definition: replaceitemwithnewlambdabase.c:4
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53
EntityAI
Definition: building.c:5