cacontinuousrepeatstartengine.c 950 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. class CAContinuousRepeatStartEngine : CAContinuousRepeat
  2. {
  3. void CAContinuousRepeatStartEngine( float time_to_complete_action )
  4. {
  5. m_DefaultTimeToComplete = time_to_complete_action;
  6. }
  7. override int Execute( ActionData action_data )
  8. {
  9. if ( !action_data.m_Player )
  10. {
  11. return UA_ERROR;
  12. }
  13. HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
  14. if( vehCommand )
  15. {
  16. Transport trans = vehCommand.GetTransport();
  17. if ( trans )
  18. {
  19. Car car;
  20. if ( Class.CastTo(car, trans) && car.EngineIsOn() )
  21. {
  22. return UA_FINISHED;
  23. }
  24. }
  25. }
  26. if ( m_TimeElpased < m_TimeToComplete )
  27. {
  28. m_TimeElpased += action_data.m_Player.GetDeltaT();
  29. m_TotalTimeElpased += action_data.m_Player.GetDeltaT();
  30. return UA_PROCESSING;
  31. }
  32. else
  33. {
  34. m_SpentUnits.param1 = m_TimeElpased;
  35. SetACData(m_SpentUnits);
  36. m_TimeElpased = 0;
  37. OnCompletePogress(action_data);
  38. return UA_PROCESSING;
  39. }
  40. }
  41. };