DayZ 1.27
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 (GetGame().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 GetGame().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 GetGame().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 GetGame().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.
Определения Inventory.c:22
void ClockBase()
Определения ClockBase.c:27
bool GetArmed()
Определения ExplosivesBase.c:266
const string ANIM_PHASE_VISIBILITY
Определения ExplosivesBase.c:22
class GP5GasMask extends MaskBase ItemBase
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
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
proto void CallLaterByName(Class obj, string fnName, int delay=0, bool repeat=false, Param params=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto native CGame GetGame()
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8

Перекрестные ссылки ANIM_PHASE_VISIBILITY, CALL_CATEGORY_SYSTEM, ScriptCallQueue::CallLater(), ScriptCallQueue::CallLaterByName(), ClockBase(), GetArmed(), CGame::GetCallQueue(), GetGame(), TIME_TRIGGER_DELAY_SECS, TIME_TRIGGER_INITIAL_DELAY_SECS и TIME_TRIGGER_TIMER_BASED_DELAY_SECS.