Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actionanimateseats.c
Go to the documentation of this file.
2{
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
72 override bool AddActionJuncture(ActionData action_data)
73 {
74 Transport trans = Transport.Cast(action_data.m_Target.GetObject());
75 bool accepted = false;
76 int nextSeat = trans.CrewPositionIndex( action_data.m_Target.GetComponentIndex() );
77 Transport transport = Transport.Cast(action_data.m_Target.GetObject());
79 if (transport)
80 {
81 il.SetVehicle(transport, action_data.m_Player, nextSeat);
82
83 //Lock target
84 if (GetGame().AddInventoryJunctureEx(action_data.m_Player, action_data.m_Player, il, true, 10000))
85 {
86 accepted = true;
87 action_data.m_ReservedInventoryLocations.Insert(il);
88 }
89 }
90
91 return accepted;
92 }
93};
CarDoorState
Definition carscript.c:2
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
string m_Text
Definition actionbase.c:58
override int GetCarDoorsState(string slotType)
override string GetAnimSourceFromSelection(string selection)
Super root of all classes in Enforce script.
Definition enscript.c:11
Definition camera.c:2
InventoryLocation.
Native class for boats - handles physics simulation.
Definition boat.c:28
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
proto native CGame GetGame()