DayZ 1.24
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();
17 int crewIdx;
18
19 //string selection = targetObject.GetActionComponentName(target.GetComponentIndex());
21 targetObject.GetActionComponentNameList(target.GetComponentIndex(), selections);
22
23
25 return false;
26
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};
string m_Text
Definition ActionBase.c:49
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:856
CarDoorState
Definition CarScript.c:2
override bool CanBeUsedInVehicle()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition Camera.c:2
Base native class for all motorized wheeled vehicles.
Definition Car.c:75
const float DEFAULT
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.