DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Building.c
См. документацию.
1typedef Param1<int> DoorStartParams;
3typedef Param1<int> DoorLockParams;
4
5class Building extends EntityAI
6{
7 proto native int GetLaddersCount();
8 proto native vector GetLadderPosTop(int ladderIndex);
9 proto native vector GetLadderPosBottom(int ladderIndex);
10
12 proto native int GetDoorIndex(int componentIndex);
13
15 proto native int GetDoorCount();
16
18 proto native bool IsDoorOpen(int index);
19
21 proto native bool IsDoorOpening(int index);
22
24 proto native bool IsDoorOpeningAjar(int index);
25
27 proto native bool IsDoorClosing(int index);
28
30 proto native bool IsDoorOpened(int index);
31
33 proto native bool IsDoorOpenedAjar(int index);
34
36 proto native bool IsDoorClosed(int index);
37
39 proto native bool IsDoorLocked(int index);
40
42 proto native void PlayDoorSound(int index);
43
45 proto native void OpenDoor(int index);
46
48 proto native void CloseDoor(int index);
49
51 proto native void LockDoor(int index, bool force = false);
52
54 proto native void UnlockDoor(int index, bool animate = true);
55
57 proto native vector GetDoorSoundPos(int index);
58
60 proto native float GetDoorSoundDistance(int index);
61
63 proto native void OutputDoorLog();
64
67 {
68 float smallestDist = float.MAX;
69 int nearestDoor = -1;
70
71 int count = GetDoorCount();
72 for (int i = 0; i < count; i++)
73 {
74 float dist = vector.DistanceSq(GetDoorSoundPos(i), position);
75 if (dist < smallestDist)
76 {
77 nearestDoor = i;
78 smallestDist = dist;
79 }
80 }
81
82 return nearestDoor;
83 }
84
87 {
88 }
89
92 {
93 }
94
97 {
98 }
99
102 {
103 }
104
107 {
108 }
109
112 {
113 }
114
117 {
118 }
119
122 {
123 }
124
125 bool CanDoorBeOpened(int doorIndex, bool checkIfLocked = false)
126 {
127 if (IsDoorOpen(doorIndex))
128 return false;
129
130 if (checkIfLocked)
131 {
132 if (IsDoorLocked(doorIndex))
133 return false;
134 }
135 else
136 {
137 if (!IsDoorLocked(doorIndex))
138 return false;
139 }
140 return true;
141 }
142
143 bool CanDoorBeClosed(int doorIndex)
144 {
145 return IsDoorOpen(doorIndex);
146 }
147
149 bool CanDoorBeLocked(int doorIndex)
150 {
151 return (!IsDoorOpen(doorIndex) && !IsDoorLocked(doorIndex));
152 }
153
163 {
164 return 1 << EBuildingLockType.LOCKPICK; //all doors are lockpickable by default
165 }
166
167 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
168 {
169 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_OUTPUT_LOG, "Output Door Log", FadeColors.LIGHT_GREY));
170 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, " --- ", FadeColors.LIGHT_GREY));
171
172 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_PLAY_DOOR_SOUND, "Play Door Sound", FadeColors.LIGHT_GREY));
173 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_OPEN_DOOR, "Open Door", FadeColors.LIGHT_GREY));
174 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_CLOSE_DOOR, "Close Door", FadeColors.LIGHT_GREY));
175 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_LOCK_DOOR, "Lock Door", FadeColors.LIGHT_GREY));
176 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.BUILDING_UNLOCK_DOOR, "Unlock Door", FadeColors.LIGHT_GREY));
177 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, " --- ", FadeColors.LIGHT_GREY));
178
179 super.GetDebugActions(outputList);
180 }
181
182 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
183 {
184 if (super.OnAction(action_id, player, ctx))
185 return true;
186
187 switch (action_id)
188 {
189 case EActions.BUILDING_PLAY_DOOR_SOUND:
190 PlayDoorSound(GetNearestDoorBySoundPos(player.GetPosition()));
191 return true;
192 }
193
194 if (!GetGame().IsServer())
195 return false;
196
197 switch (action_id)
198 {
199 case EActions.BUILDING_OUTPUT_LOG:
201 return true;
202 case EActions.BUILDING_OPEN_DOOR:
203 OpenDoor(GetNearestDoorBySoundPos(player.GetPosition()));
204 return true;
205 case EActions.BUILDING_CLOSE_DOOR:
206 CloseDoor(GetNearestDoorBySoundPos(player.GetPosition()));
207 return true;
208 case EActions.BUILDING_LOCK_DOOR:
209 LockDoor(GetNearestDoorBySoundPos(player.GetPosition()));
210 return true;
211 case EActions.BUILDING_UNLOCK_DOOR:
212 UnlockDoor(GetNearestDoorBySoundPos(player.GetPosition()));
213 return true;
214 }
215
216 return false;
217 }
218
219 override bool IsBuilding()
220 {
221 return true;
222 }
223
224 override bool CanObstruct()
225 {
226 return true;
227 }
228
229 override bool IsHealthVisible()
230 {
231 return false;
232 }
233
235
236 void Building()
237 {
239 g_Game.ConfigGetIntArray("cfgVehicles " +GetType() + " InteractActions", m_InteractActions);
240 }
241
242 override bool IsInventoryVisible()
243 {
244 return false;
245 }
246
247 override int GetMeleeTargetType()
248 {
249 return EMeleeTargetType.NONALIGNABLE;
250 }
251};
Param1< int > DoorStartParams
Определения Building.c:1
Param2< int, bool > DoorFinishParams
Определения Building.c:2
Param1< int > DoorLockParams
Определения Building.c:3
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения EntityAI.c:97
eBleedingSourceType GetType()
Определения BleedingSource.c:63
DayZGame g_Game
Определения DayZGame.c:3868
EActions
Определения EActions.c:2
EBuildingLockType
Определения EBuildingLockTypes.c:2
EMeleeTargetType
Определения EMeleeTargetType.c:2
ref TIntArray m_InteractActions
Определения Building.c:234
proto native bool IsDoorClosed(int index)
When the phase is at the close phase target (0.0)
proto native vector GetLadderPosBottom(int ladderIndex)
override bool IsHealthVisible()
Определения Building.c:229
proto native bool IsDoorClosing(int index)
When the wanted phase is at the close phase target (0.0)
void Building()
Определения Building.c:236
proto native int GetLaddersCount()
override bool CanObstruct()
Определения Building.c:224
void OnDoorCloseFinish(DoorFinishParams params)
Event for when the door finishes closing.
Определения Building.c:111
proto native void CloseDoor(int index)
Attempts to close the door.
proto native bool IsDoorOpening(int index)
When the wanted phase is at the open phase target (1.0)
int GetNearestDoorBySoundPos(vector position)
Gets the nearest door based on the sound position (quick and dirty function for debugging)
Определения Building.c:66
proto native bool IsDoorOpened(int index)
When the phase is at the open phase target (1.0)
int GetLockCompatibilityType(int doorIdx)
Which door is compatible with which key (door idx supplied). Bitwise.
Определения Building.c:162
void OnDoorCloseStart(DoorStartParams params)
Event for when the door starts closing.
Определения Building.c:106
void Man()
Определения Man.c:39
proto native bool IsDoorLocked(int index)
When the door is locked.
override int GetMeleeTargetType()
Определения Building.c:247
proto native bool IsDoorOpeningAjar(int index)
When the wanted phase is at the ajar phase target (0.2)
proto native void OpenDoor(int index)
Attempts to open the door.
override bool IsBuilding()
Определения Building.c:219
void OnDoorOpenAjarStart(DoorStartParams params)
Event for when the door starts opening ajarred (usually after unlock)
Определения Building.c:96
void OnDoorLocked(DoorLockParams params)
Event for when the door is locked.
Определения Building.c:116
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...
proto native void OutputDoorLog()
Requires special build as logging is disabled even on internal builds due to memory usage....
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения Building.c:182
proto native int GetDoorCount()
Returns the number of the doors in the building.
proto native void PlayDoorSound(int index)
Plays the appropriate sound at the door, based on animation phase and state.
void OnDoorOpenStart(DoorStartParams params)
Event for when the door starts opening.
Определения Building.c:86
proto native vector GetLadderPosTop(int ladderIndex)
void OnDoorOpenAjarFinish(DoorFinishParams params)
Event for when the door finishes opening ajarred (usually after unlock)
Определения Building.c:101
bool CanDoorBeOpened(int doorIndex, bool checkIfLocked=false)
Определения Building.c:125
proto native float GetDoorSoundDistance(int index)
Audible distance for the door sound.
proto native bool IsDoorOpenedAjar(int index)
When the phase is at the ajar phase target (0.2)
bool CanDoorBeLocked(int doorIndex)
Check if the door is closed and if the door is unlocked.
Определения Building.c:149
proto native bool IsDoorOpen(int index)
When the door is requested to be fully open (animation wanted phase is greater than 0....
override bool IsInventoryVisible()
Определения Building.c:242
bool CanDoorBeClosed(int doorIndex)
Определения Building.c:143
void OnDoorUnlocked(DoorLockParams params)
Event for when the door is unlocked.
Определения Building.c:121
proto native vector GetDoorSoundPos(int index)
Position in world space for where the door sounds are played from.
proto native int GetDoorIndex(int componentIndex)
Gets the index of the door based on the view geometry component index.
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения Building.c:167
void OnDoorOpenFinish(DoorFinishParams params)
Event for when the door finishes opening.
Определения Building.c:91
proto native void UnlockDoor(int index, bool animate=true)
Unlocks the door if locked, AJAR animation optional.
Определения Building.c:6
Определения PPEConstants.c:68
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
Определения EnConvert.c:106
Serializer ParamsReadContext
Определения gameplay.c:15
proto native CGame GetGame()
array< int > TIntArray
Определения EnScript.c:687
const int SAT_DEBUG_ACTION
Определения constants.c:452