DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
3_Game/DayZ/Entities/Building.c
См. документацию.
1typedef Param1<int> DoorStartParams;
3typedef Param1<int> DoorLockParams;
4
11
12class BuildingType : EntityAIType
13{
14
15};
16
18{
19 // !! Move this to BuildingType !!
22
23 proto native int GetLaddersCount();
24 proto native vector GetLadderPosTop(int ladderIndex);
25 proto native vector GetLadderPosBottom(int ladderIndex);
26
28 proto native int GetDoorIndex(int componentIndex);
29
31 proto native int GetDoorCount();
32
34 proto native bool IsDoorOpen(int index);
35
37 proto native bool IsDoorOpening(int index);
38
40 proto native bool IsDoorOpeningAjar(int index);
41
43 proto native bool IsDoorClosing(int index);
44
46 proto native bool IsDoorOpened(int index);
47
49 proto native bool IsDoorOpenedAjar(int index);
50
52 proto native bool IsDoorClosed(int index);
53
55 proto native bool IsDoorLocked(int index);
56
58 proto native void PlayDoorSound(int index);
59
61 proto native void OpenDoor(int index);
62
64 proto native void CloseDoor(int index);
65
67 proto native void LockDoor(int index, bool force = false);
68
70 proto native void UnlockDoor(int index, bool animate = true);
71
73 proto native vector GetDoorSoundPos(int index);
74
76 proto native float GetDoorSoundDistance(int index);
77
79 proto native void OutputDoorLog();
80
83 {
84 float smallestDist = float.MAX;
85 int nearestDoor = -1;
86
87 int count = GetDoorCount();
88 for (int i = 0; i < count; i++)
89 {
90 float dist = vector.DistanceSq(GetDoorSoundPos(i), position);
91 if (dist < smallestDist)
92 {
93 nearestDoor = i;
94 smallestDist = dist;
95 }
96 }
97
98 return nearestDoor;
99 }
100
103 {
104 }
105
108 {
109 }
110
113 {
114 }
115
118 {
119 }
120
123 {
124 }
125
128 {
129 }
130
133 {
134 }
135
138 {
139 }
140
142 {
143 if (IsDoorOpen(params.m_DoorIndex))
144 return false;
145
146 if (params.m_CheckIfLocked)
147 {
148 if (IsDoorLocked(params.m_DoorIndex))
149 return false;
150 }
151 else
152 {
153 if (!IsDoorLocked(params.m_DoorIndex))
154 return false;
155 }
156
157 return true;
158 }
159
160 bool CanDoorBeOpened(int doorIndex, bool checkIfLocked = false)
161 {
163 doorParams.m_DoorIndex = doorIndex;
164 doorParams.m_CheckIfLocked = checkIfLocked;
165
166 return CanDoorBeOpened(doorParams);
167 }
168
169 bool CanDoorBeClosed(int doorIndex, Object caller)
170 {
171 return IsDoorOpen(doorIndex);
172 }
173
174 bool CanDoorBeClosed(int doorIndex)
175 {
176 return IsDoorOpen(doorIndex);
177 }
178
180 bool CanDoorBeLocked(int doorIndex)
181 {
182 return (!IsDoorOpen(doorIndex) && !IsDoorLocked(doorIndex));
183 }
184
194 {
196 }
197
198 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
199 {
200 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_OUTPUT_LOG, "Output Door Log", FadeColors.LIGHT_GREY));
201 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
202
203 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_PLAY_DOOR_SOUND, "Play Door Sound", FadeColors.LIGHT_GREY));
204 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_OPEN_DOOR, "Open Door", FadeColors.LIGHT_GREY));
205 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_CLOSE_DOOR, "Close Door", FadeColors.LIGHT_GREY));
206 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_LOCK_DOOR, "Lock Door", FadeColors.LIGHT_GREY));
207 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_UNLOCK_DOOR, "Unlock Door", FadeColors.LIGHT_GREY));
208 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
209
210 if (Gizmo_IsSupported())
211 {
212 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
213 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
214 }
215
216 super.GetDebugActions(outputList);
217 }
218
219 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
220 {
221 if (super.OnAction(action_id, player, ctx))
222 return true;
223
224 if (g_Game.IsClient() || !g_Game.IsMultiplayer())
225 {
226 switch (action_id)
227 {
228 case EActions.GIZMO_OBJECT:
229 if (GetGizmoApi())
231 return true;
232 }
233 }
234
235 switch (action_id)
236 {
237 case EActions.BUILDING_PLAY_DOOR_SOUND:
238 PlayDoorSound(GetNearestDoorBySoundPos(player.GetPosition()));
239 return true;
240 }
241
242 if (!g_Game.IsServer())
243 return false;
244
245 switch (action_id)
246 {
247 case EActions.BUILDING_OUTPUT_LOG:
249 return true;
250 case EActions.BUILDING_OPEN_DOOR:
251 OpenDoor(GetNearestDoorBySoundPos(player.GetPosition()));
252 return true;
253 case EActions.BUILDING_CLOSE_DOOR:
254 CloseDoor(GetNearestDoorBySoundPos(player.GetPosition()));
255 return true;
256 case EActions.BUILDING_LOCK_DOOR:
257 LockDoor(GetNearestDoorBySoundPos(player.GetPosition()));
258 return true;
259 case EActions.BUILDING_UNLOCK_DOOR:
260 UnlockDoor(GetNearestDoorBySoundPos(player.GetPosition()));
261 return true;
262 }
263
264 return false;
265 }
266
267 override bool IsBuilding()
268 {
269 return true;
270 }
271
272 override bool CanObstruct()
273 {
274 return true;
275 }
276
277 override bool DisableVicinityIcon()
278 {
279 return true;
280 }
281
282 override bool IsHealthVisible()
283 {
284 return CanUseConstruction();
285 }
286
287 override bool ShowZonesHealth()
288 {
289 return CanUseConstruction();
290 }
291
293
294 void Building()
295 {
297 g_Game.ConfigGetIntArray("cfgVehicles " +GetType() + " InteractActions", m_InteractActions);
298
300 }
301
302 protected void InitializeDoorInfos()
303 {
304 if (m_AdditionalDoorInfosMap.Contains(GetType())) //skip if already initialized
305 return;
306
308 holder.Init();
309 m_AdditionalDoorInfosMap.Set(GetType(),holder);
310 }
311
313 {
314 return m_AdditionalDoorInfosMap.Get(GetType()).GetSingleDoorInfo(doorIdx);
315 }
316
321
323 {
324 m_InstancedAttGroupData = new InstancedAttachmentGroupDataBuilding(this);
326 }
327
328 override bool IsInventoryVisible()
329 {
330 return CanUseConstruction() && GetInventory().GetAttachmentSlotsCount() > 0; //TODO: some location checks here?
331 }
332
334 {
335 return CanUseConstruction() && GetInventory().GetAttachmentSlotsCount() > 0; //TODO: some location checks here?
336 }
337
338 override int GetMeleeTargetType()
339 {
340 return EMeleeTargetType.NONALIGNABLE;
341 }
342};
343
344//-----------------------------------------------------------------------------
346{
347};
348
349//-----------------------------------------------------------------------------
350/*
351class WindSock : Entity
352{
353};
354*/
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()
void AdditionalDoorInfosHolder(string parentType)
Определения AdditionalDoorsInfo.c:54
override bool CanUseConstruction()
Определения BaseBuildingBase.c:2106
DayZGame g_Game
Определения DayZGame.c:4074
vector position
Определения DustKickupEffects.c:20
EActions
Определения EActions.c:2
EMeleeTargetType
Определения EMeleeTargetType.c:2
proto GizmoApi GetGizmoApi()
int m_LockCompatibilityBitMask
Name of the AnimationSource controlling door physics (required for rebuildable doors,...
Определения AdditionalDoorsInfo.c:11
Single door info.
Определения AdditionalDoorsInfo.c:3
proto native void OpenDoor(int index)
Attempts to open the door.
override bool IsDetectableByVicinityCone()
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.
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.
override bool DisableVicinityIcon()
proto native int GetDoorCount()
Returns the number of the doors in the building.
bool CanDoorBeClosed(int doorIndex, Object caller)
proto native bool IsDoorClosing(int index)
When the wanted phase is at the close phase target (0.0)
ref TIntArray m_InteractActions
AdditionalDoorInfo GetDoorInfo(int doorIdx)
bool CanDoorBeOpened(notnull DoorManipulationParams params)
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:82
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.
ref InstancedAttachmentGroupDataBase m_InstancedAttGroupData
Additional script info.
Определения 3_Game/DayZ/Entities/Building.c:21
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.
static ref map< string, ref AdditionalDoorInfosHolder > m_AdditionalDoorInfosMap
Определения 3_Game/DayZ/Entities/Building.c:20
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.
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)
AdditionalDoorInfosHolder GetDoorInfoHolder()
void OnDoorCloseFinish(DoorFinishParams params)
Event for when the door finishes closing.
proto native vector GetLadderPosBottom(int ladderIndex)
override bool ShowZonesHealth()
void InitializeInstanceAttachmentGroupsData()
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)
void InitializeDoorInfos()
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
Определения EntityAIType.c:2
void EntityType()
Определения EntityType.c:3
proto void SelectObject(Object object)
Contains derived info for multutude of uses.
Определения CachedInfosInstanced.c:3
Определения ObjectTyped.c:2
Определения PPEConstants.c:68
Определения Transport.c:70
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:733
const int SAT_DEBUG_ACTION
Определения 3_Game/DayZ/constants.c:486