Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
actionanimateseats.c
Go to the documentation of this file.
2 {
3  void ActionAnimateSeats()
4  {
5  m_Text = "#move_seat";
6  }
7 
8  override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
9  {
10  if( !target ) return false;
11  if( !IsInReach(player, target, UAMaxDistances.DEFAULT) ) return false;
12 
13  Object targetObject = target.GetObject();
14  Entity targetEnt = Entity.Cast(targetObject);
15  Transport transport;
16  CarScript car;
17  int crewIdx;
18 
19  //string selection = targetObject.GetActionComponentName(target.GetComponentIndex());
20  array<string> selections = new array<string>();
21  targetObject.GetActionComponentNameList(target.GetComponentIndex(), selections);
22 
23 
24  if ( !Class.CastTo(transport, targetObject) )
25  return false;
26 
27  if ( Class.CastTo(car, targetEnt) )
28  {
29  for (int i = 0; i < selections.Count(); i++)
30  {
31  m_AnimSource = car.GetAnimSourceFromSelection( selections[i]) ;
32  if ( m_AnimSource != "" )
33  {
34  //return true; //TODO:: NEED A LINK BETWEEN SeatBack and seat with crew after that we can REMOVE the return
35 
36  HumanCommandVehicle vehCmd = player.GetCommand_Vehicle();
37 
38  if ( m_AnimSource == "SeatDriver" )
39  {
40  if ( transport.CrewMember( DayZPlayerConstants.VEHICLESEAT_DRIVER ) )
41  return false;
42 
43  if ( !vehCmd && car.GetCarDoorsState( "NivaDriverDoors" ) == CarDoorState.DOORS_CLOSED )
44  return false;
45  }
46 
47  if ( m_AnimSource == "SeatCoDriver" )
48  {
49  if ( transport.CrewMember( DayZPlayerConstants.VEHICLESEAT_CODRIVER ) )
50  return false;
51 
52  if ( !vehCmd && car.GetCarDoorsState( "NivaCoDriverDoors" ) == CarDoorState.DOORS_CLOSED )
53  return false;
54  }
55 
56  if ( !vehCmd && !transport.CanReachSeatFromDoors(selections[i], player.GetPosition(), 1.0) )
57  return false;
58 
59  return true;
60  }
61  }
62  }
63 
64  return false;
65  }
66 
67  override bool CanBeUsedInVehicle()
68  {
69  return true;
70  }
71 };
ItemBase
Definition: inventoryitem.c:730
CarScript
Definition: civiliansedan.c:1
UAMaxDistances
Definition: actionconstants.c:104
ActionAnimateSeats
Definition: actionanimateseats.c:1
PlayerBase
Definition: playerbaseclient.c:1
ActionTarget
class ActionTargets ActionTarget
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition: dayzplayer.c:601
CarDoorState
CarDoorState
Definition: carscript.c:1
Object
Definition: objecttyped.c:1
Transport
Base native class for all motorized wheeled vehicles.
Definition: car.c:79
HumanCommandVehicle
Definition: human.c:689
IsInReach
protected bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition: actionbase.c:928
array< string >
m_Text
protected string m_Text
Definition: actionbase.c:49
Entity
Definition: camera.c:1
ActionAnimateCarSelection
Definition: actionanimatecarselection.c:1
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10