Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
vehiclemanager.c
Go to the documentation of this file.
1 /*class VehicleManager
2 {
3  PlayerBase m_Player;
4  HumanInputController m_HIC;
5  protected ActionManagerBase m_AM;
6 
7  void VehicleManager( PlayerBase player, ActionManagerBase mngr)
8  {
9  m_Player = player;
10  m_HIC = m_Player.GetInputController();
11  m_AM = mngr;
12  }
13 
14  //Called from players commandhandler each frame, checks input
15  void Update( float deltaT )
16  {
17  PickAction();
18  }
19 
20  protected void PerformAction( int actionID )
21  {
22  if ( !GetGame().IsDedicatedServer() )
23  {
24  if ( !m_Player.GetCommandModifier_Action() && !m_Player.GetCommand_Action() )
25  {
26  ActionBase action = m_AM.GetAction(actionID);
27  if ( action )
28  {
29  //ActionTarget target = new ActionTarget( m_AM.FindActionTarget().GetObject(), -1, Vector(0,0,0), -1);
30  ActionTarget target = new ActionTarget( m_Player.GetHierarchyParent(), null, -1, Vector(0,0,0), -1);
31  if ( target && action.Can(m_Player, target, null ) )
32  {
33  action.Start(m_Player, target, null );
34  if ( GetGame().IsClient() )
35  {
36  ScriptInputUserData ctx = new ScriptInputUserData;
37  ctx.Write(INPUT_UDT_STANDARD_ACTION);
38  ctx.Write(action.GetType());
39  action.WriteToContext(ctx, target);
40  ctx.Send();
41  }
42  }
43  }
44  }
45  }
46  else
47  {
48  m_AM.StartDeliveredAction();
49  }
50  }
51 
52  protected void PickAction()
53  {
54  Car car;
55  if ( !Class.CastTo(car, m_Player.GetHierarchyParent()) ) return;
56 
57  if ( m_Player )
58  {
59  /* // not synced to server
60  if ( KeyState(KeyCode.KC_L) > 0 )
61  {
62  PerformAction( AT_VEH_SWITCH_LIGHTS );
63  }
64  */
65 /* switch ( m_HIC.IsGestureSlot() )
66  {
67  case 1 :
68  PerformAction( AT_VEH_SWITCH_LIGHTS );
69  break;
70 
71  case 2 :
72  PerformAction( AT_VEH_ENGINE_START );
73  break;
74 
75  case 3 :
76  PerformAction( AT_VEH_ENGINE_STOP );
77  break;
78  /*
79  case 4 :
80  PerformAction( m_Player.m_ConfigEmotesProfile.GetEmoteSlot4() );
81  break;
82 
83  case 5 :
84  PerformAction( m_Player.m_ConfigEmotesProfile.GetEmoteSlot5() );
85  break;
86 
87  case 6 :
88  PerformAction( m_Player.m_ConfigEmotesProfile.GetEmoteSlot6() );
89  break;
90 
91  case 7 :
92  PerformAction( m_Player.m_ConfigEmotesProfile.GetEmoteSlot7() );
93  break;
94  */
95 /* }
96  }
97  }
98 };*/