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

◆ HandleWeaponEvents()

void HandleWeaponEvents ( float dt,
out bool exitIronSights )
protected

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

349 {
350 HumanCommandWeapons hcw = GetDayZPlayerOwner().GetCommandModifier_Weapons();
351
352 Weapon_Base weapon;
353 Class.CastTo(weapon, GetEntityInHands());
354
355 if (weapon)
356 {
357 weapon.UpdateCoolDown(dt);
358 if (hcw && weapon.CanProcessWeaponEvents())
359 {
360
361 weapon.GetCurrentState().OnUpdate(dt);
362
364 {
365 wpnDebugSpamALot("[wpnfsm] " + Object.GetDebugName(weapon) + " HCW: playing A=" + typename.EnumToString(WeaponActions, hcw.GetRunningAction()) + " AT=" + WeaponActionTypeToString(hcw.GetRunningAction(), hcw.GetRunningActionType()) + " fini=" + hcw.IsActionFinished());
366 }
367
368 if (!weapon.IsIdle())
369 {
370 while (true)
371 {
372 int weaponEventId = hcw.IsEvent();
373 if (weaponEventId == -1)
374 {
375 break;
376 }
377
378 if (weaponEventId == WeaponEvents.CHANGE_HIDE)
379 {
380 break;
381 }
382
383 WeaponEventBase anim_event = WeaponAnimEventFactory(weaponEventId, GetDayZPlayerOwner(), NULL);
384
386 {
387 wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " HandleWeapons: event arrived " + typename.EnumToString(WeaponEvents, weaponEventId) + "(" + weaponEventId + ") fsm_ev=" + anim_event.ToString());
388 }
389
390 if (anim_event != NULL)
391 {
392 weapon.ProcessWeaponEvent(anim_event);
393 }
394 }
395
396 if (hcw.IsActionFinished())
397 {
398 if (weapon.IsWaitingForActionFinish())
399 {
401 {
402 wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " Weapon event: finished! notifying waiting state=" + weapon.GetCurrentState());
403 }
404
405 weapon.ProcessWeaponEvent(new WeaponEventHumanCommandActionFinished(GetDayZPlayerOwner()));
406 }
407 else
408 {
410 {
411 wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " Weapon event: ABORT! notifying running state=" + weapon.GetCurrentState());
412 }
413
414 weapon.ProcessWeaponAbortEvent(new WeaponEventHumanCommandActionAborted(GetDayZPlayerOwner()));
415 }
416 }
417 }
418
420 {
422 {
423 wpnDebugPrint("[wpnfsm] " + Object.GetDebugName(weapon) + " Weapon event: deferred " + m_DeferredWeaponEvent.DumpToString());
424 }
425
426 if (weapon.ProcessWeaponEvent(m_DeferredWeaponEvent))
427 {
428 exitIronSights = true;
429
431 {
432 fsmDebugSpam("[wpnfsm] " + Object.GetDebugName(weapon) + " Weapon event: resetting deferred event" + m_DeferredWeaponEvent.DumpToString());
433 }
434
437 }
438 else if (!m_DeferredWeaponTimer.IsRunning())
439 {
440 m_DeferredWeaponTimer.Run(3, this, "DeferredWeaponFailed");
441 }
442 }
443 }
444 }
445 }
void wpnDebugSpamALot(string s)
void wpnDebugPrint(string s)
ref WeaponEventBase m_DeferredWeaponEvent
deferred hand event
Определения DayZPlayerInventory.c:155
DayZPlayer GetDayZPlayerOwner()
Определения DayZPlayerInventory.c:170
ref Timer m_DeferredWeaponTimer
Определения DayZPlayerInventory.c:150
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:1027
static bool IsWeaponLogEnable()
Определения 3_Game/DayZ/tools/Debug.c:829
Определения 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:843
WeaponEvents
events
Определения human.c:996
string WeaponActionTypeToString(int A, int AT)
Определения human.c:976

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