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

◆ HandleWeaponEvents()

void HandleWeaponEvents ( float dt,
out bool exitIronSights )
protected

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

347 {
348 HumanCommandWeapons hcw = GetDayZPlayerOwner().GetCommandModifier_Weapons();
349
350 Weapon_Base weapon;
351 Class.CastTo(weapon, GetEntityInHands());
352
353 if (weapon)
354 {
355 weapon.UpdateCoolDown(dt);
356 if (hcw && weapon.CanProcessWeaponEvents())
357 {
358
359 weapon.GetCurrentState().OnUpdate(dt);
360
362 {
363 wpnDebugSpamALot("[wpnfsm] " + Object.GetDebugName(weapon) + " HCW: playing A=" + typename.EnumToString(WeaponActions, hcw.GetRunningAction()) + " AT=" + WeaponActionTypeToString(hcw.GetRunningAction(), hcw.GetRunningActionType()) + " fini=" + hcw.IsActionFinished());
364 }
365
366 if (!weapon.IsIdle())
367 {
368 while (true)
369 {
370 int weaponEventId = hcw.IsEvent();
371 if (weaponEventId == -1)
372 {
373 break;
374 }
375
376 if (weaponEventId == WeaponEvents.CHANGE_HIDE)
377 {
378 break;
379 }
380
381 WeaponEventBase anim_event = WeaponAnimEventFactory(weaponEventId, GetDayZPlayerOwner(), NULL);
382
384 {
385 wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " HandleWeapons: event arrived " + typename.EnumToString(WeaponEvents, weaponEventId) + "(" + weaponEventId + ") fsm_ev=" + anim_event.ToString());
386 }
387
388 if (anim_event != NULL)
389 {
390 weapon.ProcessWeaponEvent(anim_event);
391 }
392 }
393
394 if (hcw.IsActionFinished())
395 {
396 if (weapon.IsWaitingForActionFinish())
397 {
399 {
400 wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " Weapon event: finished! notifying waiting state=" + weapon.GetCurrentState());
401 }
402
403 weapon.ProcessWeaponEvent(new WeaponEventHumanCommandActionFinished(GetDayZPlayerOwner()));
404 }
405 else
406 {
408 {
409 wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " Weapon event: ABORT! notifying running state=" + weapon.GetCurrentState());
410 }
411
412 weapon.ProcessWeaponAbortEvent(new WeaponEventHumanCommandActionAborted(GetDayZPlayerOwner()));
413 }
414 }
415 }
416
418 {
420 {
421 wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " Weapon event: deferred " + m_DeferredWeaponEvent.DumpToString());
422 }
423
424 if (weapon.ProcessWeaponEvent(m_DeferredWeaponEvent))
425 {
426 exitIronSights = true;
427
429 {
430 fsmDebugSpam("[wpnfsm] " + Object.GetDebugName(weapon) + " Weapon event: resetting deferred event" + m_DeferredWeaponEvent.DumpToString());
431 }
432
435 }
436 else if (!m_DeferredWeaponTimer.IsRunning())
437 {
438 m_DeferredWeaponTimer.Run(3, this, "DeferredWeaponFailed");
439 }
440 }
441 }
442 }
443 }
void wpnDebugSpamALot(string s)
Определения Debug.c:25
void wpnDebugPrint(string s)
Определения Debug.c:9
ref WeaponEventBase m_DeferredWeaponEvent
deferred hand event
Определения DayZPlayerInventory.c:156
DayZPlayer GetDayZPlayerOwner()
Определения DayZPlayerInventory.c:168
ref Timer m_DeferredWeaponTimer
Определения DayZPlayerInventory.c:151
WeaponEventBase WeaponAnimEventFactory(WeaponEvents type, DayZPlayer p=NULL, Magazine m=NULL)
creates animation system events
Определения Events.c:251
void fsmDebugSpam(string s)
Определения HFSMBase.c:9
Super root of all classes in Enforce script.
Определения EnScript.c:11
proto native bool IsActionFinished()
proto native int GetRunningAction()
returns -1 when no action is running or RELOAD,MECHANISM, ....
proto native int IsEvent()
return -1 when there is no event, otherwise it returns pId of event from animation
proto native int GetRunningActionType()
returns -1 when no action is running or appropriate action type
Определения human.c:994
static bool IsWeaponLogEnable()
Определения Debug.c:718
Определения Debug.c:594
Определения ObjectTyped.c:2
shorthand
Определения BoltActionRifle_Base.c:6
signalize mechanism manipulation
Определения Events.c:35
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
WeaponActions
actions
Определения human.c:816
WeaponEvents
events
Определения human.c:963
string WeaponActionTypeToString(int A, int AT)
Определения human.c:943

Перекрестные ссылки Class::CastTo(), fsmDebugSpam(), GetDayZPlayerOwner(), HumanCommandWeapons::GetRunningAction(), HumanCommandWeapons::GetRunningActionType(), HumanCommandWeapons::IsActionFinished(), HumanCommandWeapons::IsEvent(), LogManager::IsWeaponLogEnable(), m_DeferredWeaponEvent, m_DeferredWeaponTimer, WeaponActionTypeToString(), WeaponAnimEventFactory(), wpnDebugPrint() и wpnDebugSpamALot().