DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionSwitchSeats.c
См. документацию.
1
3{
5 {
6 //m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_STARTENGINE;
7 m_StanceMask = DayZPlayerConstants.STANCEMASK_ALL;
9 m_LockTargetOnUse = false;
10 m_Text = "#change_seat";
11 }
12
14 {
17 }
18
19 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
20 {
21
22 Transport trans = null;
23 int nextSeatIdx = -1;
24
25 HumanCommandVehicle vehCommand = player.GetCommand_Vehicle();
26
27 if ( !vehCommand )
28 return false;
29
30 int componentIndex = target.GetComponentIndex();
31
32 if ( !target )
33 return false;
34
35 if ( !Class.CastTo(trans, target.GetObject()) )
36 return false;
37
38 nextSeatIdx = trans.CrewPositionIndex( componentIndex );
39
40 if ( nextSeatIdx < 0 )
41 return false;
42
43 Human crew = trans.CrewMember( nextSeatIdx );
44 if ( crew )
45 return false;
46
47 if ( !trans.CanReachSeatFromSeat( trans.CrewMemberIndex( player ), nextSeatIdx ) )
48 return false;
49
50 return true;
51 }
52
53 override void OnStart(ActionData action_data)
54 {
55 super.OnStart(action_data);
56 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
57 if ( vehCommand )
58 {
59 Transport trans;
60 if ( Class.CastTo(trans, action_data.m_Target.GetObject()) )
61 {
62 int nextSeat = trans.CrewPositionIndex( action_data.m_Target.GetComponentIndex() );
63 int seat = trans.GetSeatAnimationType( nextSeat );
64 if ( seat >= 0 )
65 {
66 //pTransportPositionIndex, int pVehicleSeat
67 vehCommand.SwitchSeat( nextSeat, seat );
68
69 action_data.m_Player.OnVehicleSwitchSeat( nextSeat );
70 }
71 }
72 }
73 }
74
75 override void OnUpdate(ActionData action_data)
76 {
77
78 if(action_data.m_State == UA_START)
79 {
80 HumanCommandVehicle hcv = action_data.m_Player.GetCommand_Vehicle();
81 if( !hcv || !action_data.m_Player.GetCommand_Vehicle().IsSwitchSeat() )
82 {
83 End(action_data);
84 }
85 }
86 }
87
88 override bool CanBeUsedInVehicle()
89 {
90 return true;
91 }
92
93 override bool AddActionJuncture(ActionData action_data)
94 {
95 Transport trans = Transport.Cast(action_data.m_Target.GetObject());
96 bool accepted = false;
97 int currSeat = trans.CrewMemberIndex(action_data.m_Player);
98 int nextSeat = trans.CrewPositionIndex( action_data.m_Target.GetComponentIndex() );
99 Transport transport = Transport.Cast(action_data.m_Target.GetObject());
101 if (transport)
102 {
103 il.SetVehicle(transport, action_data.m_Player, nextSeat);
104
105 //Lock target
106 if (GetGame().AddInventoryJunctureEx(action_data.m_Player, action_data.m_Player, il, true, 10000))
107 {
108 accepted = true;
109 action_data.m_ReservedInventoryLocations.Insert(il);
110 }
111
112 if(accepted)
113 {
114 il.SetVehicle(transport, action_data.m_Player, currSeat);
115
116 if (GetGame().AddInventoryJunctureEx(action_data.m_Player, action_data.m_Player, il, true, 10000))
117 {
118 action_data.m_ReservedInventoryLocations.Insert(il);
119 }
120 else
121 {
122 ClearActionJuncture(action_data);
123 accepted = false;
124 }
125 }
126 }
127
128 return accepted;
129 }
130};
ActionBase ActionData
Определения ActionBase.c:30
class ActionTargets ActionTarget
proto static native void End()
Finalizes the testing process.
float m_SpecialtyWeight
Определения ActionBase.c:77
void ClearActionJuncture(ActionData action_data)
Определения ActionBase.c:1083
int m_StanceMask
Определения ActionBase.c:62
void ActionBase()
Определения ActionBase.c:82
string m_Text
Определения ActionBase.c:58
ref CCIBase m_ConditionItem
Определения ActionBase.c:64
bool m_LockTargetOnUse
Определения ActionBase.c:60
ref CCTBase m_ConditionTarget
Определения ActionBase.c:65
override bool AddActionJuncture(ActionData action_data)
Определения ActionSwitchSeats.c:93
void ActionSwitchSeats()
Определения ActionSwitchSeats.c:4
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionSwitchSeats.c:19
override bool CanBeUsedInVehicle()
Определения ActionSwitchSeats.c:88
override void CreateConditionComponents()
Определения ActionSwitchSeats.c:13
override void OnUpdate(ActionData action_data)
Определения ActionSwitchSeats.c:75
override void OnStart(ActionData action_data)
Определения ActionSwitchSeats.c:53
Определения CCINone.c:2
Определения CCTObject.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
proto native void SwitchSeat(int pTransportPositionIndex, int pVehicleSeat)
Определения human.c:690
proto native void SetVehicle(notnull EntityAI parent, EntityAI e, int idx)
InventoryLocation.
Определения InventoryLocation.c:29
Определения InventoryItem.c:731
Определения PlayerBaseClient.c:2
Base native class for all motorized wheeled vehicles.
Определения Boat.c:28
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int UA_START
Определения constants.c:467