Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionunmountbarbedwire.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 = ActionUnmountBarbedWireCB;
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 = "#unmount_barbed_wire";
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() )
37  {
38  BaseBuildingBase base_building = BaseBuildingBase.Cast( targetObject );
39  if (!base_building.IsPlayerInside(player,""))
40  return false;
41 
42  string selection = targetObject.GetActionComponentName( target.GetComponentIndex() );
43 
44  if ( selection.Length() > 0 )
45  {
46  int delimiter_index = selection.IndexOfFrom( 0, "_mounted" );
47  if ( delimiter_index > -1 )
48  {
49  selection = selection.Substring( 0, delimiter_index );
50 
51  BarbedWire barbed_wire = BarbedWire.Cast( base_building.FindAttachmentBySlotName( selection ) );
52  if ( barbed_wire && barbed_wire.IsMounted() )
53  {
54  m_SlotName = selection;
55 
56  return true;
57  }
58  }
59  }
60  }
61 
62  return false;
63  }
64 
65  override void OnFinishProgressServer( ActionData action_data )
66  {
67  BaseBuildingBase base_building = BaseBuildingBase.Cast( action_data.m_Target.GetObject() );
68  BarbedWire barbed_wire = BarbedWire.Cast( base_building.FindAttachmentBySlotName( m_SlotName ) );
69 
70  //unmount and refresh parent
71  barbed_wire.SetMountedState( false );
72 
73  action_data.m_Player.GetSoftSkillsManager().AddSpecialty( m_SpecialtyWeight );
74  }
75 
76  override string GetAdminLogMessage( ActionData action_data )
77  {
78  string message = string.Format("Player %1 Unmounted BarbedWire from %2", action_data.m_Player, action_data.m_Target.GetObject().ClassName() );
79  return message;
80  }
81 }
ItemBase
Definition: inventoryitem.c:730
ActionUnmountBarbedWireCB
Definition: actionunmountbarbedwire.c:1
CAContinuousTime
Definition: cacontinuoustime.c:1
ActionUnmountBarbedWire
Definition: actionunmountbarbedwire.c:9
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
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
m_SpecialtyWeight
protected float m_SpecialtyWeight
Definition: actionbase.c:68
m_StanceMask
protected int m_StanceMask
Definition: actionbase.c:53