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

◆ HandleWeaponEvents()

void HandleWeaponEvents ( float dt,
out bool exitIronSights )
protected

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

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

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