DayZ 1.27
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 > 3 || 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
50
51 float animationPhaseInside = car.GetAnimationPhase(animSource);
52 return (m_IsOpening && animationPhaseInside <= 0.5) || (!m_IsOpening && animationPhaseInside > 0.5);
53 }
54 }
55
56 return false;
57 }
58
59 override void OnStartServer(ActionData action_data)
60 {
61 super.OnStartServer(action_data);
62
63 PlayerBase player = action_data.m_Player;
64
65 float phase;
66 if (m_IsOpening)
67 {
68 phase = 1.0;
69 }
70 else
71 {
72 phase = 0.0;
73 }
74
75 string animSource = "";
76
77 CarScript car;
78 if (player && player.GetCommand_Vehicle())
79 {
80 car = CarScript.Cast(player.GetCommand_Vehicle().GetTransport());
81 if (car)
82 {
83 int crewIdx = car.CrewMemberIndex(player);
85 }
86 }
87
88 if (car)
89 {
90 car.ForceUpdateLightsStart();
91 car.SetAnimationPhase(animSource, phase);
92 }
93 }
94
95 override void OnEndServer(ActionData action_data)
96 {
97 super.OnEndServer(action_data);
98
99 CarScript car;
100 PlayerBase player = action_data.m_Player;
101 if (player && player.GetCommand_Vehicle())
102 {
103 car = CarScript.Cast(player.GetCommand_Vehicle().GetTransport());
104 }
105
106 if (car)
107 {
108 car.ForceUpdateLightsEnd();
109 }
110 }
111
112 override void OnEnd(ActionData action_data)
113 {
114 if (m_Car || m_AnimSource.Length() > 0)
115 {
116 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.");
117 }
118 }
119
120 override bool CanBeUsedInVehicle()
121 {
122 return true;
123 }
124
125 override bool HasTarget()
126 {
127 return false;
128 }
129
130 protected void FillCommandUIDPerCrewIdx(int crewIdx0, int crewIdx1, int crewIdx2, int crewIdx3)
131 {
132 m_CommandUIDPerCrewIdx[0] = crewIdx0;
133 m_CommandUIDPerCrewIdx[1] = crewIdx1;
134 m_CommandUIDPerCrewIdx[2] = crewIdx2;
135 m_CommandUIDPerCrewIdx[3] = crewIdx3;
136 }
137
138 protected void FillCommandUIDPerCrewIdx(int evenCrewIdx0, int unevenCrewIdx1)
139 {
140 FillCommandUIDPerCrewIdx(evenCrewIdx0, unevenCrewIdx1, evenCrewIdx0, unevenCrewIdx1);
141 }
142};
ActionBase ActionData
Определения ActionBase.c:30
class ActionTargets ActionTarget
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:130
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:125
void FillCommandUIDPerCrewIdx(int evenCrewIdx0, int unevenCrewIdx1)
Определения ActionCarDoors.c:138
string m_AnimSource
Определения ActionCarDoors.c:7
CarScript m_Car
Определения ActionCarDoors.c:6
override bool CanBeUsedInVehicle()
Определения ActionCarDoors.c:120
override void OnStartServer(ActionData action_data)
Определения ActionCarDoors.c:59
override void OnEndServer(ActionData action_data)
Определения ActionCarDoors.c:95
override void OnEnd(ActionData action_data)
Определения ActionCarDoors.c:112
void ActionInteractBase()
Определения ActionInteractBase.c:43
int m_CommandUID
Определения AnimatedActionBase.c:143
Определения CCINone.c:2
Определения CCTNone.c:2
override string GetDoorSelectionNameFromSeatPos(int posIdx)
Определения CivilianSedan.c:240
override string GetDoorInvSlotNameFromSeatPos(int posIdx)
Определения CivilianSedan.c:261
override int GetCarDoorsState(string slotType)
Определения CivilianSedan.c:163
override string GetAnimSourceFromSelection(string selection)
Определения CivilianSedan.c:327
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
Определения CivilianSedan.c:378
Определения CivilianSedan.c:2
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения InventoryItem.c:731
Определения 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.