weaponstartaction.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**@class WeaponStartAction
  2. * @brief simple class starting animation action specified by m_action and m_actionType
  3. */
  4. class WeaponStartAction extends WeaponStateBase
  5. {
  6. WeaponActions m_action; /// action to be played
  7. int m_actionType; /// specific action sub-type
  8. void WeaponStartAction (Weapon_Base w = NULL, WeaponStateBase parent = NULL, WeaponActions action = WeaponActions.NONE, int actionType = -1)
  9. {
  10. m_action = action;
  11. m_actionType = actionType;
  12. }
  13. override void OnEntry (WeaponEventBase e)
  14. {
  15. super.OnEntry(e);
  16. if (e)
  17. {
  18. if (e.m_player)
  19. {
  20. HumanCommandWeapons hcw = e.m_player.GetCommandModifier_Weapons();
  21. if (hcw)
  22. {
  23. HumanCommandAdditives ad = e.m_player.GetCommandModifier_Additives();
  24. if (ad)
  25. ad.CancelModifier();
  26. hcw.StartAction(m_action, m_actionType);
  27. if (hcw.GetRunningAction() == m_action && hcw.GetRunningActionType() == m_actionType)
  28. {
  29. if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("HCW: playing A=" + typename.EnumToString(WeaponActions, m_action) + " AT=" + WeaponActionTypeToString(m_action, m_actionType) + " fini=" + hcw.IsActionFinished()); }
  30. }
  31. else
  32. Error("HCW: NOT playing A=" + typename.EnumToString(WeaponActions, m_action) + " AT=" + WeaponActionTypeToString(m_action, m_actionType) + " fini=" + hcw.IsActionFinished());
  33. }
  34. else
  35. if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("---: remote playing A=" + typename.EnumToString(WeaponActions, m_action) + " AT=" + WeaponActionTypeToString(m_action, m_actionType)); }
  36. }
  37. else
  38. {
  39. if (LogManager.IsWeaponLogEnable()) { wpnDebugPrint("---: warning, no player wants to play A=" + typename.EnumToString(WeaponActions, m_action) + " AT=" + WeaponActionTypeToString(m_action, m_actionType)); }
  40. }
  41. }
  42. }
  43. override void OnExit (WeaponEventBase e)
  44. {
  45. super.OnExit(e);
  46. }
  47. };