DayZ 1.28
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ActionCarDoors.c
См. документацию.
2{
3 protected int m_CommandUIDPerCrewIdx[4];
4 protected bool m_IsOpening = true;
5 // --- Backwards compatibility 1.09 -> 1.10 (But please do not use these)
7 string m_AnimSource = "";
8 // ---
9
11 {
12 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
13 m_StanceMask = DayZPlayerConstants.STANCEMASK_ALL;
14 m_LockTargetOnUse = false;
15 }
16
18 {
21 }
22
23 override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
24 {
25 CarScript car = null;
26 string animSource = "";
27
29 if (player && player.GetCommand_Vehicle())
30 {
31 if (Class.CastTo(car, player.GetCommand_Vehicle().GetTransport()))
32 {
33 int crewIdx = car.CrewMemberIndex(player);
34
36 if (crewIdx < 0 || crewIdx > car.CrewSize() || car.GetCarDoorsState(car.GetDoorInvSlotNameFromSeatPos(crewIdx)) == CarDoorState.DOORS_MISSING)
37 {
38 return false;
39 }
40
42
44 if (!car.CanReachDoorsFromSeat(animSource, crewIdx) || !car.IsAreaAtDoorFree(crewIdx))
45 {
46 return false;
47 }
48
49 int safeCrewIdx = crewIdx % 4;
51
52 float animationPhaseInside = car.GetAnimationPhase(animSource);
53 return (m_IsOpening && animationPhaseInside <= 0.5) || (!m_IsOpening && animationPhaseInside > 0.5);
54 }
55 }
56
57 return false;
58 }
59
60 override void OnStartServer(ActionData action_data)
61 {
62 super.OnStartServer(action_data);
63
64 PlayerBase player = action_data.m_Player;
65
66 float phase;
67 if (m_IsOpening)
68 {
69 phase = 1.0;
70 }
71 else
72 {
73 phase = 0.0;
74 }
75
76 string animSource = "";
77
78 CarScript car;
79 if (player && player.GetCommand_Vehicle())
80 {
81 car = CarScript.Cast(player.GetCommand_Vehicle().GetTransport());
82 if (car)
83 {
84 int crewIdx = car.CrewMemberIndex(player);
86 }
87 }
88
89 if (car)
90 {
91 car.ForceUpdateLightsStart();
92 car.SetAnimationPhase(animSource, phase);
93 }
94 }
95
96 override void OnEndServer(ActionData action_data)
97 {
98 super.OnEndServer(action_data);
99
100 CarScript car;
101 PlayerBase player = action_data.m_Player;
102 if (player && player.GetCommand_Vehicle())
103 {
104 car = CarScript.Cast(player.GetCommand_Vehicle().GetTransport());
105 }
106
107 if (car)
108 {
109 car.ForceUpdateLightsEnd();
110 }
111 }
112
113 override void OnEnd(ActionData action_data)
114 {
115 if (m_Car || m_AnimSource.Length() > 0)
116 {
117 Error("[WARNING] m_Car and m_AnimSource are left for backwards compatibility to not crash mods that are using it, but should no longer be used.");
118 }
119 }
120
121 override bool CanBeUsedInVehicle()
122 {
123 return true;
124 }
125
126 override bool HasTarget()
127 {
128 return false;
129 }
130
131 protected void FillCommandUIDPerCrewIdx(int crewIdx0, int crewIdx1, int crewIdx2, int crewIdx3)
132 {
133 m_CommandUIDPerCrewIdx[0] = crewIdx0;
134 m_CommandUIDPerCrewIdx[1] = crewIdx1;
135 m_CommandUIDPerCrewIdx[2] = crewIdx2;
136 m_CommandUIDPerCrewIdx[3] = crewIdx3;
137 }
138
139 protected void FillCommandUIDPerCrewIdx(int evenCrewIdx0, int unevenCrewIdx1)
140 {
141 FillCommandUIDPerCrewIdx(evenCrewIdx0, unevenCrewIdx1, evenCrewIdx0, unevenCrewIdx1);
142 }
143};
ActionBase ActionData
Определения ActionBase.c:30
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
Определения ActionTargets.c:121
CarDoorState
Определения CarScript.c:2
int m_StanceMask
Определения ActionBase.c:62
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)
Определения ActionCarDoors.c:131
void ActionCarDoors()
Определения ActionCarDoors.c:10
bool m_IsOpening
Определения ActionCarDoors.c:4
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Определения ActionCarDoors.c:23
int m_CommandUIDPerCrewIdx[4]
Определения ActionCarDoors.c:3
override void CreateConditionComponents()
Определения ActionCarDoors.c:17
override bool HasTarget()
Определения ActionCarDoors.c:126
void FillCommandUIDPerCrewIdx(int evenCrewIdx0, int unevenCrewIdx1)
Определения ActionCarDoors.c:139
string m_AnimSource
Определения ActionCarDoors.c:7
CarScript m_Car
Определения ActionCarDoors.c:6
override bool CanBeUsedInVehicle()
Определения ActionCarDoors.c:121
override void OnStartServer(ActionData action_data)
Определения ActionCarDoors.c:60
override void OnEndServer(ActionData action_data)
Определения ActionCarDoors.c:96
override void OnEnd(ActionData action_data)
Определения ActionCarDoors.c:113
void ActionInteractBase()
Определения ActionInteractBase.c:43
int m_CommandUID
Определения AnimatedActionBase.c:143
Определения CCINone.c:2
Определения CCTNone.c:2
override string GetDoorSelectionNameFromSeatPos(int posIdx)
Определения CivilianSedan.c:241
override string GetDoorInvSlotNameFromSeatPos(int posIdx)
Определения CivilianSedan.c:262
override int GetCarDoorsState(string slotType)
Определения CivilianSedan.c:164
override string GetAnimSourceFromSelection(string selection)
Определения CivilianSedan.c:328
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
Определения CivilianSedan.c:379
Определения CivilianSedan.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения PlayerBaseClient.c:2
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.