DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
3_Game/DayZ/Entities/Building.c
См. документацию.
1typedef Param1<int> DoorStartParams;
3typedef Param1<int> DoorLockParams;
4
6{
7
8};
9
11{
12 proto native int GetLaddersCount();
13 proto native vector GetLadderPosTop(int ladderIndex);
14 proto native vector GetLadderPosBottom(int ladderIndex);
15
17 proto native int GetDoorIndex(int componentIndex);
18
20 proto native int GetDoorCount();
21
23 proto native bool IsDoorOpen(int index);
24
26 proto native bool IsDoorOpening(int index);
27
29 proto native bool IsDoorOpeningAjar(int index);
30
32 proto native bool IsDoorClosing(int index);
33
35 proto native bool IsDoorOpened(int index);
36
38 proto native bool IsDoorOpenedAjar(int index);
39
41 proto native bool IsDoorClosed(int index);
42
44 proto native bool IsDoorLocked(int index);
45
47 proto native void PlayDoorSound(int index);
48
50 proto native void OpenDoor(int index);
51
53 proto native void CloseDoor(int index);
54
56 proto native void LockDoor(int index, bool force = false);
57
59 proto native void UnlockDoor(int index, bool animate = true);
60
62 proto native vector GetDoorSoundPos(int index);
63
65 proto native float GetDoorSoundDistance(int index);
66
68 proto native void OutputDoorLog();
69
72 {
73 float smallestDist = float.MAX;
74 int nearestDoor = -1;
75
76 int count = GetDoorCount();
77 for (int i = 0; i < count; i++)
78 {
79 float dist = vector.DistanceSq(GetDoorSoundPos(i), position);
80 if (dist < smallestDist)
81 {
82 nearestDoor = i;
83 smallestDist = dist;
84 }
85 }
86
87 return nearestDoor;
88 }
89
92 {
93 }
94
97 {
98 }
99
102 {
103 }
104
107 {
108 }
109
112 {
113 }
114
117 {
118 }
119
122 {
123 }
124
127 {
128 }
129
130 bool CanDoorBeOpened(int doorIndex, bool checkIfLocked = false)
131 {
132 if (IsDoorOpen(doorIndex))
133 return false;
134
135 if (checkIfLocked)
136 {
137 if (IsDoorLocked(doorIndex))
138 return false;
139 }
140 else
141 {
142 if (!IsDoorLocked(doorIndex))
143 return false;
144 }
145 return true;
146 }
147
148 bool CanDoorBeClosed(int doorIndex)
149 {
150 return IsDoorOpen(doorIndex);
151 }
152
154 bool CanDoorBeLocked(int doorIndex)
155 {
156 return (!IsDoorOpen(doorIndex) && !IsDoorLocked(doorIndex));
157 }
158
168 {
169 return 1 << EBuildingLockType.LOCKPICK; //all doors are lockpickable by default
170 }
171
172 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
173 {
174 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_OUTPUT_LOG, "Output Door Log", FadeColors.LIGHT_GREY));
175 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
176
177 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_PLAY_DOOR_SOUND, "Play Door Sound", FadeColors.LIGHT_GREY));
178 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_OPEN_DOOR, "Open Door", FadeColors.LIGHT_GREY));
179 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_CLOSE_DOOR, "Close Door", FadeColors.LIGHT_GREY));
180 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_LOCK_DOOR, "Lock Door", FadeColors.LIGHT_GREY));
181 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_UNLOCK_DOOR, "Unlock Door", FadeColors.LIGHT_GREY));
182 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
183
184 if (Gizmo_IsSupported())
185 {
186 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
187 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
188 }
189
190 super.GetDebugActions(outputList);
191 }
192
193 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
194 {
195 if (super.OnAction(action_id, player, ctx))
196 return true;
197
198 if (g_Game.IsClient() || !g_Game.IsMultiplayer())
199 {
200 switch (action_id)
201 {
202 case EActions.GIZMO_OBJECT:
203 if (GetGizmoApi())
205 return true;
206 }
207 }
208
209 switch (action_id)
210 {
211 case EActions.BUILDING_PLAY_DOOR_SOUND:
212 PlayDoorSound(GetNearestDoorBySoundPos(player.GetPosition()));
213 return true;
214 }
215
216 if (!g_Game.IsServer())
217 return false;
218
219 switch (action_id)
220 {
221 case EActions.BUILDING_OUTPUT_LOG:
223 return true;
224 case EActions.BUILDING_OPEN_DOOR:
225 OpenDoor(GetNearestDoorBySoundPos(player.GetPosition()));
226 return true;
227 case EActions.BUILDING_CLOSE_DOOR:
228 CloseDoor(GetNearestDoorBySoundPos(player.GetPosition()));
229 return true;
230 case EActions.BUILDING_LOCK_DOOR:
231 LockDoor(GetNearestDoorBySoundPos(player.GetPosition()));
232 return true;
233 case EActions.BUILDING_UNLOCK_DOOR:
234 UnlockDoor(GetNearestDoorBySoundPos(player.GetPosition()));
235 return true;
236 }
237
238 return false;
239 }
240
241 override bool IsBuilding()
242 {
243 return true;
244 }
245
246 override bool CanObstruct()
247 {
248 return true;
249 }
250
251 override bool IsHealthVisible()
252 {
253 return false;
254 }
255
257
258 void Building()
259 {
261 g_Game.ConfigGetIntArray("cfgVehicles " +GetType() + " InteractActions", m_InteractActions);
262 }
263
264 override bool IsInventoryVisible()
265 {
266 return false;
267 }
268
269 override int GetMeleeTargetType()
270 {
271 return EMeleeTargetType.NONALIGNABLE;
272 }
273};
274
275//-----------------------------------------------------------------------------
277{
278};
279
280//-----------------------------------------------------------------------------
281/*
282class WindSock : Entity
283{
284};
285*/
Param1< int > DoorStartParams
Определения 3_Game/DayZ/Entities/Building.c:1
Param2< int, bool > DoorFinishParams
Определения 3_Game/DayZ/Entities/Building.c:2
Param1< int > DoorLockParams
Определения 3_Game/DayZ/Entities/Building.c:3
Param4< int, int, string, int > TSelectableActionInfoWithColor
eBleedingSourceType GetType()
DayZGame g_Game
Определения DayZGame.c:3942
EActions
Определения EActions.c:2
EBuildingLockType
Определения EBuildingLockTypes.c:2
EMeleeTargetType
Определения EMeleeTargetType.c:2
proto GizmoApi GetGizmoApi()
proto native void OpenDoor(int index)
Attempts to open the door.
proto native void LockDoor(int index, bool force=false)
Locks the door if not already locked, resets the door health. 'force = true' will close the door if o...
void OnDoorOpenFinish(DoorFinishParams params)
Event for when the door finishes opening.
Определения 3_Game/DayZ/Entities/Building.c:96
override bool IsInventoryVisible()
proto native bool IsDoorOpened(int index)
When the phase is at the open phase target (1.0)
void OnDoorUnlocked(DoorLockParams params)
Event for when the door is unlocked.
proto native int GetDoorCount()
Returns the number of the doors in the building.
proto native bool IsDoorClosing(int index)
When the wanted phase is at the close phase target (0.0)
ref TIntArray m_InteractActions
void OnDoorCloseStart(DoorStartParams params)
Event for when the door starts closing.
proto native int GetLaddersCount()
int GetNearestDoorBySoundPos(vector position)
Gets the nearest door based on the sound position (quick and dirty function for debugging)
Определения 3_Game/DayZ/Entities/Building.c:71
bool CanDoorBeOpened(int doorIndex, bool checkIfLocked=false)
proto native vector GetDoorSoundPos(int index)
Position in world space for where the door sounds are played from.
proto native void CloseDoor(int index)
Attempts to close the door.
bool CanDoorBeLocked(int doorIndex)
Check if the door is closed and if the door is unlocked.
proto native void PlayDoorSound(int index)
Plays the appropriate sound at the door, based on animation phase and state.
proto native bool IsDoorClosed(int index)
When the phase is at the close phase target (0.0)
proto native float GetDoorSoundDistance(int index)
Audible distance for the door sound.
void OnDoorOpenStart(DoorStartParams params)
Event for when the door starts opening.
Определения 3_Game/DayZ/Entities/Building.c:91
proto native void UnlockDoor(int index, bool animate=true)
Unlocks the door if locked, AJAR animation optional.
override bool CanObstruct()
proto native bool IsDoorOpenedAjar(int index)
When the phase is at the ajar phase target (0.2)
void OnDoorOpenAjarStart(DoorStartParams params)
Event for when the door starts opening ajarred (usually after unlock)
override bool IsHealthVisible()
proto native vector GetLadderPosTop(int ladderIndex)
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
int GetLockCompatibilityType(int doorIdx)
Which door is compatible with which key (door idx supplied). Bitwise.
void OnDoorLocked(DoorLockParams params)
Event for when the door is locked.
proto native bool IsDoorLocked(int index)
When the door is locked.
proto native bool IsDoorOpen(int index)
When the door is requested to be fully open (animation wanted phase is greater than 0....
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
void OnDoorCloseFinish(DoorFinishParams params)
Event for when the door finishes closing.
proto native vector GetLadderPosBottom(int ladderIndex)
proto native bool IsDoorOpeningAjar(int index)
When the wanted phase is at the ajar phase target (0.2)
proto native bool IsDoorOpening(int index)
When the wanted phase is at the open phase target (1.0)
proto native void OutputDoorLog()
Requires special build as logging is disabled even on internal builds due to memory usage....
void Building()
void OnDoorOpenAjarFinish(DoorFinishParams params)
Event for when the door finishes opening ajarred (usually after unlock)
proto native int GetDoorIndex(int componentIndex)
Gets the index of the door based on the view geometry component index.
override bool IsBuilding()
override int GetMeleeTargetType()
bool CanDoorBeClosed(int doorIndex)
void Man()
Определения 3_Game/DayZ/Entities/Man.c:43
void EntityAIType()
Определения EntityAIType.c:3
void EntityType()
Определения EntityType.c:3
proto void SelectObject(Object object)
Определения PPEConstants.c:68
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
Определения EnConvert.c:119
Serializer ParamsReadContext
Определения gameplay.c:15
array< int > TIntArray
Определения EnScript.c:714
const int SAT_DEBUG_ACTION
Определения 3_Game/DayZ/constants.c:457