DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionCarDoorsOutside.c
См. документацию.
2{
3 protected int m_CommandUIDPerCrewIdx[4];
4 protected bool m_IsOpening = true;
5
7 {
8 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
9 m_StanceMask = DayZPlayerConstants.STANCEMASK_ALL;
10 m_LockTargetOnUse = false;
11 }
12
14 {
17 }
18
19 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
20 {
21 CarScript car = null;
22
24 if (!IsInReach(player, target, UAMaxDistances.DEFAULT))
25 {
26 return false;
27 }
28
30 if (Class.CastTo(car, target.GetParent()))
31 {
32 array<string> selections = new array<string>();
33
34 CarDoor carDoor = CarDoor.Cast(target.GetObject());
35 if (carDoor)
36 {
37 carDoor.GetActionComponentNameList(target.GetComponentIndex(), selections);
38
39 string animSource = "";
40
41 for (int i = 0; i < selections.Count(); i++)
42 {
43 animSource = car.GetAnimSourceFromSelection(selections[i]);
44 if (animSource != "")
45 {
46 int idx = car.GetSeatIndexFromDoor(animSource);
47 if (idx != -1 && !car.IsAreaAtDoorFree(idx))
48 {
49 return false;
50 }
51
53 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
54
55 float animationPhase = car.GetAnimationPhase(animSource);
57 return (m_IsOpening && animationPhase <= 0.5 ) || ( !m_IsOpening && animationPhase > 0.5);
58 }
59 }
60 }
61 }
62
63 return false;
64 }
65
66 override void OnStartServer( ActionData action_data )
67 {
68 super.OnStartServer(action_data);
69
70 float phase;
71
72 if (m_IsOpening)
73 {
74 phase = 1.0;
75 }
76 else
77 {
78 phase = 0.0;
79 }
80
81 string animSource = "";
82
83 CarScript car = CarScript.Cast(action_data.m_Target.GetParent());
84 if (car)
85 {
86 array<string> selections = new array<string>();
87 CarDoor carDoor = CarDoor.Cast(action_data.m_Target.GetObject());
88 if (carDoor)
89 {
90 carDoor.GetActionComponentNameList(action_data.m_Target.GetComponentIndex(), selections);
91 for (int i = 0; i < selections.Count(); i++)
92 {
93 animSource = car.GetAnimSourceFromSelection(selections[i]);
94 if (animSource != "")
95 {
96 break;
97 }
98 }
99 }
100 }
101
102 if (car)
103 {
104 car.ForceUpdateLightsStart();
105 car.SetAnimationPhase(animSource, phase);
106 }
107 }
108
109 override void OnEndServer(ActionData action_data)
110 {
111 super.OnEndServer(action_data);
112
113 CarScript car = CarScript.Cast(action_data.m_Target.GetParent());
114 if (car)
115 {
116 car.ForceUpdateLightsEnd();
117 }
118 }
119
120 //--------- Not used for this class
121 protected void FillCommandUIDPerCrewIdx(int crewIdx0, int crewIdx1, int crewIdx2, int crewIdx3)
122 {
123 m_CommandUIDPerCrewIdx[0] = crewIdx0;
124 m_CommandUIDPerCrewIdx[1] = crewIdx1;
125 m_CommandUIDPerCrewIdx[2] = crewIdx2;
126 m_CommandUIDPerCrewIdx[3] = crewIdx3;
127 }
128
129 protected void FillCommandUIDPerCrewIdx(int evenCrewIdx0, int unevenCrewIdx1)
130 {
131 FillCommandUIDPerCrewIdx(evenCrewIdx0, unevenCrewIdx1, evenCrewIdx0, unevenCrewIdx1);
132 }
133 //-----------------------------------
134};
ActionBase ActionData
Определения ActionBase.c:30
class ActionTargets ActionTarget
int m_StanceMask
Определения ActionBase.c:62
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Определения ActionBase.c:1158
ref CCIBase m_ConditionItem
Определения ActionBase.c:64
bool m_LockTargetOnUse
Определения ActionBase.c:60
ref CCTBase m_ConditionTarget
Определения ActionBase.c:65
void FillCommandUIDPerCrewIdx(int crewIdx0, int crewIdx1, int crewIdx2, int crewIdx3)
Определения ActionCarDoorsOutside.c:121
int m_CommandUIDPerCrewIdx[4]
Определения ActionCarDoorsOutside.c:3
override void CreateConditionComponents()
Определения ActionCarDoorsOutside.c:13
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionCarDoorsOutside.c:19
void ActionCarDoorsOutside()
Определения ActionCarDoorsOutside.c:6
override void OnStartServer(ActionData action_data)
Определения ActionCarDoorsOutside.c:66
void FillCommandUIDPerCrewIdx(int evenCrewIdx0, int unevenCrewIdx1)
Определения ActionCarDoorsOutside.c:129
override void OnEndServer(ActionData action_data)
Определения ActionCarDoorsOutside.c:109
void ActionInteractBase()
Определения ActionInteractBase.c:43
int m_CommandUID
Определения AnimatedActionBase.c:143
Определения CCINone.c:2
Определения CCTNone.c:2
Определения InventoryItem.c:496
override int GetSeatIndexFromDoor(string pDoorSelection)
Определения OffroadHatchback.c:427
override string GetAnimSourceFromSelection(string selection)
Определения CivilianSedan.c:327
Определения CivilianSedan.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения InventoryItem.c:731
Определения PlayerBaseClient.c:2
const float DEFAULT
Определения ActionConstants.c:112
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.