actionstopengineboat.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. class ActionStopEngineBoat: ActionSingleUseBase
  2. {
  3. void ActionStopEngineBoat()
  4. {
  5. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_STOPENGINE;
  6. m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
  7. m_Text = "#stop_engine";
  8. }
  9. override void CreateConditionComponents()
  10. {
  11. m_ConditionItem = new CCINone;
  12. m_ConditionTarget = new CCTNone;
  13. }
  14. override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
  15. {
  16. HumanCommandVehicle vehCmd = player.GetCommand_Vehicle();
  17. if (vehCmd && vehCmd.GetVehicleSeat() == DayZPlayerConstants.VEHICLESEAT_DRIVER)
  18. {
  19. Transport trans = vehCmd.GetTransport();
  20. if (!trans)
  21. return false;
  22. Boat boat = Boat.Cast(trans);
  23. if (boat && boat.EngineIsOn())
  24. return true;
  25. }
  26. return false;
  27. }
  28. override void OnExecute(ActionData action_data)
  29. {
  30. HumanCommandVehicle vehCmd = action_data.m_Player.GetCommand_Vehicle();
  31. if (!vehCmd)
  32. return;
  33. Boat boat = Boat.Cast(vehCmd.GetTransport());
  34. if (boat)
  35. boat.EngineStop();
  36. }
  37. override bool CanBeUsedInVehicle()
  38. {
  39. return true;
  40. }
  41. override bool UseMainItem()
  42. {
  43. return false;
  44. }
  45. override bool HasTarget()
  46. {
  47. return false;
  48. }
  49. };