actionraisemegaphone.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. class ActionRaiseMegaphoneCB : ActionContinuousBaseCB
  2. {
  3. private const float REPEAT_AFTER_SEC = -1.0;
  4. override void CreateActionComponent()
  5. {
  6. m_ActionData.m_ActionComponent = new CAContinuousTime( -1 );
  7. }
  8. }
  9. class ActionRaiseMegaphone: ActionContinuousBase
  10. {
  11. void ActionRaiseMegaphone()
  12. {
  13. m_CallbackClass = ActionRaiseMegaphoneCB;
  14. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_RAISEITEM;
  15. m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_RAISEITEM;
  16. m_Text = "#raise_megaphone";
  17. }
  18. override void CreateConditionComponents()
  19. {
  20. m_ConditionTarget = new CCTNone;
  21. m_ConditionItem = new CCINonRuined;
  22. }
  23. override bool HasProneException()
  24. {
  25. return true;
  26. }
  27. override bool HasProgress()
  28. {
  29. return false;
  30. }
  31. override bool HasTarget()
  32. {
  33. return false;
  34. }
  35. override bool ActionCondition ( PlayerBase player, ActionTarget target, ItemBase item )
  36. {
  37. if ( item.IsTransmitter() )
  38. {
  39. ItemMegaphone megaphone = ItemMegaphone.Cast( item );
  40. if ( megaphone && megaphone.GetCompEM().IsWorking() )
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. override void OnStartServer( ActionData action_data )
  48. {
  49. super.OnStartServer(action_data);
  50. ItemMegaphone megaphone = ItemMegaphone.Cast( action_data.m_MainItem );
  51. megaphone.SetCanSpeak( true );
  52. }
  53. override void OnEndServer( ActionData action_data )
  54. {
  55. super.OnEndServer(action_data);
  56. ItemMegaphone megaphone = ItemMegaphone.Cast( action_data.m_MainItem );
  57. megaphone.SetCanSpeak( false );
  58. }
  59. override void OnStartClient( ActionData action_data )
  60. {
  61. ItemMegaphone megaphone = ItemMegaphone.Cast( action_data.m_MainItem );
  62. megaphone.SetCanSpeak( true );
  63. }
  64. override void OnEndClient( ActionData action_data )
  65. {
  66. ItemMegaphone megaphone = ItemMegaphone.Cast( action_data.m_MainItem );
  67. megaphone.SetCanSpeak( false );
  68. }
  69. }