DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ OnActivatedByItem()

override void ImprovisedExplosive::OnActivatedByItem ( notnull ItemBase item)
inlineprotected

attachment special handling on disarm

go through attached explosives

hard-case blocks shells (result of deferred delete)

defer delete to allow ringing

final traverse - attached explosives activation

defer damage to trigger attachments to allow ringing

См. определение в файле ImprovisedExplosive.c строка 269

270 {
271 if (g_Game.IsServer() && GetArmed())
272 {
273 bool isTimeTriggered = false;
274
275 array<ItemBase> attachmentsCache = new array<ItemBase>();
276 for (int attachmentIdx = 0; attachmentIdx < GetInventory().AttachmentCount(); attachmentIdx++)
277 {
278 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(attachmentIdx));
279 if (attachment)
280 attachmentsCache.Insert(attachment);
281 }
282
283 foreach (ItemBase attachment1 : attachmentsCache)
284 attachment1.UnlockFromParent();
285
287 foreach (ItemBase attachment2 : attachmentsCache)
288 {
289 if (attachment2.IsInherited(ClockBase))
290 {
291 isTimeTriggered = true;
292 break;
293 }
294 }
295
297 foreach (ItemBase attachment3 : attachmentsCache)
298 {
299 if (attachment3)
300 {
301 vector dropExtents = "0.5 0.0 0.5";
302 if (isTimeTriggered)
303 dropExtents[1] = 0.15;
304
305 GetInventory().DropEntityInBounds(InventoryMode.SERVER, this, attachment3, dropExtents, 0, 0, 0);
306 attachment3.SetAnimationPhase(ANIM_PHASE_VISIBILITY, 1.0);
307 attachment3.SetTakeable(false);
308 }
309 }
310
311 float delayFor = TIME_TRIGGER_INITIAL_DELAY_SECS;
312 if (isTimeTriggered)
313 {
316 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(DeleteSafe, delayFor * 1000, false);
317 }
318 else
319 {
320 DeleteSafe();
321 }
322
324 foreach (ItemBase attachment4 : attachmentsCache)
325 {
326 if (attachment4.IsAnyInherited({RemoteDetonator, ClockBase}))
327 {
329 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(attachment4.DeleteSafe, delayFor * 1000, false);
330 }
331
332 if (attachment4 && !attachment4.IsAnyInherited({RemoteDetonator, ClockBase}))
333 {
334 Param1<ItemBase> params = new Param1<ItemBase>(attachment4);
335 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLaterByName(attachment4, "OnActivatedByItem", delayFor * 1000, false, params);
336 delayFor += TIME_TRIGGER_DELAY_SECS;
337 }
338 }
339 }
340 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
void ClockBase()
Определения ClockBase.c:27
DayZGame g_Game
Определения DayZGame.c:3942
bool GetArmed()
Определения ExplosivesBase.c:274
const string ANIM_PHASE_VISIBILITY
Определения ExplosivesBase.c:22
class GP5GasMask extends MaskBase ItemBase
const float TIME_TRIGGER_DELAY_SECS
Определения ImprovisedExplosive.c:5
const float TIME_TRIGGER_INITIAL_DELAY_SECS
Определения ImprovisedExplosive.c:3
const float TIME_TRIGGER_TIMER_BASED_DELAY_SECS
Определения ImprovisedExplosive.c:4
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/DayZ/tools/tools.c:8

Перекрестные ссылки ANIM_PHASE_VISIBILITY, CALL_CATEGORY_SYSTEM, ClockBase(), g_Game, GetArmed(), TIME_TRIGGER_DELAY_SECS, TIME_TRIGGER_INITIAL_DELAY_SECS и TIME_TRIGGER_TIMER_BASED_DELAY_SECS.