Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionmountbarbedwire.c
Go to the documentation of this file.
2 {
3  override void CreateActionComponent()
4  {
5  m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.DEFAULT_CONSTRUCT);
6  }
7 };
8 
10 {
11  float m_DamageAmount;
12  string m_SlotName;
13 
15  {
16  m_CallbackClass = ActionMountBarbedWireCB;
17  m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
18  m_FullBody = true;
19  m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
20 
21  m_DamageAmount = 2;
23  m_Text = "#mount";
24  }
25 
26  override void CreateConditionComponents()
27  {
29  m_ConditionTarget = new CCTNonRuined( UAMaxDistances.BASEBUILDING );
30  }
31 
32  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
33  {
34  Object targetObject = target.GetObject();
35 
36  if ( targetObject && targetObject.CanUseConstruction() && targetObject.CanUseConstructionBuild() )
37  {
38  BaseBuildingBase base_building = BaseBuildingBase.Cast( targetObject );
39 
40  string selection = targetObject.GetActionComponentName( target.GetComponentIndex() );
41 
42  if ( selection.Length() > 0 )
43  {
44  BarbedWire barbed_wire = BarbedWire.Cast( base_building.FindAttachmentBySlotName( selection ) );
45  if ( barbed_wire && !barbed_wire.IsMounted() && !barbed_wire.IsRuined() )
46  {
47  m_SlotName = selection;
48 
49  return true;
50  }
51  }
52  }
53 
54  return false;
55  }
56 
57  override void OnFinishProgressServer( ActionData action_data )
58  {
59  BaseBuildingBase base_building = BaseBuildingBase.Cast( action_data.m_Target.GetObject() );
60  BarbedWire barbed_wire = BarbedWire.Cast( base_building.FindAttachmentBySlotName( m_SlotName ) );
61 
62  //mount and refresh parent
63  barbed_wire.SetMountedState( true );
64 
65  //solution for DamageSystem's case sensitivity
66  string zone = "invalid";
67  array<string> zones = new array<string>;
68  zones.Copy(base_building.GetEntityDamageZoneMap().GetKeyArray());
69 
70  string tmp = "";
71  string test = "";
72  for (int i = 0; i < zones.Count(); i++)
73  {
74  tmp = zones.Get(i);
75  test = tmp;
76  test.ToLower();
77 
78  if (test == m_SlotName)
79  {
80  zone = tmp;
81  break;
82  }
83  }
84 
85  base_building.SetHealth01(zone,"Health",barbed_wire.GetHealth01("","Health")); //attachment slot names and damagezone names must match
86 
87  action_data.m_Player.GetSoftSkillsManager().AddSpecialty( m_SpecialtyWeight );
88  }
89 
90  override string GetAdminLogMessage( ActionData action_data )
91  {
92  string message = string.Format("Player %1 Mounted BarbedWire on %2", action_data.m_Player, action_data.m_Target.GetObject().ClassName() );
93  return message;
94  }
95 }
ItemBase
Definition: inventoryitem.c:730
CAContinuousTime
Definition: cacontinuoustime.c:1
ActionMountBarbedWireCB
Definition: actionmountbarbedwire.c:1
UASoftSkillsWeight
Definition: actionconstants.c:118
UAMaxDistances
Definition: actionconstants.c:104
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
BaseBuildingBase
Definition: fence.c:1
CCTNonRuined
Definition: cctnonruined.c:1
Object
Definition: objecttyped.c:1
UATimeSpent
Definition: actionconstants.c:26
ActionContinuousBaseCB
Definition: actioncontinuousbase.c:1
array< string >
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
ActionMountBarbedWire
Definition: actionmountbarbedwire.c:9
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53