Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actiontakematerialtohandsswitch.c
Go to the documentation of this file.
2 {
4  {
5  m_Text = "#switch_to_next_material";
6  }
7 
8  override void CreateConditionComponents()
9  {
11  m_ConditionTarget = new CCTNonRuined( UAMaxDistances.BASEBUILDING );
12  }
13 
14  override bool IsInstant()
15  {
16  return true;
17  }
18 
19  override bool RemoveForceTargetAfterUse()
20  {
21  return false;
22  }
23 
24  override bool UseAcknowledgment()
25  {
26  return true;
27  }
28 
29  override typename GetInputType()
30  {
31  return InteractActionInput;
32  }
33 
34  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
35  {
36  EntityAI target_entity = EntityAI.Cast( target.GetObject() );
37  if ( target_entity && target_entity.CanUseConstruction() )
38  {
39  BaseBuildingBase base_building = BaseBuildingBase.Cast( target_entity );
40  if(!base_building.IsPlayerInside(player,""))
41  return false;
42 
43  ConstructionActionData construction_action_data = player.GetConstructionActionData();
44 
45  string main_part_name = target_entity.GetActionComponentName( target.GetComponentIndex() );
46  construction_action_data.RefreshAttachmentsToDetach( target_entity, main_part_name );
47 
48  if ( construction_action_data.GetAttachmentsToDetachCount() > 1 )
49  {
50  return true;
51  }
52  }
53 
54  return false;
55  }
56 
57  override void Start( ActionData action_data )
58  {
59  super.Start( action_data );
60 
61  //set next index
62  ConstructionActionData construction_action_data = action_data.m_Player.GetConstructionActionData();
63  construction_action_data.SetNextAttachmentIndex();
64  }
65 }
ItemBase
Definition: inventoryitem.c:730
ActionTakeMaterialToHandsSwitch
Definition: actiontakematerialtohandsswitch.c:1
ConstructionActionData
Definition: constructionactiondata.c:1
CCINotPresent
Definition: ccinotpresent.c:1
UAMaxDistances
Definition: actionconstants.c:104
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
InteractActionInput
Definition: actioninput.c:534
BaseBuildingBase
Definition: fence.c:1
CCTNonRuined
Definition: cctnonruined.c:1
m_Text
protected string m_Text
Definition: actionbase.c:49
ActionSingleUseBase
Definition: actionsingleusebase.c:41
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
EntityAI
Definition: building.c:5