DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
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 {
12 }
13
14 override bool IsInstant()
15 {
16 return true;
17 }
18
20 {
21 return false;
22 }
23
24 override bool UseAcknowledgment()
25 {
26 return true;
27 }
28
29 override typename GetInputType()
30 {
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}
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected string m_Text
Definition ActionBase.c:49
class ActionTargets ActionTarget
PlayerBase m_Player
Definition ActionBase.c:33
override void Start(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override bool IsPlayerInside(PlayerBase player, string selection)
Definition Fence.c:615
void RefreshAttachmentsToDetach(EntityAI target, string main_part_name)
const float BASEBUILDING