3 private const float TIME_TO_CRAFT = 3.0;
5 override void CreateActionComponent()
13 const ref set<string> CUTTING_TYPES =
new set<string>();
15 protected bool m_IsKnifeInHands;
18 void InitCuttingTypes()
20 CUTTING_TYPES.Clear();
21 CUTTING_TYPES.Insert(
"Sickle");
22 CUTTING_TYPES.Insert(
"KukriKnife");
23 CUTTING_TYPES.Insert(
"FangeKnife");
24 CUTTING_TYPES.Insert(
"KitchenKnife");
25 CUTTING_TYPES.Insert(
"SteakKnife");
26 CUTTING_TYPES.Insert(
"StoneKnife");
27 CUTTING_TYPES.Insert(
"Cleaver");
28 CUTTING_TYPES.Insert(
"CombatKnife");
29 CUTTING_TYPES.Insert(
"HuntingKnife");
30 CUTTING_TYPES.Insert(
"Machete");
31 CUTTING_TYPES.Insert(
"CrudeMachete");
32 CUTTING_TYPES.Insert(
"OrientalMachete");
33 CUTTING_TYPES.Insert(
"WoodAxe");
34 CUTTING_TYPES.Insert(
"Hatchet");
35 CUTTING_TYPES.Insert(
"FirefighterAxe");
36 CUTTING_TYPES.Insert(
"AK_Bayonet");
37 CUTTING_TYPES.Insert(
"M9A1_Bayonet");
38 CUTTING_TYPES.Insert(
"SKS_Bayonet");
39 CUTTING_TYPES.Insert(
"BoneKnife");
50 m_Text =
"#STR_CraftBolt0";
55 override void CreateConditionComponents()
61 protected bool IsCuttingType(
Object item)
63 return CUTTING_TYPES.Find(item.ClassName()) >= 0;
68 if (IsCuttingType(item))
71 if (target.GetObject())
72 return (target.GetObject().ClassName() ==
"WoodenStick");
74 else if (target.GetObject())
77 return IsCuttingType(target.GetObject());
83 override void OnStartServer(
ActionData action_data)
85 m_IsKnifeInHands = IsCuttingType(action_data.m_MainItem);
86 m_ResultEntity =
null;
89 override void OnFinishProgressServer(
ActionData action_data)
99 knife = action_data.m_MainItem;
100 material =
ItemBase.Cast(action_data.m_Target.GetObject());
105 material = action_data.m_MainItem;
106 knife =
ItemBase.Cast(action_data.m_Target.GetObject());
109 if (!material || !knife)
114 if (m_ResultEntity.GetAmmoCount() < m_ResultEntity.GetAmmoMax())
116 m_ResultEntity.ServerAddAmmoCount(1);
123 m_ResultEntity =
Ammunition_Base.Cast(action_data.m_Player.SpawnEntityOnGroundPos(
"Ammo_ImprovisedBolt_1", action_data.m_Player.GetPosition()));
124 m_ResultEntity.SetHealth(
"",
"", material.GetHealth(
"",
""));
125 m_ResultEntity.ServerSetAmmoCount(1);
128 material.AddQuantity(-1);
129 knife.AddHealth(
"",
"",-3);