actiontunefrequency.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. class ActionTuneFrequencyCB : ActionContinuousBaseCB
  2. {
  3. private const float REPEAT_AFTER_SEC = 1.0;
  4. override void CreateActionComponent()
  5. {
  6. m_ActionData.m_ActionComponent = new CAContinuousRepeat(REPEAT_AFTER_SEC);
  7. }
  8. }
  9. class ActionTuneFrequency: ActionContinuousBase
  10. {
  11. void ActionTuneFrequency()
  12. {
  13. m_CallbackClass = ActionTuneFrequencyCB;
  14. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_ITEM_TUNE;
  15. m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_ITEM_TUNE;
  16. m_SpecialtyWeight = UASoftSkillsWeight.ROUGH_LOW;
  17. m_Text = "#tune_frequency";
  18. }
  19. override void CreateConditionComponents()
  20. {
  21. m_ConditionTarget = new CCTNone;
  22. m_ConditionItem = new CCINonRuined;
  23. }
  24. override bool HasProneException()
  25. {
  26. return true;
  27. }
  28. override bool HasTarget()
  29. {
  30. return false;
  31. }
  32. override bool ActionCondition ( PlayerBase player, ActionTarget target, ItemBase item )
  33. {
  34. if ( item.IsTransmitter() )
  35. {
  36. TransmitterBase transmitter = TransmitterBase.Cast( item );
  37. if ( transmitter.GetCompEM().IsWorking() )
  38. {
  39. //transmitter.DisplayRadioInfo( transmitter.GetTunedFrequency().ToString(), player );
  40. return true;
  41. }
  42. }
  43. return false;
  44. }
  45. override void OnFinishProgressServer( ActionData action_data )
  46. {
  47. TransmitterBase transmitter = TransmitterBase.Cast( action_data.m_MainItem );
  48. transmitter.SetNextFrequency( action_data.m_Player );
  49. }
  50. }