Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actiontoggletentopen.c
Go to the documentation of this file.
2 {
4  {
5  m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_INTERACTONCE;
6  m_Text = "#toggle_opening";
7  }
8 
9  override void CreateConditionComponents()
10  {
13  }
14 
15  override bool IsUsingProxies()
16  {
17  return true;
18  }
19 
20  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
21  {
22  Object targetObject = target.GetObject();
23  Object targetParent = target.GetParent();
24 
25  if ( player && targetObject && targetParent )
26  {
27  if ( targetParent.IsInherited(TentBase) )
28  {
29  array<string> selections = new array<string>;
30  targetObject.GetActionComponentNameList(target.GetComponentIndex(), selections);
31  TentBase tent = TentBase.Cast( targetParent );
32 
33  for (int s = 0; s < selections.Count(); s++)
34  {
35  if ( tent.CanToggleAnimations(selections[s]) )
36  {
37  //Print("nazov selekcie: " + selections[s]);
38  return true;
39  }
40  }
41  }
42  }
43 
44  return false;
45  }
46 
47  override void OnExecuteServer( ActionData action_data )
48  {
49  Object targetObject = action_data.m_Target.GetObject();
50  Object targetParent = action_data.m_Target.GetParent();
51 
52  if ( targetParent && targetParent.IsInherited(TentBase) )
53  {
54  array<string> selections = new array<string>;
55  targetObject.GetActionComponentNameList(action_data.m_Target.GetComponentIndex(), selections);
56 
57  TentBase tent = TentBase.Cast( targetParent );
58  for ( int s = 0; s < selections.Count(); s++)
59  {
60  if ( tent.CanToggleAnimations(selections[s]) )
61  {
62  tent.ToggleAnimation( selections[s] );
63  }
64  }
65 
66  //regenerate pathgraph
67  tent.SetAffectPathgraph( true, false );
68 
69  if ( tent.CanAffectPathgraph() )
70  {
71  //Start update
72  tent.RegenerateNavmesh();
73  }
74  }
75  }
76 
77  override void OnEndServer( ActionData action_data )
78  {
79  Object target_object = action_data.m_Target.GetObject();
80  TentBase ntarget = TentBase.Cast( target_object );
81  if( ntarget )
82  {
83  ntarget.SoundSynchRemoteReset();
84  }
85  }
86 };
ItemBase
Definition: inventoryitem.c:730
CCINone
Definition: ccinone.c:1
CCTCursorParent
Definition: cctcursorparent.c:1
UAMaxDistances
Definition: actionconstants.c:104
ActionInteractBase
Definition: actioninteractbase.c:54
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
ActionData
Definition: actionbase.c:20
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
Object
Definition: objecttyped.c:1
TentBase
Definition: cartent.c:1
array< string >
m_Text
protected string m_Text
Definition: actionbase.c:49
m_ConditionItem
ref CCIBase m_ConditionItem
Definition: actionbase.c:55
m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition: actionbase.c:56
ActionToggleTentOpen
Definition: actiontoggletentopen.c:1